org.kohsuke.stapler
Class WebApp

java.lang.Object
  extended by org.kohsuke.stapler.WebApp

public class WebApp
extends java.lang.Object

Object scoped to the entire webapp. Mostly used for configuring behavior of Stapler.

In contrast, Stapler is a servlet, so there can be multiple instances per webapp.

Author:
Kohsuke Kawaguchi
See Also:
get(ServletContext), getCurrent(), Stapler.getWebApp()

Field Summary
 BoundObjectTable boundObjectTable
          Handles objects that are exported.
 javax.servlet.ServletContext context
          ServletContext for this webapp.
 java.util.Map<java.lang.String,java.lang.String> defaultEncodingForStaticResources
          MIME type -> encoding map that determines how static contents in the war file is served.
 java.util.List<Facet> facets
          Activated facets.
 java.util.Map<java.lang.String,java.lang.String> mimeTypes
          MIME type mapping from extensions (like "txt" or "jpg") to MIME types ("foo/bar").
 java.util.Map<java.lang.Class,java.lang.Class[]> wrappers
          Duck-type wrappers for the given class.
 
Constructor Summary
WebApp(javax.servlet.ServletContext context)
           
 
Method Summary
 void clearScripts(java.lang.Class<? extends AbstractTearOff> clazz)
          Convenience maintenance method to clear all the cached scripts for the given tearoff type.
static WebApp get(javax.servlet.ServletContext context)
          Obtains the WebApp associated with the given ServletContext.
 java.lang.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 '/'.
 java.lang.ClassLoader getClassLoader()
           
 CrumbIssuer getCrumbIssuer()
           
static WebApp getCurrent()
          Gets the current WebApp that the calling thread is associated with.
<T extends Facet>
T
getFacet(java.lang.Class<T> type)
          If the facet of the given type exists, return it.
 MetaClass getMetaClass(java.lang.Class c)
           
 java.util.concurrent.CopyOnWriteArrayList<HttpResponseRenderer> getResponseRenderers()
           
 void setApp(java.lang.Object app)
           
 void setClassLoader(java.lang.ClassLoader classLoader)
          Sets the classloader used by StaplerRequest.bindJSON(Class, JSONObject) and its sibling methods.
 void setCrumbIssuer(CrumbIssuer crumbIssuer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

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


wrappers

public final java.util.Map<java.lang.Class,java.lang.Class[]> wrappers
Duck-type wrappers for the given class.


defaultEncodingForStaticResources

public final java.util.Map<java.lang.String,java.lang.String> defaultEncodingForStaticResources
MIME type -> encoding map that determines how static contents in the war file is served.


facets

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


mimeTypes

public final java.util.Map<java.lang.String,java.lang.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 java.lang.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(java.lang.Object app)

getCrumbIssuer

public CrumbIssuer getCrumbIssuer()

setCrumbIssuer

public void setCrumbIssuer(CrumbIssuer crumbIssuer)

getResponseRenderers

public java.util.concurrent.CopyOnWriteArrayList<HttpResponseRenderer> getResponseRenderers()

getClassLoader

public java.lang.ClassLoader getClassLoader()

getFacet

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


setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Sets the classloader used by StaplerRequest.bindJSON(Class, JSONObject) and its sibling methods.


getMetaClass

public MetaClass getMetaClass(java.lang.Class c)

clearScripts

public void clearScripts(java.lang.Class<? extends AbstractTearOff> clazz)
Convenience maintenance method to clear all the cached scripts for the given tearoff type.

This is useful when you want to have the scripts reloaded into the live system without the performance penalty of MetaClass.NO_CACHE.

See Also:
MetaClass.NO_CACHE

getCurrent

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



Copyright © 2011. All Rights Reserved.