Class HttpManagerBuilder
Manages the options for configuring a HttpManager. To use it just set properties on this class, then call init, then call buildHttpManager to get a reference to the HttpManager.
Note that this uses a two-step construction process: init() buildHttpManager()
The first step creates instances of any objects which have not been set and the second binds them onto the HttpManager. You might want to modify the objects created in the first step, eg setting properties on default implementations. Note that you should not modify the structure of the resultant object graph, because you could then end up with an inconsistent configuration
Where possible, default implementations are created when this class is constructed allowing them to be overwritten where needed. However this is only done for objects and values which are "leaf" nodes in the config object graph. This is to avoid inconsistent configuration where different parts of milton end up with different implementations of the same concern. For example, PropFind and PropPatch could end up using different property sources
- Author:
- brad
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<AuthenticationHandler>protected AuthenticationServiceprotected AuthorisationListenerprotected BasicAuthHandlerprotected BeanPropertySourceprotected DefaultHttp11ResponseHandler.BUFFERINGprotected CacheControlHelperprotected ContentGeneratorprotected Stringprotected Stringprotected Stringprotected Listprotected CookieAuthenticationHandlerprotected List<AuthenticationHandler>protected Stringprotected Filterprotected Stringprotected DigestAuthenticationHandlerprotected DisplayNameFormatterprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected final booleanprotected EntityTransportprotected ETagGeneratorprotected EventManagerprotected ExpiredNonceRemoverprotected List<AuthenticationHandler>protected List<PropertySource>protected FileContentServiceprotected FormAuthenticationHandlerprotected Stringprotected HandlerHelperprotected Http11ResponseHandlerprotected booleanprotected List<InitListener>protected Stringprotected LoginResponseHandlerprotected ResourceFactoryprotected MatchHelperprotected MultiNamespaceCustomPropertySourceprotected booleanprotected NonceProviderprotected intprotected ResourceFactoryprotected WebDavResponseHandlerprotected PartialGetHelperprotected PropertyAuthoriserprotected List<PropertySource>protected PropFindXmlGeneratorprotected PropPatchSetterprotected ProtocolHandlersprotected ArrayList<HttpExtension>protected QuotaDataAccessorprotected ResourceHandlerHelperprotected ResourceTypeHelperprotected Fileprotected SecurityManagerprotected UrlAdapterprotected UserAgentHelperprotected ValueWritersprotected booleanprotected WebDavProtocolprotected WebDavResponseHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidOverridable method called after init but before buildprotected JsonResourceFactoryprotected voidprotected PropPatchSetterprotected voidbuildProtocolHandlers(WebDavResponseHandler webdavResponseHandler, ResourceTypeHelper resourceTypeHelper) protected voidprotected DefaultHttp11ResponseHandlercreateDefaultHttp11ResponseHandler(AuthenticationService authenticationService) Used to set context path on certain implementations of ResourceFactoryAs an alternative to package scanning via the controllerPackagesToScan property, set this property to a comma seperated list of class names.If not null, is expected to be a comma seperated list of package names.Instead of setting controller packages to scan or controller class names, you can set a list of actual controller instancesIf set will be used as the list of keys to validate cookie signatures, and the last will be used to sign new cookiesIf present is assumed to be a text file containing lines, where each line is a cookie signing key.Just a list of objects to be made available to auto-created objects via injectionYou can add some extra auth handlers here, which will be added to the default auth handler structure such as basic, digest and cookie.Passed to FilesystemResourceFactory when its createdSet this if you're using the FileSystemResourceFactory and you want to explicitly set a home directory.This is your own resource factory, which provides access to your data repository.Default max-age to use for certain resource types which can use a default valueMap holding nonce values issued in Digest authentication challengesintUsually set by milton, this will enhance the main resource factory with additional resources, such as .well-known supportused by FileSystemResourceFactory when its created as default resource factoryMainly used when creating filesystem resourcfe factory, but can also be used by other resoruce factories that want to delegate security managementfinal voidinit()This method creates instances of required objects which have not been set on the builder.protected BeanPropertySourceprotected voidprotected List<PropertySource>initDefaultPropertySources(ResourceTypeHelper resourceTypeHelper) protected PropertyAuthoriserprotected voidbooleanbooleanbooleanbooleanWhether to enable support for CK Editor server browser support.booleanbooleanbooleanbooleanIf true milton will response to Expect: Continue requests.booleanbooleanbooleanFalse by default, which means that OPTIONS requests will not trigger authentication.booleanIf quota is enabled, then extension properties to report quota information are available.booleanbooleanbooleanIf true signed cookies for authentication will be long-lived, as defined in CookieAuthenticationHandler.SECONDS_PER_YEARbooleanprotected PropFindPropertyBuilderprotected PropFindRequestFieldParserprotected SecurityManagervoidsetAuthenticationHandlers(List<AuthenticationHandler> authenticationHandlers) voidsetAuthenticationService(AuthenticationService authenticationService) voidsetAuthorisationListener(AuthorisationListener authorisationListener) voidsetBasicHandler(BasicAuthHandler basicHandler) voidsetBeanPropertySource(BeanPropertySource beanPropertySource) voidvoidsetCacheControlHelper(CacheControlHelper cacheControlHelper) voidsetCacheManager(CacheManager cacheManager) voidsetContentGenerator(ContentGenerator contentGenerator) voidsetContextPath(String contextPath) voidsetControllerClassNames(String controlleClassNames) voidsetControllerPackagesToScan(String controllerPackagesToScan) voidsetControllers(List controllers) voidsetCookieAuthenticationHandler(CookieAuthenticationHandler cookieAuthenticationHandler) voidsetCookieDelegateHandlers(List<AuthenticationHandler> cookieDelegateHandlers) voidsetCookieSigningKeys(List<String> cookieSigningKeys) voidsetCookieSigningKeysFile(String cookieSigningKeysFile) voidsetDefaultPassword(String defaultPassword) voidsetDefaultStandardFilter(Filter defaultStandardFilter) voidsetDefaultUser(String defaultUser) voidsetDependencies(List dependencies) voidsetDigestHandler(DigestAuthenticationHandler digestHandler) voidsetDisplayNameFormatter(DisplayNameFormatter displayNameFormatter) voidsetEnableBasicAuth(boolean enableBasicAuth) voidsetEnableCompression(boolean enableCompression) voidsetEnableCookieAuth(boolean enableCookieAuth) voidsetEnabledCkBrowser(boolean enabledCkBrowser) voidsetEnableDigestAuth(boolean enableDigestAuth) voidsetEnabledJson(boolean enabledJson) voidsetEnableEarlyAuth(boolean enableEarlyAuth) voidsetEnableExpectContinue(boolean enableExpectContinue) voidsetEnableFormAuth(boolean enableFormAuth) voidsetEnableOAuth2(boolean enableOAuth2) voidsetEnableOptionsAuth(boolean enableOptionsAuth) voidsetEnableQuota(boolean enableQuota) voidsetEntityTransport(EntityTransport entityTransport) voidseteTagGenerator(ETagGenerator eTagGenerator) voidsetEventManager(EventManager eventManager) voidsetExpiredNonceRemover(ExpiredNonceRemover expiredNonceRemover) voidsetExtraAuthenticationHandlers(List<AuthenticationHandler> extraAuthenticationHandlers) voidsetExtraPropertySources(List<PropertySource> extraPropertySources) voidsetFileContentService(FileContentService fileContentService) voidsetFilters(List<Filter> filters) voidsetFormAuthenticationHandler(FormAuthenticationHandler formAuthenticationHandler) voidsetFsContextPath(String fsContextPath) voidsetFsHomeDir(String fsHomeDir) voidsetFsRealm(String fsRealm) voidsetHandlerHelper(HandlerHelper handlerHelper) voidsetHttp11ResponseHandler(Http11ResponseHandler http11ResponseHandler) voidsetInitDone(boolean initDone) voidsetListeners(List<InitListener> listeners) voidsetLoginPage(String loginPage) voidsetLoginPageExcludePaths(List<String> loginPageExcludePaths) voidsetLoginPageTypeHandler(LoginResponseHandler.LoginPageTypeHandler loginPageTypeHandler) voidsetLoginResponseHandler(LoginResponseHandler loginResponseHandler) voidsetMainResourceFactory(ResourceFactory mainResourceFactory) voidsetMapOfNameAndPasswords(Map<String, String> mapOfNameAndPasswords) voidsetMatchHelper(MatchHelper matchHelper) voidsetMaxAgeSeconds(Long maxAgeSeconds) voidsetMultiNamespaceCustomPropertySource(MultiNamespaceCustomPropertySource multiNamespaceCustomPropertySource) voidsetMultiNamespaceCustomPropertySourceEnabled(boolean multiNamespaceCustomPropertySourceEnabled) voidsetNonceProvider(NonceProvider nonceProvider) voidvoidsetNonceValiditySeconds(int nonceValiditySeconds) voidsetoAuth2Handler(OAuth2AuthenticationHandler oAuth2Handler) voidsetOAuth2Handler(OAuth2AuthenticationHandler oAuth2Handler) voidsetOuterResourceFactory(ResourceFactory outerResourceFactory) voidsetOuterWebdavResponseHandler(WebDavResponseHandler outerWebdavResponseHandler) voidsetPartialGetHelper(PartialGetHelper partialGetHelper) voidsetPropertyAuthoriser(PropertyAuthoriser propertyAuthoriser) voidsetPropertySources(List<PropertySource> propertySources) voidsetPropFindPropertyBuilder(PropFindPropertyBuilder propFindPropertyBuilder) voidsetPropFindRequestFieldParser(PropFindRequestFieldParser propFindRequestFieldParser) voidsetPropFindXmlGenerator(PropFindXmlGenerator propFindXmlGenerator) voidsetPropPatchSetter(PropPatchSetter propPatchSetter) voidsetProtocolHandlers(ProtocolHandlers protocolHandlers) voidsetProtocols(ArrayList<HttpExtension> protocols) voidsetQuotaDataAccessor(QuotaDataAccessor quotaDataAccessor) voidsetResourceFactory(ResourceFactory resourceFactory) voidsetResourceHandlerHelper(ResourceHandlerHelper resourceHandlerHelper) voidsetResourceTypeHelper(ResourceTypeHelper resourceTypeHelper) voidsetRootDir(File rootDir) voidsetSecurityManager(SecurityManager securityManager) voidsetShutdownHandlers(List<Stoppable> shutdownHandlers) voidsetUrlAdapter(UrlAdapter urlAdapter) voidsetUseLongLivedCookies(boolean useLongLivedCookies) voidsetUserAgentHelper(UserAgentHelper userAgentHelper) voidsetValueWriters(ValueWriters valueWriters) voidsetWebdavEnabled(boolean webdavEnabled) voidsetWebDavProtocol(WebDavProtocol webDavProtocol) voidsetWebdavResponseHandler(WebDavResponseHandler webdavResponseHandler) protected voidprotected UserAgentHelper
-
Field Details
-
enableTextContentProperty
protected final boolean enableTextContentProperty- See Also:
-
listeners
-
mainResourceFactory
-
outerResourceFactory
-
fileContentService
-
buffering
-
authenticationHandlers
-
extraAuthenticationHandlers
-
cookieDelegateHandlers
-
digestHandler
-
basicHandler
-
cookieAuthenticationHandler
-
formAuthenticationHandler
-
nonces
-
nonceValiditySeconds
protected int nonceValiditySeconds -
nonceProvider
-
authenticationService
-
expiredNonceRemover
-
shutdownHandlers
-
resourceTypeHelper
-
webdavResponseHandler
-
outerWebdavResponseHandler
-
contentGenerator
-
cacheControlHelper
-
handlerHelper
-
authorisationListener
-
protocols
-
protocolHandlers
-
entityTransport
-
eventManager
-
propertyAuthoriser
-
propertySources
-
extraPropertySources
-
eTagGenerator
-
http11ResponseHandler
-
valueWriters
-
propFindXmlGenerator
-
filters
-
defaultStandardFilter
-
urlAdapter
-
quotaDataAccessor
-
propPatchSetter
-
enableOptionsAuth
protected boolean enableOptionsAuth -
resourceHandlerHelper
-
initDone
protected boolean initDone -
enableCompression
protected boolean enableCompression -
enabledJson
protected boolean enabledJson -
enableBasicAuth
protected boolean enableBasicAuth -
enableDigestAuth
protected boolean enableDigestAuth -
enableFormAuth
protected boolean enableFormAuth -
enableCookieAuth
protected boolean enableCookieAuth -
enabledCkBrowser
protected boolean enabledCkBrowser -
enableEarlyAuth
protected boolean enableEarlyAuth -
loginPage
-
loginPageExcludePaths
-
rootDir
-
securityManager
-
contextPath
-
fsRealm
-
mapOfNameAndPasswords
-
defaultUser
-
defaultPassword
-
userAgentHelper
-
multiNamespaceCustomPropertySource
-
multiNamespaceCustomPropertySourceEnabled
protected boolean multiNamespaceCustomPropertySourceEnabled -
beanPropertySource
-
webDavProtocol
-
displayNameFormatter
-
webdavEnabled
protected boolean webdavEnabled -
matchHelper
-
partialGetHelper
-
loginResponseHandler
-
loginPageTypeHandler
-
enableExpectContinue
protected boolean enableExpectContinue -
controllerPackagesToScan
-
controllerClassNames
-
controllers
-
-
Constructor Details
-
HttpManagerBuilder
public HttpManagerBuilder()
-
-
Method Details
-
securityManager
-
init
public final void init()This method creates instances of required objects which have not been set on the builder.These are subsequently wired together immutably in HttpManager when buildHttpManager is called.
You can call this before calling buildHttpManager if you would like to modify property values on the created objects before HttpManager is instantiated. Otherwise, you can call buildHttpManager directly and it will call init if it has not been called
-
initCookieSigningKeys
protected void initCookieSigningKeys() -
buildHttpManager
-
afterInit
protected void afterInit()Overridable method called after init but before build -
initPropertyAuthoriser
-
initDefaultPropertySources
-
initBeanPropertySource
-
createDefaultHttp11ResponseHandler
protected DefaultHttp11ResponseHandler createDefaultHttp11ResponseHandler(AuthenticationService authenticationService) -
buildResourceTypeHelper
protected void buildResourceTypeHelper() -
buildProtocolHandlers
protected void buildProtocolHandlers(WebDavResponseHandler webdavResponseHandler, ResourceTypeHelper resourceTypeHelper) -
initWebdavProtocol
protected void initWebdavProtocol() -
propFindRequestFieldParser
-
buildOuterResourceFactory
protected void buildOuterResourceFactory() -
buildJsonResourceFactory
-
buildPatchSetter
-
getBuffering
-
setBuffering
-
getResourceFactory
-
setResourceFactory
-
getAuthenticationHandlers
-
setAuthenticationHandlers
-
getExtraAuthenticationHandlers
You can add some extra auth handlers here, which will be added to the default auth handler structure such as basic, digest and cookie.- Returns:
-
setExtraAuthenticationHandlers
-
getNonces
Map holding nonce values issued in Digest authentication challenges- Returns:
-
setNonces
-
getMainResourceFactory
This is your own resource factory, which provides access to your data repository. Not to be confused with outerResourceFactory which is normally used for milton specific things- Returns:
-
setMainResourceFactory
-
getOuterResourceFactory
Usually set by milton, this will enhance the main resource factory with additional resources, such as .well-known support- Returns:
-
setOuterResourceFactory
-
getNonceValiditySeconds
public int getNonceValiditySeconds() -
setNonceValiditySeconds
public void setNonceValiditySeconds(int nonceValiditySeconds) -
getNonceProvider
-
setNonceProvider
-
getAuthenticationService
-
setAuthenticationService
-
getExpiredNonceRemover
-
setExpiredNonceRemover
-
getShutdownHandlers
-
setShutdownHandlers
-
getResourceTypeHelper
-
setResourceTypeHelper
-
getWebdavResponseHandler
-
setWebdavResponseHandler
-
getHandlerHelper
-
setHandlerHelper
-
getProtocols
-
setProtocols
-
getProtocolHandlers
-
setProtocolHandlers
-
getEntityTransport
-
setEntityTransport
-
getEventManager
-
setEventManager
-
getPropertyAuthoriser
-
setPropertyAuthoriser
-
getPropertySources
-
setPropertySources
-
geteTagGenerator
-
seteTagGenerator
-
getHttp11ResponseHandler
-
setHttp11ResponseHandler
-
getValueWriters
-
setValueWriters
-
getPropFindXmlGenerator
-
setPropFindXmlGenerator
-
getFilters
-
setFilters
-
getDefaultStandardFilter
-
setDefaultStandardFilter
-
getUrlAdapter
-
setUrlAdapter
-
getQuotaDataAccessor
-
setQuotaDataAccessor
-
getPropPatchSetter
-
setPropPatchSetter
-
isInitDone
public boolean isInitDone() -
setInitDone
public void setInitDone(boolean initDone) -
isEnableOptionsAuth
public boolean isEnableOptionsAuth()False by default, which means that OPTIONS requests will not trigger authentication. This is required for windows 7 -
setEnableOptionsAuth
public void setEnableOptionsAuth(boolean enableOptionsAuth) -
isEnableCompression
public boolean isEnableCompression() -
setEnableCompression
public void setEnableCompression(boolean enableCompression) -
isEnabledJson
public boolean isEnabledJson() -
setEnabledJson
public void setEnabledJson(boolean enabledJson) -
getExtraPropertySources
-
setExtraPropertySources
-
showLog
- Parameters:
propertyName-defaultedTo-
-
isEnableBasicAuth
public boolean isEnableBasicAuth() -
setEnableBasicAuth
public void setEnableBasicAuth(boolean enableBasicAuth) -
isEnableCookieAuth
public boolean isEnableCookieAuth() -
setEnableCookieAuth
public void setEnableCookieAuth(boolean enableCookieAuth) -
isEnableDigestAuth
public boolean isEnableDigestAuth() -
setEnableDigestAuth
public void setEnableDigestAuth(boolean enableDigestAuth) -
isEnableFormAuth
public boolean isEnableFormAuth() -
setEnableFormAuth
public void setEnableFormAuth(boolean enableFormAuth) -
getBasicHandler
-
setBasicHandler
-
getoAuth2Handler
-
setoAuth2Handler
-
getCookieAuthenticationHandler
-
setCookieAuthenticationHandler
-
getCookieDelegateHandlers
-
setCookieDelegateHandlers
-
getDigestHandler
-
setDigestHandler
-
getOAuth2Handler
-
setOAuth2Handler
-
isEnableOAuth2
public boolean isEnableOAuth2() -
setEnableOAuth2
public void setEnableOAuth2(boolean enableOAuth2) -
getFormAuthenticationHandler
-
setFormAuthenticationHandler
-
getLoginPage
-
setLoginPage
-
getLoginPageExcludePaths
-
setLoginPageExcludePaths
-
getResourceHandlerHelper
-
setResourceHandlerHelper
-
getRootDir
used by FileSystemResourceFactory when its created as default resource factory- Returns:
-
setRootDir
-
getSecurityManager
Mainly used when creating filesystem resourcfe factory, but can also be used by other resoruce factories that want to delegate security management- Returns:
-
setSecurityManager
-
getFsContextPath
Passed to FilesystemResourceFactory when its created- Returns:
-
setFsContextPath
-
getContextPath
Used to set context path on certain implementations of ResourceFactoryAlias for fsContentPath
- Returns:
-
setContextPath
-
getUserAgentHelper
-
setUserAgentHelper
-
getDefaultPassword
-
setDefaultPassword
-
getDefaultUser
-
setDefaultUser
-
getFsRealm
-
setFsRealm
-
getMapOfNameAndPasswords
-
setMapOfNameAndPasswords
-
getMultiNamespaceCustomPropertySource
-
setMultiNamespaceCustomPropertySource
public void setMultiNamespaceCustomPropertySource(MultiNamespaceCustomPropertySource multiNamespaceCustomPropertySource) -
getBeanPropertySource
-
setBeanPropertySource
-
isEnabledCkBrowser
public boolean isEnabledCkBrowser()Whether to enable support for CK Editor server browser support. If enabled this will inject the FckResourceFactory into your ResourceFactory stack.Note this will have no effect if outerResourceFactory is already set, as that is the top of the stack.
- Returns:
-
setEnabledCkBrowser
public void setEnabledCkBrowser(boolean enabledCkBrowser) -
getWebDavProtocol
-
setWebDavProtocol
-
isWebdavEnabled
public boolean isWebdavEnabled() -
setWebdavEnabled
public void setWebdavEnabled(boolean webdavEnabled) -
getMatchHelper
-
setMatchHelper
-
getPartialGetHelper
-
setPartialGetHelper
-
isMultiNamespaceCustomPropertySourceEnabled
public boolean isMultiNamespaceCustomPropertySourceEnabled() -
setMultiNamespaceCustomPropertySourceEnabled
public void setMultiNamespaceCustomPropertySourceEnabled(boolean multiNamespaceCustomPropertySourceEnabled) -
getLoginPageTypeHandler
-
setLoginPageTypeHandler
-
getLoginResponseHandler
-
setLoginResponseHandler
-
getListeners
-
setListeners
-
getFileContentService
-
setFileContentService
-
getCacheControlHelper
-
setCacheControlHelper
-
getContentGenerator
-
setContentGenerator
-
isEnableExpectContinue
public boolean isEnableExpectContinue()If true milton will response to Expect: Continue requests. This can cause a problem on some web servers- Returns:
-
setEnableExpectContinue
public void setEnableExpectContinue(boolean enableExpectContinue) -
getOuterWebdavResponseHandler
-
setOuterWebdavResponseHandler
-
getControllerPackagesToScan
If not null, is expected to be a comma seperated list of package names. These will be scanned for classes which contain classes annotated with ResourceController, and those found will be added to the controllers list- Returns:
-
setControllerPackagesToScan
-
getControllerClassNames
As an alternative to package scanning via the controllerPackagesToScan property, set this property to a comma seperated list of class names. These will be loaded and checked for the ResourceController annotation, and if present, will be added to the controllers list- Returns:
-
setControllerClassNames
-
getControllers
Instead of setting controller packages to scan or controller class names, you can set a list of actual controller instances- Returns:
-
setControllers
-
isEnableQuota
public boolean isEnableQuota()If quota is enabled, then extension properties to report quota information are available.- Returns:
-
setEnableQuota
public void setEnableQuota(boolean enableQuota) -
getMaxAgeSeconds
Default max-age to use for certain resource types which can use a default value- Returns:
-
setMaxAgeSeconds
-
getDisplayNameFormatter
-
setDisplayNameFormatter
-
getFsHomeDir
Set this if you're using the FileSystemResourceFactory and you want to explicitly set a home directory. If left null milton will use the user.home System property- Returns:
-
setFsHomeDir
-
getCookieSigningKeys
If set will be used as the list of keys to validate cookie signatures, and the last will be used to sign new cookies- Returns:
-
setCookieSigningKeys
-
isUseLongLivedCookies
public boolean isUseLongLivedCookies()If true signed cookies for authentication will be long-lived, as defined in CookieAuthenticationHandler.SECONDS_PER_YEAR- Returns:
-
setUseLongLivedCookies
public void setUseLongLivedCookies(boolean useLongLivedCookies) -
getCookieSigningKeysFile
If present is assumed to be a text file containing lines, where each line is a cookie signing key. The last will be used to sign cookies, previous will be available to validateOnly used if cookieSigningKeys is null
- Returns:
-
setCookieSigningKeysFile
-
getPropFindPropertyBuilder
-
setPropFindPropertyBuilder
-
getPropFindRequestFieldParser
-
setPropFindRequestFieldParser
-
userAgentHelper
-
propFindPropertyBuilder
-
getRootContext
-
getDependencies
Just a list of objects to be made available to auto-created objects via injection- Returns:
-
setDependencies
-
isEnableEarlyAuth
public boolean isEnableEarlyAuth() -
setEnableEarlyAuth
public void setEnableEarlyAuth(boolean enableEarlyAuth) -
getCacheManager
-
setCacheManager
-
getAuthorisationListener
-
setAuthorisationListener
-