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

Field Summary
 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
static WebApp get(javax.servlet.ServletContext context)
          Obtains the WebApp associated with the given ServletContext.
 java.lang.ClassLoader getClassLoader()
           
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)
           
 void setClassLoader(java.lang.ClassLoader classLoader)
          Sets the classloader used by StaplerRequest.bindJSON(Class, JSONObject) and its sibling methods.
 
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.

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.


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)

getCurrent

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



Copyright © 2009. All Rights Reserved.