|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.veriplace.web.servlet.AbstractVeriplaceServlet
public abstract class AbstractVeriplaceServlet
Base class for servlets that use Veriplace APIs.
Deriving from this class allows you to access Veriplace user/location data as follows:
Veriplace instance
or retrieves an existing one, using VeriplaceServletHelper.getSharedVeriplaceInstance(javax.servlet.ServletContext)
(see VeriplaceServletHelper for configuration parameters). UsesVeriplace annotation
specifying a need for user or location data, the corresponding Veriplace requests are done before your servlet
handler executes. This may include redirects and callbacks, which happen transparently. VeriplaceState object
which you can use to get the user/location properties, or to perform other operations. You may attach the following init-params to your servlet in web.xml:
VeriplaceServletHelper.getViewRendererFromViewParams(javax.servlet.ServletContext, String). doRequestInternal(HttpServletRequest, HttpServletResponse, VeriplaceState) will display.
This is an easy way to define a servlet that does some simple preprocessing of a request and then
forwards to a JSP. The view name prefix and suffix specified in your view parameters are also applied
to this view name, so by default there is an implied ".jsp" extension.
| Field Summary | |
|---|---|
protected java.lang.String |
defaultViewName
|
protected Veriplace |
veriplace
|
| Constructor Summary | |
|---|---|
AbstractVeriplaceServlet()
|
|
| Method Summary | |
|---|---|
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response)
|
protected void |
doGetOrPost(HttpServletRequest request,
HttpServletResponse response)
|
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response)
|
protected void |
doRequestInternal(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState veriplaceState)
Override this method to implement your request handler. |
protected void |
doRequestInternal(HttpServletRequest request,
HttpServletResponse response,
Veriplace veriplace,
VeriplaceState veriplaceState)
Override this method to implement your request handler. |
protected java.util.Properties |
getProperties()
Returns the contents of the properties file specified in the "veriplace.properties-file" servlet context parameter in web.xml. |
protected Client |
getVeriplaceClient(HttpServletRequest request,
Veriplace defaultInstance)
Override this method if you might need to use a different Veriplace Client for some
requests. |
void |
init(ServletConfig config)
Initialize the client. |
protected void |
setupVeriplaceState(HttpServletRequest request,
VeriplaceState state)
Override this method if you need to change any properties of the VeriplaceState,
such as VeriplaceState.setLocationMode(String), based on properties of the current request. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Veriplace veriplace
protected java.lang.String defaultViewName
| Constructor Detail |
|---|
public AbstractVeriplaceServlet()
| Method Detail |
|---|
public void init(ServletConfig config)
throws ServletException
init in interface Servletinit in class GenericServletServletException
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
java.io.IOException
doGet in class HttpServletServletException
java.io.IOException
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
java.io.IOException
doPost in class HttpServletServletException
java.io.IOException
protected void doGetOrPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
java.io.IOException
ServletException
java.io.IOException
protected void doRequestInternal(HttpServletRequest request,
HttpServletResponse response,
VeriplaceState veriplaceState)
throws java.io.IOException,
ServletException,
VeriplaceException
This method will be called for both GET and POST requests. If you need to distinguish between GET and POST, check the properties of the HttpServletRequest; however, be aware that an operation that starts out as a POST may come back as a GET, if you went through a redirect/callback process for location discovery.
The base class implementation of this method simply forwards the request to the page specified in init-params as veriplace.defaultview.
java.io.IOException
ServletException
VeriplaceException
protected void doRequestInternal(HttpServletRequest request,
HttpServletResponse response,
Veriplace veriplace,
VeriplaceState veriplaceState)
throws java.io.IOException,
ServletException,
VeriplaceException
Veriplace instance as a convenience.
This method will be called for both GET and POST requests. If you need to distinguish between GET and POST, check the properties of the HttpServletRequest; however, be aware that an operation that starts out as a POST may come back as a GET, if you went through a redirect/callback process for location discovery.
The base class implementation of this method simply forwards the request to the page specified in init-params as veriplace.defaultview.
java.io.IOException
ServletException
VeriplaceException
protected Client getVeriplaceClient(HttpServletRequest request,
Veriplace defaultInstance)
throws ConfigurationException,
UnexpectedException
Client for some
requests. For instance, you might use the same servlet to handling requests for more than
one Veriplace application, each with its own consumer key and token. A Client is a fairly
lightweight object, so it's acceptable to create a new one for each request if you want to.
ConfigurationException
UnexpectedException
protected void setupVeriplaceState(HttpServletRequest request,
VeriplaceState state)
throws VeriplaceException
VeriplaceState,
such as VeriplaceState.setLocationMode(String), based on properties of the current request.
VeriplaceException
protected java.util.Properties getProperties()
throws ConfigurationException
ConfigurationException - if the properties file was not specified or can't be read
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||