Interface StaplerRequest
- All Superinterfaces:
javax.servlet.http.HttpServletRequest
,javax.servlet.ServletRequest
- All Known Implementing Classes:
StaplerRequest.StaplerRequestWrapperImpl
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
Deprecated.Return value ofcreateJavaScriptProxyParameters(Object)
static interface
Deprecated.static class
Deprecated.static interface
Deprecated.static class
Deprecated. -
Field Summary
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
-
Method Summary
Modifier and TypeMethodDescription<T> T
Deprecated.Data-bind from aJSONObject
to the given target type, by using introspection or constructor parameters injection.void
Deprecated.Data-binds fromJSONObject
to the given object.<T> T
Deprecated.<T> List<T>
bindJSONToList
(Class<T> type, Object src) Deprecated.Data-bind from eitherJSONObject
orJSONArray
to a list, by usingbindJSON(Class, JSONObject)
as the lower-level mechanism.<T> T
bindParameters
(Class<T> type, String prefix) Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.<T> T
bindParameters
(Class<T> type, String prefix, int index) Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.void
bindParameters
(Object bean) Deprecated.Binds form parameters to a bean by using introspection.void
bindParameters
(Object bean, String prefix) Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.<T> List<T>
bindParametersToList
(Class<T> type, String prefix) Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.boolean
checkIfModified
(long timestampOfResource, StaplerResponse rsp) Deprecated.Checks "If-Modified-Since" header and returns false if the resource needs to be served.boolean
checkIfModified
(long timestampOfResource, StaplerResponse rsp, long expiration) Deprecated.boolean
checkIfModified
(Calendar timestampOfResource, StaplerResponse rsp) Deprecated.boolean
checkIfModified
(Date timestampOfResource, StaplerResponse rsp) Deprecated.createJavaScriptProxy
(Object toBeExported) Deprecated.UsecreateJavaScriptProxyParameters(Object)
and invokemakeStaplerProxy
yourself.createJavaScriptProxyParameters
(Object toBeExported) Deprecated.Exports the given Java object as a JavaScript proxy and returns the parameters needed to callmakeStaplerProxy
.findAncestor
(Class type) Deprecated.Finds the nearest ancestor that has the object of the given type, or null if not found.Deprecated.Finds the nearest ancestor whoseAncestor.getObject()
matches the given object.<T> T
findAncestorObject
(Class<T> type) Deprecated.Short forfindAncestor(type).getObject()
, with proper handling for null de-reference.static StaplerRequest
Deprecated.Deprecated.Returns a list of ancestor objects that lead to the "it" object.Deprecated.Gets theBindInterceptor
set for this request.Deprecated.Short cut for obtainingBoundObjectTable
associated with this webapp.getFileItem
(String name) Deprecated.org.apache.commons.fileupload2.core.FileItem
getFileItem2
(String name) Deprecated.Obtains a commons-fileupload2 object that represents an uploaded file.Deprecated.Gets therequest URI
of the original request, so that you can access the value even from JSP.Deprecated.Returns the same thing asgetRestOfPath()
but in the pre-decoded form, so all "%HH"s as present in the request URL is intact.Deprecated.Gets the referer header (like "http://foobar.com/zot") or null.Deprecated.HttpServletRequest.getRequestURI()
plus additional query string part, if it exists.Deprecated.HttpServletRequest.getRequestURL()
plus additional query string part, if it exists.Deprecated.Returns the additional URL portion that wasn't used by the stapler, excluding the query string.Deprecated.Gets the part of the request URL from protocol up to the context path.javax.servlet.ServletContext
Deprecated.Returns theServletContext
object given to the stapler dispatcher servlet.Deprecated.Gets theStapler
instance that this belongs to.net.sf.json.JSONObject
Deprecated.Gets the content of the structured form submission.javax.servlet.RequestDispatcher
Deprecated.Convenience method to callgetView(Klass, String)
withClass
.javax.servlet.RequestDispatcher
Deprecated.Gets theRequestDispatcher
that represents a specific view for the given object.javax.servlet.RequestDispatcher
Deprecated.Gets theRequestDispatcher
that represents a specific view for the given class.Deprecated.Short forgetStapler().getWebApp()
boolean
hasParameter
(String name) Deprecated.Short forgetParameter(name)!=null
boolean
Deprecated.Returns true if this request represents a server method call to a JavaScript proxy object.setBindInterceptor
(BindInterceptor bindListener) Deprecated.setBindInterceptpr
(BindInterceptor bindListener) Deprecated.Typo.setBindListener
(BindInterceptor bindListener) Deprecated.Typo.static StaplerRequest2
Deprecated.Methods inherited from interface javax.servlet.http.HttpServletRequest
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
Methods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Method Details
-
getStapler
Stapler getStapler()Deprecated.Gets theStapler
instance that this belongs to. -
getWebApp
WebApp getWebApp()Deprecated.Short forgetStapler().getWebApp()
-
getRestOfPath
String getRestOfPath()Deprecated.Returns the additional URL portion that wasn't used by the stapler, excluding the query string.For example, if the requested URL is "foo/bar/zot/abc?def=ghi" and "foo/bar" portion matched
bar.jsp
, this method returns "/zot/abc".If this method is invoked from getters or
StaplerProxy.getTarget()
during the object traversal, this method returns the path portion that is not yet processed.- Returns:
- can be empty string, but never null.
-
getOriginalRestOfPath
String getOriginalRestOfPath()Deprecated.Returns the same thing asgetRestOfPath()
but in the pre-decoded form, so all "%HH"s as present in the request URL is intact. -
getServletContext
javax.servlet.ServletContext getServletContext()Deprecated.Returns theServletContext
object given to the stapler dispatcher servlet.- Specified by:
getServletContext
in interfacejavax.servlet.ServletRequest
-
getRequestURIWithQueryString
String getRequestURIWithQueryString()Deprecated.HttpServletRequest.getRequestURI()
plus additional query string part, if it exists. -
getRequestURLWithQueryString
StringBuffer getRequestURLWithQueryString()Deprecated.HttpServletRequest.getRequestURL()
plus additional query string part, if it exists. -
getView
Deprecated.Gets theRequestDispatcher
that represents a specific view for the given object. This support both JSP and Jelly.- Parameters:
viewName
- If this name is relative name like "foo.jsp" or "bar/zot.jelly", then the corresponding "side file" is searched by this name.For Jelly, this also accepts absolute path name that starts with '/', such as "/foo/bar/zot.jelly". In this case,
it.getClass().getClassLoader()
is searched for this script.- Returns:
- null if neither JSP nor Jelly is not found by the given name.
- Throws:
IOException
-
getView
Deprecated.Convenience method to callgetView(Klass, String)
withClass
.- Throws:
IOException
-
getView
Deprecated.Gets theRequestDispatcher
that represents a specific view for the given class.Unlike
getView(Object, String)
, calling this request dispatcher doesn't set the "it" variable, sogetView(it.getClass(),viewName)
andgetView(it,viewName)
aren't the same thing.- Throws:
IOException
-
getRootPath
String getRootPath()Deprecated.Gets the part of the request URL from protocol up to the context path. So typically it's something likehttp://foobar:8080/something
-
getReferer
String getReferer()Deprecated.Gets the referer header (like "http://foobar.com/zot") or null. This is just a convenience method. -
getAncestors
Deprecated.Returns a list of ancestor objects that lead to the "it" object. The returned list containsAncestor
objects sorted in the order from root to the "it" object.For example, if the URL was "foo/bar/zot" and the "it" object was determined as
root.getFoo().getBar("zot")
, then this list will contain the following 3 objects in this order:- the root object
- root.getFoo() object
- root.getFoo().getBar("zot") object (the "it" object)
- Returns:
- list of
Ancestor
s. Can be empty, but always non-null.
-
findAncestor
Deprecated.Finds the nearest ancestor that has the object of the given type, or null if not found. -
findAncestorObject
Deprecated.Short forfindAncestor(type).getObject()
, with proper handling for null de-reference. This version is also type safe. -
findAncestor
Deprecated.Finds the nearest ancestor whoseAncestor.getObject()
matches the given object. -
hasParameter
Deprecated.Short forgetParameter(name)!=null
-
getOriginalRequestURI
String getOriginalRequestURI()Deprecated.Gets therequest URI
of the original request, so that you can access the value even from JSP. -
checkIfModified
Deprecated.Checks "If-Modified-Since" header and returns false if the resource needs to be served.This method can behave in three ways.
- If
timestampOfResource
is 0 or negative, this method just returns false. - If "If-Modified-Since" header is sent and if it's bigger than
timestampOfResource
, then this method setsHttpServletResponse.SC_NOT_MODIFIED
as the response code and returns true. - Otherwise, "Last-Modified" header is added with
timestampOfResource
value, and this method returns false.
This method sends out the "Expires" header to force browser to re-validate all the time.
- Parameters:
timestampOfResource
- The time stamp of the resource.rsp
- This object is updated accordingly to simplify processing.- Returns:
- false to indicate that the caller has to serve the actual resource.
true to indicate that the caller should just quit processing right there
(and send back
HttpServletResponse.SC_NOT_MODIFIED
.
- If
-
checkIfModified
Deprecated.- See Also:
-
checkIfModified
Deprecated.- See Also:
-
checkIfModified
Deprecated.- Parameters:
expiration
- The number of milliseconds until the resource will "expire". Until it expires the browser will be allowed to cache it and serve it without checking back with the server. After it expires, the client will send conditional GET to check if the resource is actually modified or not. If 0, it will immediately expire.- See Also:
-
bindParameters
Deprecated.Binds form parameters to a bean by using introspection. For example, if there's a parameter called 'foo' that has value 'abc', thenbean.setFoo('abc')
will be invoked. This will be repeated for all parameters. Parameters that do not have corresponding setters will be simply ignored.Values are converted into the right type. See
ConvertUtils.convert(String, Class)
.- Parameters:
bean
- The object which will be filled out.- See Also:
-
BeanUtils.setProperty(Object, String, Object)
-
bindParameters
Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.Binds form parameters to a bean by using introspection. This method works likebindParameters(Object)
, but it performs a pre-processing on property names. Namely, only property names that start with the given prefix will be used for binding, and only the portion of the property name after the prefix is used. So for example, if the prefix is "foo.", then property name "foo.bar" with value "zot" will invokebean.setBar("zot")
. -
bindParametersToList
Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.Binds collection form parameters to beans by using introspection or constructor parameters injection.This method works like
bindParameters(Object,String)
andbindParameters(Class, String)
, but it assumes that form parameters have multiple-values, and use individual values to fill in multiple beans.For example, if
getParameterValues("foo")=={"abc","def"}
andgetParameterValues("bar")=={"5","3"}
, then this method will return two objects (the first with "abc" and "5", the second with "def" and "3".)- Parameters:
type
- Type of the bean to be created. This class must have the default no-arg constructor.prefix
- SeebindParameters(Object, String)
for details.- Returns:
- Can be empty but never null.
-
bindParameters
Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.Instantiates a new object by injecting constructor parameters from the form parameters.The given class must have a constructor annotated with '@stapler-constructor', and must be processed by the maven-stapler-plugin, so that the parameter names of the constructor is available at runtime.
The prefix is used to control the form parameter name. For example, if the prefix is "foo." and if the constructor is define as
Foo(String a, String b)
, then the constructor will be invoked asnew Foo(getParameter("foo.a"),getParameter("foo.b"))
. -
bindParameters
Deprecated.Instead of using prefix to group object among form parameter names, use structured form submission andbindJSON(Class, JSONObject)
.Works likebindParameters(Class, String)
but uses n-th value of all the parameters.This is useful for creating multiple instances from repeated form fields.
-
bindJSON
Deprecated.Data-bind from aJSONObject
to the given target type, by using introspection or constructor parameters injection.For example, if you have a constructor that looks like the following:
class Foo { @
... and if JSONObject looks likeDataBoundConstructor
public Foo(Integer x, String y, boolean z, Bar bar) { ... } } class Bar { @DataBoundConstructor
public Bar(int x, int y) {} }{ y:"text", z:true, bar:{x:1,y:2}}
then, this method returnsnew Foo(null,"text",true,new Bar(1,2))
Sub-typing: In the above example, a new instance of
Bar
was created, but you can also create a subtype of Bar by having the '$class' property in JSON like this:class BarEx extends Bar { @
DataBoundConstructor
public BarEx(int a, int b, int c) {} } { y:"text", z:true, bar: { $class:"p.k.g.BarEx", a:1, b:2, c:3 } }The type that shows up in the constructor (
Bar
in this case) can be an interface or an abstract class. -
bindJSON
Deprecated.Data-bind from one of the JSON object types (JSONObject
,JSONArray
,String
,Integer
, and so on) to the expected type given as an argument.- Parameters:
genericType
- The generic type of the 'erasure' parameter.erasure
- The expected type to convert the JSON argument to.json
- One of the JSON value type.
-
bindJSON
Deprecated.Data-binds fromJSONObject
to the given object.This method is bit like
bindJSON(Class, JSONObject)
, except that this method populates an existing object, instead of creating a new instance.This method is also bit like
bindParameters(Object, String)
, in that it populates an existing object from a form submission, except that this method obtains data fromJSONObject
thus more structured, whereasbindParameters(Object, String)
uses the map structure of the form submission. -
bindJSONToList
Deprecated.Data-bind from eitherJSONObject
orJSONArray
to a list, by usingbindJSON(Class, JSONObject)
as the lower-level mechanism.If the source is
JSONObject
, the returned list will contain a single item. If it isJSONArray
, each item will be bound. If it is null, then the list will be empty. -
getBindInterceptor
BindInterceptor getBindInterceptor()Deprecated.Gets theBindInterceptor
set for this request.- See Also:
-
setBindListener
Deprecated.Typo. UsesetBindInterceptor(BindInterceptor)
-
setBindInterceptpr
Deprecated.Typo. UsesetBindInterceptor(BindInterceptor)
-
setBindInterceptor
Deprecated. -
getSubmittedForm
net.sf.json.JSONObject getSubmittedForm() throws javax.servlet.ServletExceptionDeprecated.Gets the content of the structured form submission.- Throws:
javax.servlet.ServletException
- See Also:
-
getFileItem2
org.apache.commons.fileupload2.core.FileItem getFileItem2(String name) throws javax.servlet.ServletException, IOException Deprecated.Obtains a commons-fileupload2 object that represents an uploaded file.- Returns:
- null if a file of the given form field name doesn't exist. This includes the case where the name corresponds to a simple form field (like textbox, checkbox, etc.)
- Throws:
javax.servlet.ServletException
IOException
-
getFileItem
Deprecated.Obtains a commons-fileupload object that represents an uploaded file.- Returns:
- null if a file of the given form field name doesn't exist. This includes the case where the name corresponds to a simple form field (like textbox, checkbox, etc.)
- Throws:
javax.servlet.ServletException
IOException
-
isJavaScriptProxyCall
boolean isJavaScriptProxyCall()Deprecated.Returns true if this request represents a server method call to a JavaScript proxy object. -
getBoundObjectTable
BoundObjectTable getBoundObjectTable()Deprecated.Short cut for obtainingBoundObjectTable
associated with this webapp. -
createJavaScriptProxy
Deprecated.UsecreateJavaScriptProxyParameters(Object)
and invokemakeStaplerProxy
yourself.Exports the given Java object as a JavaScript proxy and returns a JavaScript expression to create a proxy on the client side. Short cut forgetBoundObjectTable().bind(toBeExported).getProxyScript()
-
createJavaScriptProxyParameters
Deprecated.Exports the given Java object as a JavaScript proxy and returns the parameters needed to callmakeStaplerProxy
. -
toStaplerRequest2
Deprecated. -
fromStaplerRequest2
Deprecated.
-
StaplerRequest2