Package io.milton.http
Class HandlerHelper
java.lang.Object
io.milton.http.HandlerHelper
- Author:
- brad
-
Constructor Summary
ConstructorsConstructorDescriptionHandlerHelper(AuthenticationService authenticationService) HandlerHelper(AuthenticationService authenticationService, AuthorisationListener authorisationListener) HandlerHelper(AuthenticationService authenticationService, List<StorageChecker> storageCheckers) -
Method Summary
Modifier and TypeMethodDescriptioncheckAuthentication(HttpManager manager, Resource resource, Request request) booleancheckAuthorisation(HttpManager manager, Resource resource, Request request) booleancheckAuthorisation(HttpManager manager, Resource resource, Request request, Request.Method method, Auth auth) Check that the user has the priviledge to perform the requested operation on the primary resource, ie that which is specified or implied in the URL Note that for a PUT we canbooleancheckExpects(Http11ResponseHandler responseHandler, Request request, Response response) Checks the expect header, and responds if necessarycheckStorageOnAdd(Request request, CollectionResource nearestParent, Path parentPath, String host) checkStorageOnReplace(Request request, CollectionResource parentCol, Resource replaced, String host) booleandoCheckRedirect(Http11ResponseHandler responseHandler, Request request, Response response, Resource resource) booleanbooleanbooleanisLockedOut(Request inRequest, Resource inResource) booleanReturns true to indicate that the given resource MUST NOT handle the given method.booleanmissingLock(Request inRequest, Resource inParentcol) Check of an IF header, and if it exists return true if it contains "no-lock"voidsetEnableExpectContinue(boolean enableExpectContinue)
-
Constructor Details
-
HandlerHelper
public HandlerHelper(AuthenticationService authenticationService, List<StorageChecker> storageCheckers) -
HandlerHelper
-
HandlerHelper
public HandlerHelper(AuthenticationService authenticationService, AuthorisationListener authorisationListener)
-
-
Method Details
-
checkExpects
public boolean checkExpects(Http11ResponseHandler responseHandler, Request request, Response response) Checks the expect header, and responds if necessary- Parameters:
responseHandler-request-response-- Returns:
- - true if the expect header is ok. ie process normally. false means that we have sent a CONTINUE status and processing should stop until the request body is sent
-
checkAuthentication
public AuthenticationService.AuthStatus checkAuthentication(HttpManager manager, Resource resource, Request request) -
checkAuthorisation
-
checkAuthorisation
public boolean checkAuthorisation(HttpManager manager, Resource resource, Request request, Request.Method method, Auth auth) Check that the user has the priviledge to perform the requested operation on the primary resource, ie that which is specified or implied in the URL Note that for a PUT we can- Parameters:
manager-resource-request-auth-- Returns:
-
doCheckRedirect
public boolean doCheckRedirect(Http11ResponseHandler responseHandler, Request request, Response response, Resource resource) throws NotAuthorizedException, BadRequestException -
isLocked
-
isLockedOut
- Parameters:
inRequest-inResource-- Returns:
-
missingLock
Check of an IF header, and if it exists return true if it contains "no-lock"- Parameters:
inRequest-inParentcol-- Returns:
-
checkStorageOnReplace
public StorageChecker.StorageErrorReason checkStorageOnReplace(Request request, CollectionResource parentCol, Resource replaced, String host) -
checkStorageOnAdd
public StorageChecker.StorageErrorReason checkStorageOnAdd(Request request, CollectionResource nearestParent, Path parentPath, String host) -
isNotCompatible
Returns true to indicate that the given resource MUST NOT handle the given method. A return value of false indicates that it might.- Parameters:
r- - the resource to checkm- - the HTTP request method- Returns:
- - true to indicate the resource must not handle method m
-
isEnableExpectContinue
public boolean isEnableExpectContinue() -
setEnableExpectContinue
public void setEnableExpectContinue(boolean enableExpectContinue)
-