Class WebApp

    • Field Detail

      • context

        public final javax.servlet.ServletContext context
        ServletContext for this webapp.
      • defaultEncodingForStaticResources

        public final Map<String,​String> defaultEncodingForStaticResources
        MIME type → encoding map that determines how static contents in the war file is served.
      • facets

        public final List<Facet> facets
        Activated facets. TODO: is this really mutable?
      • mimeTypes

        public final Map<String,​String> mimeTypes
        MIME type mapping from extensions (like "txt" or "jpg") to MIME types ("foo/bar"). This overrides whatever mappings given in the servlet as far as stapler is concerned. This is case insensitive, and should be normalized to lower case.
      • boundObjectTable

        public final BoundObjectTable boundObjectTable
        Handles objects that are exported.
    • Constructor Detail

      • WebApp

        public WebApp​(javax.servlet.ServletContext context)
    • Method Detail

      • get

        public static WebApp get​(javax.servlet.ServletContext context)
        Obtains the WebApp associated with the given ServletContext.
      • getApp

        public Object getApp()
        Returns the 'app' object, which is the user-specified object that sits at the root of the URL hierarchy and handles the request to '/'.
      • setApp

        public void setApp​(Object app)
      • setCrumbIssuer

        public void setCrumbIssuer​(CrumbIssuer crumbIssuer)
      • getFacet

        public <T extends Facet> T getFacet​(Class<T> type)
        If the facet of the given type exists, return it. Otherwise null.
      • getMetaClass

        public MetaClass getMetaClass​(Object o)
        Obtains a MetaClass that represents the type of the given object.

        This code consults all facets to handle scripting language objects correctly.

      • clearMetaClassCache

        public void clearMetaClassCache()
        Convenience maintenance method to clear all the cached information. It will force the MetaClass to be rebuilt.

        Take care that the generation of MetaClass information takes a bit of time and so this call should not be called too often

      • getSomeStapler

        public Stapler getSomeStapler()
        Gets a reference to some Stapler servlet in this webapp.

        Most Stapler webapps will have one <servlet> entry in web.xml and if that's the case, that'd be returned. In a fully general case, a webapp can have multiple servlets and more than one of them can be Stapler. This method returns one of those. Which one gets returned is unspecified.

        This method is useful if you are in a Filter and using Stapler to handle the current request. For example,

      • getCurrent

        public static WebApp getCurrent()
        Gets the current WebApp that the calling thread is associated with.
      • setFilterForGetMethods

        public void setFilterForGetMethods​(FunctionList.Filter filterForGetMethods)
        Allow the underlying application to filter the getXxx methods
      • setFilterForDoActions

        public void setFilterForDoActions​(FunctionList.Filter filterForDoActions)
        Allow the underlying application to filter the doXxx actions
      • setFilterForFields

        public void setFilterForFields​(FieldRef.Filter filterForFields)
      • setDispatchersFilter

        public void setDispatchersFilter​(DispatchersFilter dispatchersFilter)
      • setFilteredGetterTriggerListener

        public void setFilteredGetterTriggerListener​(FilteredGetterTriggerListener filteredGetterTriggerListener)
      • setFilteredFieldTriggerListener

        public void setFilteredFieldTriggerListener​(FilteredFieldTriggerListener filteredFieldTriggerListener)
      • setJsonInErrorMessageSanitizer

        public void setJsonInErrorMessageSanitizer​(JsonInErrorMessageSanitizer jsonInErrorMessageSanitizer)
        Allow the application to customize the way the JSON are rendered in the stack trace in case of binding exception.
      • setDispatchValidator

        public void setDispatchValidator​(DispatchValidator dispatchValidator)
        Sets the validator used with facet dispatchers.
      • setFilteredDispatchTriggerListener

        public void setFilteredDispatchTriggerListener​(FilteredDispatchTriggerListener filteredDispatchTriggerListener)
        Sets the event listener used for reacting to filtered dispatch requests.