Package io.milton.http.http11
Interface Http11ResponseHandler
- All Superinterfaces:
ETagGenerator
- All Known Subinterfaces:
WebDavResponseHandler
- All Known Implementing Classes:
AbstractWrappingResponseHandler,CompressingResponseHandler,DefaultHttp11ResponseHandler,DefaultWebDavResponseHandler,LoginResponseHandler
The ResponseHandler should handle all responses back to the client.
Methods are provided for each significant response circumstance with respect
to Milton.
The intention is that implementations may be provided or customised to support
per implementation requirements for client compatibility.
In other words, hacks to support particular client programs should be implemented
here
Extends ETagGenerator to facillitate wrapping, although generatlly it will
contain an instance and delegate to it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidrespondBadRequest(Resource resource, Response response, Request request) Respond with a 400 statusvoidrespondConflict(Resource resource, Response response, Request request, String message) voidvoidrespondCreated(Resource resource, Response response, Request request) voidrespondDeleteFailed(Request request, Response response, Resource resource, Response.Status status) Called when a delete has failed, including the failure status.voidrespondExpectationFailed(Response response, Request request) Response with a 417voidrespondForbidden(Resource resource, Response response, Request request) Respond with a 403 status - forbiddenvoidrespondHead(Resource resource, Response response, Request request) Generate a HEAD responsevoidrespondMethodNotAllowed(Resource res, Response response, Request request) voidrespondMethodNotImplemented(Resource resource, Response response, Request request) voidrespondNoContent(Resource resource, Response response, Request request) Invoked when an operation is successful, but there is no content, and there is nothing more specific to return (E.g. created) For example, as a result of a PUT when a resouce has been updated)voidrespondNotFound(Response response, Request request) voidrespondNotModified(GetableResource resource, Response response, Request request) voidrespondPartialContent(GetableResource resource, Response response, Request request, Map<String, String> params, Range range) Respond with content from a single range, in a partial GETvoidrespondPartialContent(GetableResource resource, Response response, Request request, Map<String, String> params, List<Range> ranges) Respond with multiple ranges for a partial GETvoidrespondPreconditionFailed(Request request, Response response, Resource resource) Generate a 412 response,voidrespondRedirect(Response response, Request request, String redirectUrl) voidrespondServerError(Request request, Response response, String reason) Usually a 500 error.voidrespondUnauthorised(Resource resource, Response response, Request request) voidrespondWithOptions(Resource resource, Response response, Request request, List<String> methodsAllowed) Methods inherited from interface io.milton.http.http11.ETagGenerator
generateEtag
-
Method Details
-
respondNoContent
Invoked when an operation is successful, but there is no content, and there is nothing more specific to return (E.g. created) For example, as a result of a PUT when a resouce has been updated)- Parameters:
resource-response-request-
-
respondContent
void respondContent(Resource resource, Response response, Request request, Map<String, String> params) throws NotAuthorizedException, BadRequestException, NotFoundException -
respondPartialContent
void respondPartialContent(GetableResource resource, Response response, Request request, Map<String, String> params, Range range) throws NotAuthorizedException, BadRequestException, NotFoundExceptionRespond with content from a single range, in a partial GET- Parameters:
resource-response-request-params-range-- Throws:
NotAuthorizedExceptionBadRequestExceptionNotFoundException
-
respondPartialContent
void respondPartialContent(GetableResource resource, Response response, Request request, Map<String, String> params, List<Range> ranges) throws NotAuthorizedException, BadRequestException, NotFoundExceptionRespond with multiple ranges for a partial GET- Parameters:
resource-response-request-params-ranges-- Throws:
NotAuthorizedExceptionBadRequestExceptionNotFoundException
-
respondCreated
-
respondUnauthorised
-
respondMethodNotImplemented
-
respondMethodNotAllowed
-
respondConflict
-
respondRedirect
-
respondNotModified
-
respondNotFound
-
respondWithOptions
-
respondHead
Generate a HEAD response- Parameters:
resource-response-request-
-
respondExpectationFailed
Response with a 417 -
respondBadRequest
Respond with a 400 status- Parameters:
resource-response-request-params-
-
respondForbidden
Respond with a 403 status - forbidden- Parameters:
resource-response-request-params-
-
respondDeleteFailed
void respondDeleteFailed(Request request, Response response, Resource resource, Response.Status status) Called when a delete has failed, including the failure status. Note that webdav implementations will respond with a multisttus, while http 1.1 implementations will simply set the response status- Parameters:
request-response-resource- - the resource which could not be deletedstatus- - the status which has caused the delete to fail.
-
respondServerError
Usually a 500 error. Some error occured processing the request. Note that you might not be able to assume that this will generate all 500 errors since a runtime exception might result in code outside of milton's control generating the 500 response.- Parameters:
request-response-reason-
-
respondPreconditionFailed
Generate a 412 response,- Parameters:
request-response-resource-
-