public interface HttpScmRequestHandler
Bitbucket will automatically attempt to authenticate requests using its standard authentication stack
(which includes support for Basic Auth). If authentication is required but was not provided or there were invalid
credentials, sendAuthenticationError(com.atlassian.bitbucket.scm.AuthenticationState, java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
will be called.
Modifier and Type | Method and Description |
---|---|
Optional<HttpScmRequest> |
create(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Returns an
HttpScmRequest to service the supplied request, or Optional.empty() if the request
could not be created. |
void |
sendAuthenticationError(AuthenticationState state,
String summary,
String detailMessage,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
sendError(String summary,
String detailMessage,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
boolean |
supports(HttpRequestDetails requestDetails)
Returns whether the handler can service the supplied request.
|
@Nonnull Optional<HttpScmRequest> create(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
HttpScmRequest
to service the supplied request, or Optional.empty()
if the request
could not be created. This method is only called when supports(com.atlassian.bitbucket.scm.http.HttpRequestDetails)
returned true
for that request.request
- an HttpServletRequest
targeting /scm/* (e.g. an HTTP request from the git client binary)response
- the HttpServletResponse
HttpScmRequest
to service the request, or Optional.empty()
com.atlassian.bitbucket.repository.NoSuchRepositoryException
- if the repository could not be foundcom.atlassian.bitbucket.AuthorisationException
- if the repository is not accessiblevoid sendAuthenticationError(@Nonnull AuthenticationState state, @Nonnull String summary, @Nonnull String detailMessage, @Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) throws IOException
state
- the current state of the user's authentication, see AuthenticationState
for detailssummary
- an i18n'd message to (optionally) send to the client if it supports displaying custom messagesdetailMessage
- a longer detailed explanation of the problemrequest
- an HttpServletRequest
targeting /scm/* (e.g. an HTTP request from the git client binary)response
- the HttpServletResponse
IOException
- if there was a problem reading from the request or writing to the responsevoid sendError(@Nonnull String summary, @Nonnull String detailMessage, @Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) throws IOException
summary
- an i18n'd message to (optionally) send to the client if it supports displaying custom messagesdetailMessage
- a longer detailed explanation of the problemrequest
- an HttpServletRequest
targeting /scm/* (e.g. an HTTP request from the git client binary)response
- the HttpServletResponse
IOException
- if there was a problem writing to the responseboolean supports(@Nonnull HttpRequestDetails requestDetails)
false
means that the request will be passed
on to the HttpScmRequestHandler
provided by the HttpScmRequestHandlerModuleDescriptor
with the
next heaviest weight.requestDetails
- HttpRequestDetails
from the request targeting /scm/* (e.g. an HTTP request from the git client binary)true
if the handler can service this request, false
otherwiseCopyright © 2020 Atlassian. All rights reserved.