|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.moremotion.servlet.MoreMotionRequest
org.moremotion.servlet.MoreMotionServletRequest
public class MoreMotionServletRequest
MoreMotionRequest is the most important class of the MoreMotion Application Framework. It provides methods suitable with the way MoreMotion responds to request. One significant functionality provided by this class is decoding the request parameters correctly.
Request Parameter Decoding
When a request is sent to the server, the parameters existing in the request are encoded by the browsers using an encoding, i.e. ISO-8859-1. When an application server receives a request, it decodes these parameters and prepare a request object to pass to the Servlet.
If the application server does not use the same encoding that the browser used to encode the parameters during the decoding, the request parameters can get corrupted. Unfortunately this is the case for Tomcat. Tomcat always decode the request parameters using ISO-8859-1.
MoreMotion solves this problem with the help of the request parameter "_enc". In order to benefit from this functionality, a hidden input field with name "_enc" must be placed in the form elements and their values must be set to the encoding of the current page.
If you get the value of a request parameter by using the methods provided by this class, i.e. getParameter(), the value will be decoded using the encoding value supplied by this "_enc" parameter.
String name = request.getParameter("name",null);
// The name string will get the decoded "name" parameter.
However, some application servers can nicely guess the case and reads request parameters correctly.
In that case you should disable the parameter conversion by setting the following system parameter to false.
<enableParameterConversion>false</enableParameterConversion>
| Constructor Summary | |
|---|---|
MoreMotionServletRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
|
| Method Summary | |
|---|---|
void |
buildErrorResponse(java.lang.String name)
|
void |
buildingErrorResponse()
|
void |
buildResponse(java.lang.String name)
|
void |
generateDefaultErrorPage()
Generates the default error page. |
void |
generatePage(java.lang.String pageName)
Generates (Displays) the specified page. |
boolean |
generatingErrorPage()
Returns true if currently an error page is being generated |
int |
getAllowCaching()
Returns the allowCaching value. |
java.lang.String |
getApplicationPath()
Returns the Application Path of the current web application. |
java.lang.Object |
getAttribute(java.lang.String str)
|
java.util.Enumeration |
getAttributeNames()
|
java.lang.String |
getAuthType()
|
java.lang.String |
getCharacterEncoding()
|
java.lang.String |
getConfigurationScope()
|
int |
getContentLength()
|
java.lang.String |
getContentType()
|
java.lang.String |
getContextPath()
|
javax.servlet.http.Cookie[] |
getCookies()
|
java.lang.String |
getCookieValue(java.lang.String cookieName)
Returns the value of the specified cookie. |
CurrentPage |
getCurrentPage()
Returns the CurrentPage object associated with this request |
long |
getDateHeader(java.lang.String str)
|
java.lang.String |
getHeader(java.lang.String str)
|
java.util.Enumeration |
getHeaderNames()
|
java.util.Enumeration |
getHeaders(java.lang.String str)
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the original HttpServletRequest object. |
javax.servlet.ServletInputStream |
getInputStream()
|
int |
getIntHeader(java.lang.String str)
|
java.lang.String |
getLanguage()
Returns the current language code |
java.lang.String |
getLocalAddr()
|
java.util.Locale |
getLocale()
|
java.util.Enumeration |
getLocales()
|
java.lang.String |
getLocalName()
|
int |
getLocalPort()
|
java.lang.String |
getMethod()
|
java.lang.String |
getOriginPage()
The name of the origin page that is taken from request parameter "_originpage". |
java.lang.String |
getOriginPage(boolean withVariant)
The name of the origin page that is taken from request parameter "_originpage". |
java.lang.String |
getParameter(java.lang.String parmName)
Returns the value of the specified request parameter. |
java.lang.String |
getParameter(java.lang.String parmName,
java.lang.String defValue)
Returns the value of the specified request parameter. |
java.util.Map |
getParameterMap()
|
java.util.Enumeration |
getParameterNames()
|
java.lang.String[] |
getParameterValues(java.lang.String parmName)
Returns a String array that contains the values of the specified parameter. |
java.lang.String |
getPathInfo()
|
java.lang.String |
getPathTranslated()
|
java.lang.String |
getPlainParameter(java.lang.String parmName)
Returns the value of the specified parameter. |
java.lang.String |
getPlainParameter(java.lang.String parmName,
java.lang.String defValue)
Returns the value of the specified parameter. |
java.lang.String |
getProtocol()
|
java.lang.String |
getQueryString()
|
java.io.BufferedReader |
getReader()
|
java.lang.String |
getRemoteAddr()
|
java.lang.String |
getRemoteHost()
|
int |
getRemotePort()
|
java.lang.String |
getRemoteUser()
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String str)
|
java.lang.String |
getRequestedSessionId()
|
java.lang.String |
getRequestInfo(java.lang.String info)
|
java.lang.String |
getRequestURI()
|
java.lang.StringBuffer |
getRequestURL()
|
javax.servlet.http.HttpServletResponse |
getResponse()
|
java.lang.String |
getScheme()
|
java.lang.String |
getServerName()
|
int |
getServerPort()
|
java.lang.String |
getServletPath()
|
javax.servlet.http.HttpSession |
getSession()
|
javax.servlet.http.HttpSession |
getSession(boolean param)
|
java.lang.String[] |
getSourceAreaNames()
Returns the names of the Ajax source area names |
java.security.Principal |
getUserPrincipal()
|
boolean |
isAjaxRequest()
|
boolean |
isRequestedSessionIdFromCookie()
|
boolean |
isRequestedSessionIdFromUrl()
|
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String str)
|
void |
removeAttribute(java.lang.String str)
|
java.lang.String |
resolve(java.lang.String str)
Resolves the MScript functions existing in the given string and returns it. |
void |
setAjaxRequest(boolean value)
|
void |
setAllowCaching(int value)
|
void |
setAttribute(java.lang.String str,
java.lang.Object obj)
|
void |
setCharacterEncoding(java.lang.String str)
|
void |
setCookieValue(java.lang.String cookieName,
java.lang.String cookieValue,
int maxAge)
Sets a cookie. |
void |
setCurrentPage(CurrentPage value)
Sets the CurrentPage object to let the methods of this class to access all the necessary information about the current page. |
void |
setNoCache()
Sets the necessary response header information for the requesting browser to tell it not to cache the response. |
void |
setSourceAreaNames(java.lang.String names)
Sets the names of the Ajax Source Areas |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MoreMotionServletRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
| Method Detail |
|---|
public javax.servlet.http.HttpServletResponse getResponse()
getResponse in class MoreMotionRequestpublic void setAllowCaching(int value)
public boolean isAjaxRequest()
public void setAjaxRequest(boolean value)
public int getAllowCaching()
public boolean generatingErrorPage()
true if currently an error page is being generated
public void setSourceAreaNames(java.lang.String names)
names - The names of the source areas Delimited with commaspublic java.lang.String[] getSourceAreaNames()
public java.lang.String getLanguage()
getLanguage in class MoreMotionRequestpublic java.lang.String getOriginPage(boolean withVariant)
withVariant - True if the page variant to be added to the page name.public java.lang.String getConfigurationScope()
getConfigurationScope in class MoreMotionRequestpublic java.lang.String getOriginPage()
public void setCookieValue(java.lang.String cookieName,
java.lang.String cookieValue,
int maxAge)
setCookieValue in class MoreMotionRequestcookieName - the Name of the cookie to set.cookieValue - the value for the cookie.maxAge - the duration of the cookie is seconds.public java.lang.String getCookieValue(java.lang.String cookieName)
getCookieValue in class MoreMotionRequestcookieName - the Name of the cookie to set.
null if the cookie is not found, otherwise the value of it.public javax.servlet.http.HttpServletRequest getHttpServletRequest()
public void generatePage(java.lang.String pageName)
throws PageGenerationException
generatePage in class MoreMotionRequestpageName - Name of the page to generate. It is usually the name of the XSL file without extension.
PageGenerationException - if generation fails.
public void generateDefaultErrorPage()
throws PageGenerationException
generateDefaultErrorPage in class MoreMotionRequestPageGenerationException
public void buildResponse(java.lang.String name)
throws ResponseBuildingException
buildResponse in class MoreMotionRequestResponseBuildingException
public void buildErrorResponse(java.lang.String name)
throws ResponseBuildingException
buildErrorResponse in class MoreMotionRequestResponseBuildingExceptionpublic void buildingErrorResponse()
buildingErrorResponse in class MoreMotionRequest
public java.lang.String resolve(java.lang.String str)
throws MScriptException
resolve in class MoreMotionRequeststr - the input string
MScriptExceptionpublic java.lang.String getPlainParameter(java.lang.String parmName)
getPlainParameter in class MoreMotionRequest
public java.lang.String getPlainParameter(java.lang.String parmName,
java.lang.String defValue)
getPlainParameter in class MoreMotionRequestpublic java.lang.String getParameter(java.lang.String parmName)
null if the parameters is not found.
getParameter in class MoreMotionRequest
public java.lang.String getParameter(java.lang.String parmName,
java.lang.String defValue)
getParameter in class MoreMotionRequestpublic java.lang.String[] getParameterValues(java.lang.String parmName)
MyServlet?code=1&code=4&code=11
getParameterValues in class MoreMotionRequestpublic java.lang.String getRequestInfo(java.lang.String info)
getRequestInfo in class MoreMotionRequestpublic java.lang.String getApplicationPath()
getApplicationPath in class MoreMotionRequest
public void setCurrentPage(CurrentPage value)
throws PageGenerationException
PageGenerationExceptionpublic CurrentPage getCurrentPage()
public void setNoCache()
setNoCache in class MoreMotionRequestpublic java.lang.String getContentType()
public boolean isSecure()
public java.lang.String getServerName()
public int getServerPort()
public java.util.Locale getLocale()
public java.lang.Object getAttribute(java.lang.String str)
getAttribute in class MoreMotionRequest
public java.io.BufferedReader getReader()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getScheme()
public boolean isRequestedSessionIdFromCookie()
public javax.servlet.http.HttpSession getSession()
getSession in class MoreMotionRequestpublic javax.servlet.http.HttpSession getSession(boolean param)
public java.util.Enumeration getParameterNames()
getParameterNames in class MoreMotionRequestpublic java.util.Enumeration getLocales()
public java.lang.String getRemoteHost()
public int getContentLength()
public javax.servlet.ServletInputStream getInputStream()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getPathTranslated()
public java.lang.String getServletPath()
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String str)
public void removeAttribute(java.lang.String str)
removeAttribute in class MoreMotionRequestpublic int getIntHeader(java.lang.String str)
public java.util.Enumeration getHeaderNames()
public java.lang.String getCharacterEncoding()
public java.lang.String getPathInfo()
public javax.servlet.http.Cookie[] getCookies()
public java.lang.String getRemoteAddr()
public java.lang.String getQueryString()
public java.lang.String getAuthType()
public boolean isUserInRole(java.lang.String str)
public java.lang.String getMethod()
getMethod in class MoreMotionRequestpublic java.lang.String getHeader(java.lang.String str)
public java.lang.String getRequestURI()
public void setAttribute(java.lang.String str,
java.lang.Object obj)
setAttribute in class MoreMotionRequestpublic boolean isRequestedSessionIdFromUrl()
public boolean isRequestedSessionIdFromURL()
public java.security.Principal getUserPrincipal()
public java.util.Enumeration getAttributeNames()
public java.lang.String getRequestedSessionId()
public long getDateHeader(java.lang.String str)
public java.lang.String getProtocol()
public java.lang.String getRemoteUser()
public boolean isRequestedSessionIdValid()
public java.lang.String getContextPath()
getContextPath in class MoreMotionRequestpublic java.util.Enumeration getHeaders(java.lang.String str)
public void setCharacterEncoding(java.lang.String str)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic java.util.Map getParameterMap()
public java.lang.StringBuffer getRequestURL()
public java.lang.String getLocalAddr()
public java.lang.String getLocalName()
public int getLocalPort()
public int getRemotePort()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||