| com.atlassian.stash.scm.ScmRequest |
Known Indirect Subclasses
|
Class Overview
A read or write request targeting a Stash repository. Instances are pass through a series of validators managed by
the ScmRequestCheckService to verify preconditions (e.g. permissions), before they are
handled.
Invalid requests
do not are ignored by the
ScmRequestCheckService and are
handled directly. It is assumed that the handling performed will deal with messaging
the reason the request was invalid to the client.
Summary
| Public Methods |
|
@Nullable
Repository
|
getRepository()
|
|
void
|
handleRequest()
Performs whatever logic is necessary to handle the request.
|
|
boolean
|
isInvalid()
Retrieves a flag indicating whether the request is invalid.
|
|
boolean
|
isWrite()
|
|
void
|
sendAuthenticationError(AuthenticationState state, String message, String detailMessage)
|
|
void
|
sendError(String summary, String detailMessage)
Sends the provided error details to the client, using SCM- and RPC-specific techniques as necessary.
|
Public Methods
@Nullable
public
Repository
getRepository
()
Returns
- the repository that is the target of this action. May be null if a repository could not be
resolved for the action but you wish to use the
ScmRequestCheckService to provide error messaging
consistent with other scm plugins.
public
void
handleRequest
()
Performs whatever logic is necessary to handle the request. The exact operations performed are both SCM and
RPC-specific, and left entirely to the implementor. Implementations may throw IOException to indicate
failures related to reading input or writing output during processing.
Throws
| IOException
| if reading or writing fails during processing
|
public
boolean
isInvalid
()
Retrieves a flag indicating whether the request is invalid.
When
ScmRequest factories are evaluating incoming requests, requests which
look like they belong
to the plugin in question but which use invalid or unsupported syntax may be encountered. Such requests should
still be handled by the plugin, rather than being passed on. For such requests, this flag provides a mechanism
for the handler to indicate that the request was understood but is invalid.
Invalid requests will not be
checked, but will
still be
handled.
Returns
true if the request is understood but not valid; otherwise false to indicate that the
request is valid and should be checked
public
boolean
isWrite
()
Returns
- true if this is a write operation (e.g. a push to a repository) or false if it is a read-only operation
(e.g. a pull or clone from a repository)
public
void
sendAuthenticationError
(AuthenticationState state, String message, String detailMessage)
Parameters
| state
| the current state of the user's authentication, see AuthenticationState for details |
| message
| an i18n'd message to (optionally) send to the client if it supports displaying custom messages |
| detailMessage
| a longer detailed explanation of the problem |
Throws
| IOException
| if there was a problem reading from the request or writing to the response
|
public
void
sendError
(String summary, String detailMessage)
Sends the provided error details to the client, using SCM- and RPC-specific techniques as necessary.
Parameters
| summary
| a brief summary of the error |
| detailMessage
| a more detailed explanation of the failure |
Throws
| IOException
| if the error details cannot be written to the underlying output mechanism
|