public abstract class HttpRequestWrapper extends Object implements ContentRequest
ServletRequest
instance and provide methods
to access the parameters and attributes in a consistent manner.Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name)
Returns the specified attribute object or
null . |
String |
getBerliozPath()
Returns the dynamic path of the Berlioz request.
|
static String |
getBerliozPath(javax.servlet.http.HttpServletRequest req)
Returns the Berlioz path from an HTTP Servlet request.
|
javax.servlet.http.Cookie[] |
getCookies()
Returns an array containing all of the Cookie objects the client sent with this request.
|
Date |
getDateParameter(String name)
Returns a
Date instance from the specified parameter. |
Environment |
getEnvironment()
Returns the environment of the request.
|
javax.servlet.http.HttpServletRequest |
getHttpRequest()
Returns the wrapped HTTP servlet request.
|
javax.servlet.http.HttpServletResponse |
getHttpResponse()
Returns the attached HTTP servlet response.
|
int |
getIntParameter(String name,
int def)
Returns the specified parameter value.
|
Location |
getLocation()
Returns information about the location of the request.
|
String |
getParameter(String name)
Returns the specified parameter value or
null . |
String |
getParameter(String name,
String def)
Returns the specified parameter value or the specified default if
null . |
Enumeration<String> |
getParameterNames()
Returns an
Enumeration of String objects containing the names of
the parameters contained in this request. |
String[] |
getParameterValues(String name)
Returns an array of String objects containing all of the values the given request parameter
has, or
null if the parameter does not exist. |
String |
getPathInfo()
Returns the path information of this request.
|
javax.servlet.http.HttpSession |
getSession()
Returns the session of the wrapped HTTP servlet request.
|
boolean |
isMultipartContent()
Utility method that determines whether this request contains multipart content.
|
void |
setAttribute(String name,
Object o)
Sets the specified attribute object or
null . |
protected static Map<String,String> |
toParameters(javax.servlet.http.HttpServletRequest req,
URIResolveResult results)
Configure this request wrapper for the specified service match.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setRedirect, setStatus
public final String getBerliozPath()
ContentRequest
The Berlioz path corresponds to:
pathInfo
when the Berlioz Servlet is mapped using a prefix servlet
(for example /html/*
);servletPath
when the Berlioz Servlet is mapped using a suffix servlet
(for example *.html
);Use this method in preference to the ContentRequest.getPathInfo()
which only works if Berlioz is
mapped to prefixes.
getBerliozPath
in interface ContentRequest
public final String getParameter(String name)
ContentRequest
null
.
This method guarantees that the returned value is not equal to an empty string.
getParameter
in interface ContentRequest
name
- The name of the requested parameter.String
or null
.public final String getParameter(String name, String def)
ContentRequest
null
.
This method guarantees that a value is returned.
getParameter
in interface ContentRequest
name
- The name of the requested parameter.def
- A default value if the value is null
or empty string.public final String[] getParameterValues(String name)
ContentRequest
null
if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.
getParameterValues
in interface ContentRequest
name
- A String containing the name of the parameter whose value is requestedpublic final Enumeration<String> getParameterNames()
ContentRequest
Enumeration
of String
objects containing the names of
the parameters contained in this request.
If the request has no parameters, the method returns an empty Enumeration.
getParameterNames
in interface ContentRequest
Enumeration
of the names of each parameters as String
s;
or an empty Enumeration
if the request has no parameters.public final Environment getEnvironment()
ContentRequest
getEnvironment
in interface ContentRequest
public final int getIntParameter(String name, int def)
ContentRequest
This method guarantees that a value is returned.
getIntParameter
in interface ContentRequest
name
- The name of the requested parameter.def
- A default value if the value is null
or empty string.public final Date getDateParameter(String name)
ContentRequest
Date
instance from the specified parameter.
Important note: incompatible change, since Berlioz 0.8, dates are parsed as ISO 8601.
getDateParameter
in interface ContentRequest
name
- The name of the parameter.Date
instance or null
if not specified.public final String getPathInfo()
ContentRequest
getPathInfo
in interface ContentRequest
public final javax.servlet.http.Cookie[] getCookies()
ContentRequest
null
if no cookies were sent.getCookies
in interface ContentRequest
null
if the request has no cookiespublic final Object getAttribute(String name)
ContentRequest
null
.getAttribute
in interface ContentRequest
name
- The name of the attribute.null
.public final void setAttribute(String name, Object o)
ContentRequest
null
.setAttribute
in interface ContentRequest
name
- The name of the attribute.o
- The object for this attribute.public final javax.servlet.http.HttpServletRequest getHttpRequest()
This effectively enables the content generator to bypass the clean and simple methods of the content request, use wisely...
public final javax.servlet.http.HttpServletResponse getHttpResponse()
This effectively enables the content generator to make use of the HTTP servlet response, use wisely...
public final Location getLocation()
ContentRequest
This includes information about the request URI.
getLocation
in interface ContentRequest
public final boolean isMultipartContent()
true
if the request is multipart;
false
otherwise.public final javax.servlet.http.HttpSession getSession()
getSession
in interface ContentRequest
public static String getBerliozPath(javax.servlet.http.HttpServletRequest req)
The Berlioz path corresponds to:
pathInfo
when the Berlioz Servlet is mapped using a prefix servlet
(for example /html/*
);servletPath
when the Berlioz Servlet is mapped using a suffix servlet
(for example *.html
);Use this method in preference to the getPathInfo()
which only works if Berlioz is
mapped to prefixes.
req
- The HTTP servlet request.protected static Map<String,String> toParameters(javax.servlet.http.HttpServletRequest req, URIResolveResult results)
req
- The HTTP servlet request.results
- The results of the URI resolution.Copyright © 2016 Allette Systems. All rights reserved.