com.sas.servlet.util
Class MethodInvocationServlet

com.sas.servlet.util.MethodInvocationServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class MethodInvocationServlet

A servlet used to generically call a method on a particular class by passing the CLASS_PARAMETER or OBJECT_PARAMETER. One of the CLASS_PARAMETER or OBJECT_PRARMETER is required, but not both. OBJECT_PARAMETER is required if invoking a method on a class instance. CLASS_PARAMETER is used for invoking static methods. If not specified explicitly then the method invoked will be of the form servletInvocationMethod(HTTPRequest, HTTPResponse). If a method name is specified via the METHOD request parameter then it will use that parameter value with a signature of (HTTPRequest, HTTPResponse)

To set the character encoding that will be set on the servlet's response, then you can place the character encoding to be used on the request object or the session. The attribute name of the key used is the String com.sas.web.keys.ComponentKeys.CHARACTER_ENCODING. The order of preference is the request and then the session. If you do not set the character encoding, then the ComponentPropertyManager.getOutputCharacterEncoding() will be used. The default value on the ComponentPropertyManager is UTF-8.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_PARAMETER
          The name of the class for which the method is to be called.
static java.lang.String METHOD_PARAMETER
          The name of the method to call on the specified class.
static java.lang.String OBJECT_PARAMETER
          The name of the object to be searched in the page context using the javax.servlet.jsp.PageContext.findAttribute method.
static java.lang.Class[] PARAMS
          Represents the methods parameter array.
 
Constructor Summary
MethodInvocationServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doGet() Respond to the Get message.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doPost() Respond to the Post message.
 

Field Detail

CLASS_PARAMETER

public static final java.lang.String CLASS_PARAMETER
The name of the class for which the method is to be called. This is required if the method being called is static. Set the OBJECT_PARAMETER instead if you are invoking from an object.

See Also:
Constant Field Values

METHOD_PARAMETER

public static final java.lang.String METHOD_PARAMETER
The name of the method to call on the specified class. This method must have a signature of (HTTPRequest, HTTPResponse)

See Also:
Constant Field Values

OBJECT_PARAMETER

public static final java.lang.String OBJECT_PARAMETER
The name of the object to be searched in the page context using the javax.servlet.jsp.PageContext.findAttribute method. If this is not specified or, has a value of null, then a static method is assumed.

See Also:
Constant Field Values

PARAMS

public static final java.lang.Class[] PARAMS
Represents the methods parameter array.

Constructor Detail

MethodInvocationServlet

public MethodInvocationServlet()
Method Detail

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
doPost() Respond to the Post message.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - The HttpServletRequest
response - The HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
doGet() Respond to the Get message.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The HttpServletRequest
response - The HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.