|
MoreMotionRequest Class |
|
|
When we develop services or other types of classes for MoreMotion environment we use org.moremotion.servlet.MoreMotionRequest class all the time. Notes for version 5.0 Before version 5.0 the MoreMotion AF units strongly depended on HttpServletRequest and HttpSession objects of the servlet container. This dependency was broken with release 5.0 and MoreMotionRequest become an abstract base class that represents a generic MoreMotion request. New class MoreMotionServletRequest took the whole responsibility of the older MoreMotionRequest class. To keep up the compatibility some methods still provided on MoreMotioRequest class but marked as deprecated. The reason for this change is obvious; The MoreMotion AF is no longer a "Http addicted" framework. Only way to start an action in the system was to make request via http but from version 5.0 on any type of request (e.g. a scheduled batch request) can trigger a MoreMotion service. Request Parameter Decoding with MoreMotionServletRequest When a request is sent to the server the parameters existing in the request are encoded by the browsers using an encoding, e.g. 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 a request parameter called _enc. This parameter should contain the encoding that was used in encoding the request parameters. If you are getting the value of a request parameter from the MoreMotionServletRequest object, the parameters are converted using the value supplied with this _enc parameter.
The name string will get the converted value of the "name" parameter. However, some application servers can nicely guess the case and reads request parameters correctly. In that case you should disable the character conversion by setting a sysinfo.xml parameter to false. Here is the section that you have to change:
HttpServletResponse Objects Since an MoreMotion programmer does not need to write directly to the HttpServletResponse, this object is not passed as a separate parameter to the other MoreMotion Classes. Most of the time you will have only MoreMotionRequest which contains all the necessary objects in it.
MoreMotionRequest Methods
Accessing to HttpServletResponse object
Accessing to ServletContext object
MoreMotionRequest is one of the most important classes of the MoreMotion API since it provides a rich set of methods to perform the common tasks of a MoreMotion Service. See the examples below.
|