Package io.milton.http.annotated
Class AnnotationResourceFactory
java.lang.Object
io.milton.http.annotated.AnnotationResourceFactory
- All Implemented Interfaces:
ResourceFactory
A resource factory which provides access to files in a file system.
Using this with milton is equivalent to using the dav servlet in tomcat
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[]buildInvokeArgs(AnnoResource sourceRes, Method m, Object... otherValues) Object[]buildInvokeArgsExt(AnnoResource sourceRes, Object mandatorySecondArg, boolean forceUseSecondArg, Method m, Object... otherValues) voidcreateAndAppend(Collection<AnnoResource> result, Object sources, AnnoCollectionResource parent, ControllerMethod cm) Process the source object (which may be a Collection of source objects), and for each one instantiate an AnnoResource and append it to the result setcreateLockHolder(AnnoCollectionResource parentCollection, String name, LockTimeout timeout, LockInfo lockInfo) Create an in-memory resource with the given timeout.findFromRoot(AnnoCollectionResource rootFolder, Path p) findMethodForAnno(Class sourceClass, Class annoClass) getResource(String host, String url) Null-safe method to get the list of lock holders for the given parent.getTempResourcesForParent(String parentKey) Get a context path which is definitely valid as a path.instantiate(LockHolder r, AnnoCollectionResource parent) instantiate(Object childSource, AnnoCollectionResource parent, Method m) Create a Resource to wrap a source pojo object.booleanisCompatible(Object source, Request.Method m) booleanIf true authentication will be attempted as soon as the root resource is locatedvoidremoveLockHolder(AnnoCollectionResource parent, String name) Removes the LockHolder from memory and also from the parent which contains it (if loaded)voidsetAuthenticationService(AuthenticationService authenticationService) voidsetCalendarSearchService(CalendarSearchService calendarSearchService) voidsetContextPath(String contextPath) voidsetControllers(Collection<Object> controllers) voidsetDoEarlyAuth(boolean doEarlyAuth) voidsetLockManager(LockManager lockManager) voidsetMapOfTempResources(Map<String, List<LockHolder>> mapOfTempResources) voidsetMaxAgeSeconds(Long maxAgeSeconds) voidsetSecurityManager(SecurityManager securityManager) voidsetViewResolver(ViewResolver viewResolver) stripContext(String url)
-
Constructor Details
-
AnnotationResourceFactory
public AnnotationResourceFactory()
-
-
Method Details
-
getResource
public Resource getResource(String host, String url) throws NotAuthorizedException, BadRequestException - Specified by:
getResourcein interfaceResourceFactory- Throws:
NotAuthorizedExceptionBadRequestException
-
findFromRoot
public Resource findFromRoot(AnnoCollectionResource rootFolder, Path p) throws NotAuthorizedException, BadRequestException -
getRealm
-
setAuthenticationService
-
getAuthenticationService
-
getCalendarSearchService
-
setCalendarSearchService
-
isDoEarlyAuth
public boolean isDoEarlyAuth()If true authentication will be attempted as soon as the root resource is located- Returns:
-
setDoEarlyAuth
public void setDoEarlyAuth(boolean doEarlyAuth) -
setSecurityManager
-
getSecurityManager
-
setMaxAgeSeconds
-
getMaxAgeSeconds
-
getLockManager
-
setLockManager
-
setContextPath
-
getContextPath
-
getValidContextPath
Get a context path which is definitely valid as a path. Ie it always begins with a slash, and ends with a slash, and is a single slash if representing the root- Returns:
-
stripContext
-
getControllers
-
setControllers
-
getViewResolver
-
setViewResolver
-
isCompatible
-
buildInvokeArgs
public Object[] buildInvokeArgs(AnnoResource sourceRes, Method m, Object... otherValues) throws Exception - Parameters:
sourceRes-m-otherValues- - any other values to be provided which can be mapped onto method arguments- Returns:
- Throws:
Exception
-
buildInvokeArgsExt
public Object[] buildInvokeArgsExt(AnnoResource sourceRes, Object mandatorySecondArg, boolean forceUseSecondArg, Method m, Object... otherValues) throws Exception - Parameters:
sourceRes-mandatorySecondArg- - if present will be used as second arg. Used by AccessControlListAnnotationHandler to always provide user to second arg, even when nullforceUseSecondArg-m-otherValues-- Returns:
- Throws:
Exception
-
findMethodForAnno
-
instantiate
Create a Resource to wrap a source pojo object.- Parameters:
childSource-parent-m-- Returns:
-
instantiate
-
createLockHolder
public LockHolder createLockHolder(AnnoCollectionResource parentCollection, String name, LockTimeout timeout, LockInfo lockInfo) Create an in-memory resource with the given timeout. The resource will not be persisted, but may be distributed among the cluster if configured as such. The resource may be flushed from the in-memory list after the given timeout if not-null The type of the object returned is not intended to have any significance and does not contain any meaningful content- Parameters:
parentCollection-name-timeout- - optional. The resource will be removed after this timeout expireslockInfo-- Returns:
- - a temporary (not persistent) resource of an indeterminate type
-
getTempResourcesForParent
Null-safe method to get the list of lock holders for the given parent. These are resources created by a LOCK-null request, where resources are locked prior to being created. The lock-null resource is replaced following a PUT to that resource- Parameters:
parent-- Returns:
-
getTempResourcesForParent
-
removeLockHolder
Removes the LockHolder from memory and also from the parent which contains it (if loaded)- Parameters:
parent-name-
-
getMapOfTempResources
-
setMapOfTempResources
-
createAndAppend
public void createAndAppend(Collection<AnnoResource> result, Object sources, AnnoCollectionResource parent, ControllerMethod cm) Process the source object (which may be a Collection of source objects), and for each one instantiate an AnnoResource and append it to the result set- Parameters:
result- - to append tosources- - single source object, or multiple source objects in a Collectionparent- - the parent collection of these resource(s)cm- - the controller method they were found by
-
getCalendarDateRangeQueryAnnotationHandler
-
getCalendarInvitationsAnnotationHandler
-
getCalendarInvitationsCTagAnnotationHandler
-
getFreeBusyQueryAnnotationHandler
-
getUsersAnnotationHandler
-