Package com.atlassian.bitbucket.scm.http
Interface HttpScmRequestHandler
public interface HttpScmRequestHandler
Plugin point for providing handlers for HTTP requests for SCM hosting operations.
 
 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, jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse) will be called.
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptioncreate(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Returns anHttpScmRequestto service the supplied request, orOptional.empty()if the request could not be created.voidsendAuthenticationError(AuthenticationState state, String summary, String detailMessage, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) voidsendError(String summary, String detailMessage, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) booleansupports(HttpRequestDetails requestDetails) Returns whether the handler can service the supplied request.
- 
Method Details- 
create@Nonnull Optional<HttpScmRequest> create(@Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.servlet.http.HttpServletResponse response) Returns anHttpScmRequestto service the supplied request, orOptional.empty()if the request could not be created. This method is only called whensupports(com.atlassian.bitbucket.scm.http.HttpRequestDetails)returnedtruefor that request.- Parameters:
- request- an- HttpServletRequesttargeting /scm/* (e.g. an HTTP request from the git client binary)
- response- the- HttpServletResponse
- Returns:
- an HttpScmRequestto service the request, orOptional.empty()
- Throws:
- com.atlassian.bitbucket.repository.NoSuchRepositoryException- if the repository could not be found
- com.atlassian.bitbucket.AuthorisationException- if the repository is not accessible
 
- 
sendAuthenticationErrorvoid sendAuthenticationError(@Nonnull AuthenticationState state, @Nonnull String summary, @Nonnull String detailMessage, @Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.servlet.http.HttpServletResponse response) throws IOException - Parameters:
- state- the current state of the user's authentication, see- AuthenticationStatefor details
- summary- an i18n'd message to (optionally) send to the client if it supports displaying custom messages
- detailMessage- a longer detailed explanation of the problem
- request- an- HttpServletRequesttargeting /scm/* (e.g. an HTTP request from the git client binary)
- response- the- HttpServletResponse
- Throws:
- IOException- if there was a problem reading from the request or writing to the response
 
- 
sendErrorvoid sendError(@Nonnull String summary, @Nonnull String detailMessage, @Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.servlet.http.HttpServletResponse response) throws IOException - Parameters:
- summary- an i18n'd message to (optionally) send to the client if it supports displaying custom messages
- detailMessage- a longer detailed explanation of the problem
- request- an- HttpServletRequesttargeting /scm/* (e.g. an HTTP request from the git client binary)
- response- the- HttpServletResponse
- Throws:
- IOException- if there was a problem writing to the response
 
- 
supportsReturns whether the handler can service the supplied request.falsemeans that the request will be passed on to theHttpScmRequestHandlerprovided by theHttpScmRequestHandlerModuleDescriptorwith the next heaviest weight.- Parameters:
- requestDetails-- HttpRequestDetailsfrom the request targeting /scm/* (e.g. an HTTP request from the git client binary)
- Returns:
- trueif the handler can service this request,- falseotherwise
 
 
-