public class WebApp extends Object
In contrast, Stapler
is a servlet, so there can be multiple instances per webapp.
get(ServletContext)
,
getCurrent()
,
Stapler.getWebApp()
Modifier and Type | Field and Description |
---|---|
List<BindInterceptor> |
bindInterceptors
Global
BindInterceptor s. |
BoundObjectTable |
boundObjectTable
Handles objects that are exported.
|
javax.servlet.ServletContext |
context
ServletContext for this webapp. |
Map<String,String> |
defaultEncodingForStaticResources
MIME type → encoding map that determines how static contents in the war file is served.
|
List<Facet> |
facets
Activated facets.
|
Map<String,String> |
mimeTypes
MIME type mapping from extensions (like "txt" or "jpg") to MIME types ("foo/bar").
|
Map<Class,Class[]> |
wrappers
Duck-type wrappers for the given class.
|
Constructor and Description |
---|
WebApp(javax.servlet.ServletContext context) |
Modifier and Type | Method and Description |
---|---|
void |
clearScripts(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 . |
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 '/'.
|
ClassLoader |
getClassLoader() |
CrumbIssuer |
getCrumbIssuer() |
static WebApp |
getCurrent()
Gets the current
WebApp that the calling thread is associated with. |
<T extends Facet> |
getFacet(Class<T> type)
If the facet of the given type exists, return it.
|
Klass<?> |
getKlass(Object o) |
MetaClass |
getMetaClass(Class c) |
MetaClass |
getMetaClass(Klass<?> c) |
MetaClass |
getMetaClass(Object o)
Obtains a
MetaClass that represents the type of the given object. |
CopyOnWriteArrayList<HttpResponseRenderer> |
getResponseRenderers() |
Stapler |
getSomeStapler()
Gets a reference to some
Stapler servlet in this webapp. |
void |
setApp(Object app) |
void |
setClassLoader(ClassLoader classLoader)
Sets the classloader used by
StaplerRequest.bindJSON(Class, JSONObject) and its sibling methods. |
void |
setCrumbIssuer(CrumbIssuer crumbIssuer) |
public final javax.servlet.ServletContext context
ServletContext
for this webapp.public final Map<String,String> defaultEncodingForStaticResources
public final List<BindInterceptor> bindInterceptors
BindInterceptor
s.
These are consulted after StaplerRequest.getBindInterceptor()
is consulted.
Global bind interceptors are useful to register webapp-wide conversion logic local to the application.public final Map<String,String> mimeTypes
public final BoundObjectTable boundObjectTable
public static WebApp get(javax.servlet.ServletContext context)
WebApp
associated with the given ServletContext
.public Object getApp()
public void setApp(Object app)
public CrumbIssuer getCrumbIssuer()
public void setCrumbIssuer(CrumbIssuer crumbIssuer)
public CopyOnWriteArrayList<HttpResponseRenderer> getResponseRenderers()
public ClassLoader getClassLoader()
public <T extends Facet> T getFacet(Class<T> type)
public void setClassLoader(ClassLoader classLoader)
StaplerRequest.bindJSON(Class, JSONObject)
and its sibling methods.public MetaClass getMetaClass(Object o)
MetaClass
that represents the type of the given object.
This code consults all facets to handle scripting language objects correctly.
public void clearScripts(Class<? extends AbstractTearOff> clazz)
This is useful when you want to have the scripts reloaded into the live system without
the performance penalty of MetaClass.NO_CACHE
.
MetaClass.NO_CACHE
public Stapler getSomeStapler()
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,
WebApp.get(servletContext).getSomeStapler().invoke( request,response, someJavaObject, "/path/to/dispatch/request");
Copyright © 2015. All rights reserved.