|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StaplerRequest
Defines additional parameters/operations made available by Stapler.
Stapler.getCurrentRequest()
Field Summary |
---|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Method Summary | ||
---|---|---|
|
bindParameters(java.lang.Class<T> type,
java.lang.String prefix)
Instanciates a new object by injecting constructor parameters from the form parameters. |
|
|
bindParameters(java.lang.Class<T> type,
java.lang.String prefix,
int index)
Works like bindParameters(Class, String) but uses n-th value
of all the parameters. |
|
void |
bindParameters(java.lang.Object bean)
Binds form parameters to a bean by using introspection. |
|
void |
bindParameters(java.lang.Object bean,
java.lang.String prefix)
Binds form parameters to a bean by using introspection. |
|
|
bindParametersToList(java.lang.Class<T> type,
java.lang.String prefix)
Binds collection form parameters to beans by using introspection or constructor parameters injection. |
|
boolean |
checkIfModified(java.util.Calendar timestampOfResource,
StaplerResponse rsp)
|
|
boolean |
checkIfModified(java.util.Date timestampOfResource,
StaplerResponse rsp)
|
|
boolean |
checkIfModified(long timestampOfResource,
StaplerResponse rsp)
Checks "If-Modified-Since" header and returns false if the resource needs to be served. |
|
boolean |
checkIfModified(long timestampOfResource,
StaplerResponse rsp,
long expiration)
|
|
java.util.List<Ancestor> |
getAncestors()
Returns a list of ancestor objects that lead to the "it" object. |
|
java.lang.String |
getOriginalRequestURI()
Gets the request URI
of the original request, so that you can access the value even from
JSP. |
|
java.lang.String |
getReferer()
Gets the referer header (like "http://foobar.com/zot") or null. |
|
java.lang.String |
getRestOfPath()
Returns the additional URL portion that wasn't used by the stapler, excluding the query string. |
|
java.lang.String |
getRootPath()
Gets the part of the request URL from protocol up to the context path. |
|
javax.servlet.ServletContext |
getServletContext()
Returns the ServletContext object given to the stapler
dispatcher servlet. |
|
javax.servlet.RequestDispatcher |
getView(java.lang.Object it,
java.lang.String viewName)
Gets the RequestDispatcher that represents a specific view
for the given object. |
Methods inherited from interface javax.servlet.http.HttpServletRequest |
---|
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole |
Methods inherited from interface javax.servlet.ServletRequest |
---|
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding |
Method Detail |
---|
java.lang.String getRestOfPath()
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".
javax.servlet.ServletContext getServletContext()
ServletContext
object given to the stapler
dispatcher servlet.
javax.servlet.RequestDispatcher getView(java.lang.Object it, java.lang.String viewName) throws java.io.IOException
RequestDispatcher
that represents a specific view
for the given object.
This support both JSP and Jelly.
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.
java.io.IOException
java.lang.String getRootPath()
java.lang.String getReferer()
java.util.List<Ancestor> getAncestors()
Ancestor
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:
Ancestor
s. Can be empty, but always non-null.java.lang.String getOriginalRequestURI()
request URI
of the original request, so that you can access the value even from
JSP.
boolean checkIfModified(long timestampOfResource, StaplerResponse rsp)
This method can behave in three ways.
HttpServletResponse.SC_NOT_MODIFIED
as the response code
and returns true.
This method sends out the "Expires" header to force browser to re-validate all the time.
timestampOfResource
- The time stamp of the resource.rsp
- This object is updated accordingly to simplify processing.
HttpServletResponse.SC_NOT_MODIFIED
.boolean checkIfModified(java.util.Date timestampOfResource, StaplerResponse rsp)
checkIfModified(long, StaplerResponse)
boolean checkIfModified(java.util.Calendar timestampOfResource, StaplerResponse rsp)
checkIfModified(long, StaplerResponse)
boolean checkIfModified(long timestampOfResource, StaplerResponse rsp, long expiration)
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.checkIfModified(long, StaplerResponse)
void bindParameters(java.lang.Object bean)
Values are converted into the right type. See ConvertUtils.convert(String, Class)
.
bean
- The object which will be filled out.BeanUtils.setProperty(Object, String, Object)
void bindParameters(java.lang.Object bean, java.lang.String prefix)
bindParameters(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 invoke bean.setBar("zot").
<T> java.util.List<T> bindParametersToList(java.lang.Class<T> type, java.lang.String prefix)
This method works like bindParameters(Object,String)
and
bindParameters(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"} and getParameterValues("bar")=={"5","3"}, then this method will return two objects (the first with "abc" and "5", the second with "def" and "3".)
type
- Type of the bean to be created. This class must have the default no-arg
constructor.prefix
- See bindParameters(Object, String)
for details.
<T> T bindParameters(java.lang.Class<T> type, java.lang.String prefix)
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
as new Foo(getParameter("foo.a"),getParameter("foo.b"))
.
<T> T bindParameters(java.lang.Class<T> type, java.lang.String prefix, int index)
bindParameters(Class, String)
but uses n-th value
of all the parameters.
This is useful for creating multiple instances from repeated form fields.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |