public class Stapler
extends javax.servlet.http.HttpServlet
This servlet should be used as the default servlet.
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.beanutils.ConvertUtilsBean |
CONVERT_UTILS
This is the
Converter registry that Stapler uses, primarily
for form-to-JSON binding in StaplerRequest.bindJSON(Class, JSONObject)
and its family of methods. |
Constructor and Description |
---|
Stapler() |
Modifier and Type | Method and Description |
---|---|
void |
buildResourcePaths()
Rebuild the internal cache for static resources.
|
static String |
escape(String v)
Escapes HTML/XML unsafe characters for the PCDATA section.
|
void |
forward(javax.servlet.RequestDispatcher dispatcher,
StaplerRequest req,
javax.servlet.http.HttpServletResponse rsp) |
ClassLoader |
getClassLoader()
Deprecated.
|
static ClassLoader |
getClassLoader(javax.servlet.ServletContext context)
Deprecated.
|
static Stapler |
getCurrent()
Gets the current
Stapler that the calling thread is associated with. |
static StaplerRequest |
getCurrentRequest()
Gets the current
StaplerRequest that the calling thread is associated with. |
static StaplerResponse |
getCurrentResponse()
Gets the current
StaplerResponse that the calling thread is associated with. |
static String |
getViewURL(Class clazz,
String jspName)
Gets the URL (e.g., "/WEB-INF/side-files/fully/qualified/class/name/jspName")
from a class and the JSP name.
|
WebApp |
getWebApp() |
static Object |
htmlSafeArgument(Object o)
For XSS prevention, escape unsafe characters in String by default,
unless it's specifically wrapped in
RawHtmlArgument . |
static Object[] |
htmlSafeArguments(Object[] args) |
void |
init(javax.servlet.ServletConfig servletConfig) |
void |
invoke(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse rsp,
Object root,
String url)
Performs stapler processing on the given root object and request URL.
|
static boolean |
isSocketException(Throwable x)
Used to detect exceptions thrown when writing content that seem to be due merely to a closed socket.
|
static org.apache.commons.beanutils.Converter |
lookupConverter(Class type) |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse rsp) |
static void |
setClassLoader(javax.servlet.ServletContext context,
ClassLoader classLoader)
Deprecated.
|
static void |
setRoot(javax.servlet.ServletContextEvent event,
Object rootApp)
Sets the specified object as the root of the web application.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final org.apache.commons.beanutils.ConvertUtilsBean CONVERT_UTILS
Converter
registry that Stapler uses, primarily
for form-to-JSON binding in StaplerRequest.bindJSON(Class, JSONObject)
and its family of methods.public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public void buildResourcePaths()
public WebApp getWebApp()
protected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws javax.servlet.ServletException, IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void invoke(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp, Object root, String url) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public static boolean isSocketException(Throwable x)
x
- an exception that got caughtpublic void forward(javax.servlet.RequestDispatcher dispatcher, StaplerRequest req, javax.servlet.http.HttpServletResponse rsp) throws javax.servlet.ServletException, IOException
javax.servlet.ServletException
IOException
public static String getViewURL(Class clazz, String jspName)
public static void setRoot(javax.servlet.ServletContextEvent event, Object rootApp)
This method should be invoked from your implementation of
ServletContextListener.contextInitialized(ServletContextEvent)
.
This is just a convenience method to invoke
servletContext.setAttribute("app",rootApp)
.
The root object is bound to the URL '/' and used to resolve all the requests to this web application.
public static void setClassLoader(javax.servlet.ServletContext context, ClassLoader classLoader)
WebApp.setClassLoader(ClassLoader)
StaplerRequest.bindJSON(Class, JSONObject)
and its sibling methods.public static ClassLoader getClassLoader(javax.servlet.ServletContext context)
WebApp.getClassLoader()
public ClassLoader getClassLoader()
WebApp.getClassLoader()
public static StaplerRequest getCurrentRequest()
StaplerRequest
that the calling thread is associated with.public static StaplerResponse getCurrentResponse()
StaplerResponse
that the calling thread is associated with.public static Stapler getCurrent()
Stapler
that the calling thread is associated with.public static org.apache.commons.beanutils.Converter lookupConverter(Class type)
public static String escape(String v)
public static Object htmlSafeArgument(Object o)
RawHtmlArgument
.Copyright © 2017. All rights reserved.