Class HttpManagerBuilder

java.lang.Object
io.milton.config.HttpManagerBuilder

public class HttpManagerBuilder extends Object

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
  • Field Details

  • Constructor Details

    • HttpManagerBuilder

      public HttpManagerBuilder()
  • Method Details

    • securityManager

      protected SecurityManager 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

      public HttpManager buildHttpManager()
    • afterInit

      protected void afterInit()
      Overridable method called after init but before build
    • initPropertyAuthoriser

      protected PropertyAuthoriser initPropertyAuthoriser()
    • initDefaultPropertySources

      protected List<PropertySource> initDefaultPropertySources(ResourceTypeHelper resourceTypeHelper)
    • initBeanPropertySource

      protected BeanPropertySource initBeanPropertySource()
    • createDefaultHttp11ResponseHandler

      protected DefaultHttp11ResponseHandler createDefaultHttp11ResponseHandler(AuthenticationService authenticationService)
    • buildResourceTypeHelper

      protected void buildResourceTypeHelper()
    • buildProtocolHandlers

      protected void buildProtocolHandlers(WebDavResponseHandler webdavResponseHandler, ResourceTypeHelper resourceTypeHelper)
    • initWebdavProtocol

      protected void initWebdavProtocol()
    • propFindRequestFieldParser

      protected PropFindRequestFieldParser propFindRequestFieldParser()
    • buildOuterResourceFactory

      protected void buildOuterResourceFactory()
    • buildJsonResourceFactory

      protected JsonResourceFactory buildJsonResourceFactory()
    • buildPatchSetter

      protected PropPatchSetter buildPatchSetter()
    • getBuffering

    • setBuffering

      public void setBuffering(DefaultHttp11ResponseHandler.BUFFERING buffering)
    • getResourceFactory

      public ResourceFactory getResourceFactory()
    • setResourceFactory

      public void setResourceFactory(ResourceFactory resourceFactory)
    • getAuthenticationHandlers

      public List<AuthenticationHandler> getAuthenticationHandlers()
    • setAuthenticationHandlers

      public void setAuthenticationHandlers(List<AuthenticationHandler> authenticationHandlers)
    • getExtraAuthenticationHandlers

      public List<AuthenticationHandler> 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

      public void setExtraAuthenticationHandlers(List<AuthenticationHandler> extraAuthenticationHandlers)
    • getNonces

      public Map<UUID,Nonce> getNonces()
      Map holding nonce values issued in Digest authentication challenges
      Returns:
    • setNonces

      public void setNonces(Map<UUID,Nonce> nonces)
    • getMainResourceFactory

      public ResourceFactory 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

      public void setMainResourceFactory(ResourceFactory mainResourceFactory)
    • getOuterResourceFactory

      public ResourceFactory getOuterResourceFactory()
      Usually set by milton, this will enhance the main resource factory with additional resources, such as .well-known support
      Returns:
    • setOuterResourceFactory

      public void setOuterResourceFactory(ResourceFactory outerResourceFactory)
    • getNonceValiditySeconds

      public int getNonceValiditySeconds()
    • setNonceValiditySeconds

      public void setNonceValiditySeconds(int nonceValiditySeconds)
    • getNonceProvider

      public NonceProvider getNonceProvider()
    • setNonceProvider

      public void setNonceProvider(NonceProvider nonceProvider)
    • getAuthenticationService

      public AuthenticationService getAuthenticationService()
    • setAuthenticationService

      public void setAuthenticationService(AuthenticationService authenticationService)
    • getExpiredNonceRemover

      public ExpiredNonceRemover getExpiredNonceRemover()
    • setExpiredNonceRemover

      public void setExpiredNonceRemover(ExpiredNonceRemover expiredNonceRemover)
    • getShutdownHandlers

      public List<Stoppable> getShutdownHandlers()
    • setShutdownHandlers

      public void setShutdownHandlers(List<Stoppable> shutdownHandlers)
    • getResourceTypeHelper

      public ResourceTypeHelper getResourceTypeHelper()
    • setResourceTypeHelper

      public void setResourceTypeHelper(ResourceTypeHelper resourceTypeHelper)
    • getWebdavResponseHandler

      public WebDavResponseHandler getWebdavResponseHandler()
    • setWebdavResponseHandler

      public void setWebdavResponseHandler(WebDavResponseHandler webdavResponseHandler)
    • getHandlerHelper

      public HandlerHelper getHandlerHelper()
    • setHandlerHelper

      public void setHandlerHelper(HandlerHelper handlerHelper)
    • getProtocols

      public ArrayList<HttpExtension> getProtocols()
    • setProtocols

      public void setProtocols(ArrayList<HttpExtension> protocols)
    • getProtocolHandlers

      public ProtocolHandlers getProtocolHandlers()
    • setProtocolHandlers

      public void setProtocolHandlers(ProtocolHandlers protocolHandlers)
    • getEntityTransport

      public EntityTransport getEntityTransport()
    • setEntityTransport

      public void setEntityTransport(EntityTransport entityTransport)
    • getEventManager

      public EventManager getEventManager()
    • setEventManager

      public void setEventManager(EventManager eventManager)
    • getPropertyAuthoriser

      public PropertyAuthoriser getPropertyAuthoriser()
    • setPropertyAuthoriser

      public void setPropertyAuthoriser(PropertyAuthoriser propertyAuthoriser)
    • getPropertySources

      public List<PropertySource> getPropertySources()
    • setPropertySources

      public void setPropertySources(List<PropertySource> propertySources)
    • geteTagGenerator

      public ETagGenerator geteTagGenerator()
    • seteTagGenerator

      public void seteTagGenerator(ETagGenerator eTagGenerator)
    • getHttp11ResponseHandler

      public Http11ResponseHandler getHttp11ResponseHandler()
    • setHttp11ResponseHandler

      public void setHttp11ResponseHandler(Http11ResponseHandler http11ResponseHandler)
    • getValueWriters

      public ValueWriters getValueWriters()
    • setValueWriters

      public void setValueWriters(ValueWriters valueWriters)
    • getPropFindXmlGenerator

      public PropFindXmlGenerator getPropFindXmlGenerator()
    • setPropFindXmlGenerator

      public void setPropFindXmlGenerator(PropFindXmlGenerator propFindXmlGenerator)
    • getFilters

      public List<Filter> getFilters()
    • setFilters

      public void setFilters(List<Filter> filters)
    • getDefaultStandardFilter

      public Filter getDefaultStandardFilter()
    • setDefaultStandardFilter

      public void setDefaultStandardFilter(Filter defaultStandardFilter)
    • getUrlAdapter

      public UrlAdapter getUrlAdapter()
    • setUrlAdapter

      public void setUrlAdapter(UrlAdapter urlAdapter)
    • getQuotaDataAccessor

      public QuotaDataAccessor getQuotaDataAccessor()
    • setQuotaDataAccessor

      public void setQuotaDataAccessor(QuotaDataAccessor quotaDataAccessor)
    • getPropPatchSetter

      public PropPatchSetter getPropPatchSetter()
    • setPropPatchSetter

      public void setPropPatchSetter(PropPatchSetter propPatchSetter)
    • 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

      public List<PropertySource> getExtraPropertySources()
    • setExtraPropertySources

      public void setExtraPropertySources(List<PropertySource> extraPropertySources)
    • showLog

      protected void showLog(String propertyName, Object defaultedTo)
      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

      public BasicAuthHandler getBasicHandler()
    • setBasicHandler

      public void setBasicHandler(BasicAuthHandler basicHandler)
    • getoAuth2Handler

      public OAuth2AuthenticationHandler getoAuth2Handler()
    • setoAuth2Handler

      public void setoAuth2Handler(OAuth2AuthenticationHandler oAuth2Handler)
    • getCookieAuthenticationHandler

      public CookieAuthenticationHandler getCookieAuthenticationHandler()
    • setCookieAuthenticationHandler

      public void setCookieAuthenticationHandler(CookieAuthenticationHandler cookieAuthenticationHandler)
    • getCookieDelegateHandlers

      public List<AuthenticationHandler> getCookieDelegateHandlers()
    • setCookieDelegateHandlers

      public void setCookieDelegateHandlers(List<AuthenticationHandler> cookieDelegateHandlers)
    • getDigestHandler

      public DigestAuthenticationHandler getDigestHandler()
    • setDigestHandler

      public void setDigestHandler(DigestAuthenticationHandler digestHandler)
    • getOAuth2Handler

      public OAuth2AuthenticationHandler getOAuth2Handler()
    • setOAuth2Handler

      public void setOAuth2Handler(OAuth2AuthenticationHandler oAuth2Handler)
    • isEnableOAuth2

      public boolean isEnableOAuth2()
    • setEnableOAuth2

      public void setEnableOAuth2(boolean enableOAuth2)
    • getFormAuthenticationHandler

      public FormAuthenticationHandler getFormAuthenticationHandler()
    • setFormAuthenticationHandler

      public void setFormAuthenticationHandler(FormAuthenticationHandler formAuthenticationHandler)
    • getLoginPage

      public String getLoginPage()
    • setLoginPage

      public void setLoginPage(String loginPage)
    • getLoginPageExcludePaths

      public List<String> getLoginPageExcludePaths()
    • setLoginPageExcludePaths

      public void setLoginPageExcludePaths(List<String> loginPageExcludePaths)
    • getResourceHandlerHelper

      public ResourceHandlerHelper getResourceHandlerHelper()
    • setResourceHandlerHelper

      public void setResourceHandlerHelper(ResourceHandlerHelper resourceHandlerHelper)
    • getRootDir

      public File getRootDir()
      used by FileSystemResourceFactory when its created as default resource factory
      Returns:
    • setRootDir

      public void setRootDir(File rootDir)
    • getSecurityManager

      public SecurityManager 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

      public void setSecurityManager(SecurityManager securityManager)
    • getFsContextPath

      public String getFsContextPath()
      Passed to FilesystemResourceFactory when its created
      Returns:
    • setFsContextPath

      public void setFsContextPath(String fsContextPath)
    • getContextPath

      public String getContextPath()
      Used to set context path on certain implementations of ResourceFactory Alias for fsContentPath
      Returns:
    • setContextPath

      public void setContextPath(String contextPath)
    • getUserAgentHelper

      public UserAgentHelper getUserAgentHelper()
    • setUserAgentHelper

      public void setUserAgentHelper(UserAgentHelper userAgentHelper)
    • getDefaultPassword

      public String getDefaultPassword()
    • setDefaultPassword

      public void setDefaultPassword(String defaultPassword)
    • getDefaultUser

      public String getDefaultUser()
    • setDefaultUser

      public void setDefaultUser(String defaultUser)
    • getFsRealm

      public String getFsRealm()
    • setFsRealm

      public void setFsRealm(String fsRealm)
    • getMapOfNameAndPasswords

      public Map<String,String> getMapOfNameAndPasswords()
    • setMapOfNameAndPasswords

      public void setMapOfNameAndPasswords(Map<String,String> mapOfNameAndPasswords)
    • getMultiNamespaceCustomPropertySource

      public MultiNamespaceCustomPropertySource getMultiNamespaceCustomPropertySource()
    • setMultiNamespaceCustomPropertySource

      public void setMultiNamespaceCustomPropertySource(MultiNamespaceCustomPropertySource multiNamespaceCustomPropertySource)
    • getBeanPropertySource

      public BeanPropertySource getBeanPropertySource()
    • setBeanPropertySource

      public void setBeanPropertySource(BeanPropertySource beanPropertySource)
    • 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

      public WebDavProtocol getWebDavProtocol()
    • setWebDavProtocol

      public void setWebDavProtocol(WebDavProtocol webDavProtocol)
    • isWebdavEnabled

      public boolean isWebdavEnabled()
    • setWebdavEnabled

      public void setWebdavEnabled(boolean webdavEnabled)
    • getMatchHelper

      public MatchHelper getMatchHelper()
    • setMatchHelper

      public void setMatchHelper(MatchHelper matchHelper)
    • getPartialGetHelper

      public PartialGetHelper getPartialGetHelper()
    • setPartialGetHelper

      public void setPartialGetHelper(PartialGetHelper partialGetHelper)
    • isMultiNamespaceCustomPropertySourceEnabled

      public boolean isMultiNamespaceCustomPropertySourceEnabled()
    • setMultiNamespaceCustomPropertySourceEnabled

      public void setMultiNamespaceCustomPropertySourceEnabled(boolean multiNamespaceCustomPropertySourceEnabled)
    • getLoginPageTypeHandler

      public LoginResponseHandler.LoginPageTypeHandler getLoginPageTypeHandler()
    • setLoginPageTypeHandler

      public void setLoginPageTypeHandler(LoginResponseHandler.LoginPageTypeHandler loginPageTypeHandler)
    • getLoginResponseHandler

      public LoginResponseHandler getLoginResponseHandler()
    • setLoginResponseHandler

      public void setLoginResponseHandler(LoginResponseHandler loginResponseHandler)
    • getListeners

      public List<InitListener> getListeners()
    • setListeners

      public void setListeners(List<InitListener> listeners)
    • getFileContentService

      public FileContentService getFileContentService()
    • setFileContentService

      public void setFileContentService(FileContentService fileContentService)
    • getCacheControlHelper

      public CacheControlHelper getCacheControlHelper()
    • setCacheControlHelper

      public void setCacheControlHelper(CacheControlHelper cacheControlHelper)
    • getContentGenerator

      public ContentGenerator getContentGenerator()
    • setContentGenerator

      public void setContentGenerator(ContentGenerator contentGenerator)
    • setEnableExpectContinue

      public void setEnableExpectContinue(boolean enableExpectContinue)
    • isEnableExpectContinue

      public boolean isEnableExpectContinue()
      If true milton will response to Expect: Continue requests. This can cause a problem on some web servers
      Returns:
    • getOuterWebdavResponseHandler

      public WebDavResponseHandler getOuterWebdavResponseHandler()
    • setOuterWebdavResponseHandler

      public void setOuterWebdavResponseHandler(WebDavResponseHandler outerWebdavResponseHandler)
    • getControllerPackagesToScan

      public String 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

      public void setControllerPackagesToScan(String controllerPackagesToScan)
    • getControllerClassNames

      public String 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

      public void setControllerClassNames(String controlleClassNames)
    • getControllers

      public List getControllers()
      Instead of setting controller packages to scan or controller class names, you can set a list of actual controller instances
      Returns:
    • setControllers

      public void setControllers(List controllers)
    • 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

      public Long getMaxAgeSeconds()
      Default max-age to use for certain resource types which can use a default value
      Returns:
    • setMaxAgeSeconds

      public void setMaxAgeSeconds(Long maxAgeSeconds)
    • getDisplayNameFormatter

      public DisplayNameFormatter getDisplayNameFormatter()
    • setDisplayNameFormatter

      public void setDisplayNameFormatter(DisplayNameFormatter displayNameFormatter)
    • getFsHomeDir

      public String 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

      public void setFsHomeDir(String fsHomeDir)
    • getCookieSigningKeys

      public List<String> 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

      public void setCookieSigningKeys(List<String> cookieSigningKeys)
    • setUseLongLivedCookies

      public void setUseLongLivedCookies(boolean useLongLivedCookies)
    • isUseLongLivedCookies

      public boolean isUseLongLivedCookies()
      If true signed cookies for authentication will be long-lived, as defined in CookieAuthenticationHandler.SECONDS_PER_YEAR
      Returns:
    • getCookieSigningKeysFile

      public String 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 validate Only used if cookieSigningKeys is null
      Returns:
    • setCookieSigningKeysFile

      public void setCookieSigningKeysFile(String cookieSigningKeysFile)
    • getPropFindPropertyBuilder

      public PropFindPropertyBuilder getPropFindPropertyBuilder()
    • setPropFindPropertyBuilder

      public void setPropFindPropertyBuilder(PropFindPropertyBuilder propFindPropertyBuilder)
    • getPropFindRequestFieldParser

      public PropFindRequestFieldParser getPropFindRequestFieldParser()
    • setPropFindRequestFieldParser

      public void setPropFindRequestFieldParser(PropFindRequestFieldParser propFindRequestFieldParser)
    • userAgentHelper

      protected UserAgentHelper userAgentHelper()
    • propFindPropertyBuilder

      protected PropFindPropertyBuilder propFindPropertyBuilder()
    • getRootContext

      public RootContext getRootContext()
    • getDependencies

      public List getDependencies()
      Just a list of objects to be made available to auto-created objects via injection
      Returns:
    • setDependencies

      public void setDependencies(List dependencies)
    • isEnableEarlyAuth

      public boolean isEnableEarlyAuth()
    • setEnableEarlyAuth

      public void setEnableEarlyAuth(boolean enableEarlyAuth)
    • getCacheManager

      public CacheManager getCacheManager()
    • setCacheManager

      public void setCacheManager(CacheManager cacheManager)
    • getAuthorisationListener

      public AuthorisationListener getAuthorisationListener()
    • setAuthorisationListener

      public void setAuthorisationListener(AuthorisationListener authorisationListener)