edu.uiuc.ncsa.myproxy.oa4mp.client.servlet
Class ClientServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by edu.uiuc.ncsa.security.servlet.AbstractServlet
              extended by edu.uiuc.ncsa.myproxy.oa4mp.client.servlet.ClientServlet
All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
SimpleReadyServlet, SimpleStartRequest

public abstract class ClientServlet
extends edu.uiuc.ncsa.security.servlet.AbstractServlet

Basic Client servlet. it has the machinery in it for reading in a configuration file, setting up the ClientEnvironment and making the OA4MPService instance. It also includes a utility call for getting a cookie with the identifier (stored with the key "oa4mp_client_req_id" in the users browser).

Look at the two sample uses of this in SimpleStartRequest and SimpleReadyServlet to see how to extend and use it.

Created by Jeff Gaynor
on 2/10/12 at 12:51 PM

See Also:
Serialized Form

Field Summary
static String ACTION_KEY
           
static String ACTION_REDIRECT_VALUE
           
static String DEBUG_KEY
          If a client specifically requests a response with debugging information then this will be returned ONLY in cases of an error on the server.
static String OA4MP_CLIENT_REQUEST_ID
           
static String REDIR
           
static String TOKEN_KEY
           
static String VERIFIER_KEY
           
 
Fields inherited from class edu.uiuc.ncsa.security.servlet.AbstractServlet
environment
 
Constructor Summary
ClientServlet()
           
 
Method Summary
protected  String clearCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Clear the CILogon client cookie.
 void destroy()
           
protected  ClientEnvironment getCE()
          Convenience for client servlets.
 OA4MPService getOA4MPService()
           
 void handleException(Throwable t, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Generic handling of exceptions.
 void init()
           
 void loadEnvironment()
           
protected  void shutdownCleanup(edu.uiuc.ncsa.security.core.cache.Cleanup c)
           
 
Methods inherited from class edu.uiuc.ncsa.security.servlet.AbstractServlet
debug, doGet, doIt, doPost, error, getConfigurationLoader, getEnvironment, getMyLogger, info, isDebugOn, resetState, setConfigurationLoader, setDebugOn, setEnvironment, warn
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
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

ACTION_KEY

public static final String ACTION_KEY
See Also:
Constant Field Values

ACTION_REDIRECT_VALUE

public static final String ACTION_REDIRECT_VALUE
See Also:
Constant Field Values

REDIR

public static final String REDIR
See Also:
Constant Field Values

TOKEN_KEY

public static final String TOKEN_KEY
See Also:
Constant Field Values

VERIFIER_KEY

public static final String VERIFIER_KEY
See Also:
Constant Field Values

DEBUG_KEY

public static final String DEBUG_KEY
If a client specifically requests a response with debugging information then this will be returned ONLY in cases of an error on the server. It is up to the client to unpack this. To use this, add the key to the request with a value of true.

See Also:
Constant Field Values

OA4MP_CLIENT_REQUEST_ID

public static final String OA4MP_CLIENT_REQUEST_ID
See Also:
Constant Field Values
Constructor Detail

ClientServlet

public ClientServlet()
Method Detail

getCE

protected ClientEnvironment getCE()
Convenience for client servlets. Does the cast automatically

Returns:

loadEnvironment

public void loadEnvironment()
                     throws IOException
Specified by:
loadEnvironment in class edu.uiuc.ncsa.security.servlet.AbstractServlet
Throws:
IOException

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class edu.uiuc.ncsa.security.servlet.AbstractServlet
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

shutdownCleanup

protected void shutdownCleanup(edu.uiuc.ncsa.security.core.cache.Cleanup c)

getOA4MPService

public OA4MPService getOA4MPService()
                             throws IOException
Throws:
IOException

clearCookie

protected String clearCookie(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Clear the CILogon client cookie. This way if there is an error the user won't get a stale one with a possible server-side exception later.

This clears the client request id cookie ("oa4mp_client_req_id") and returns the currently set value for it. This

Parameters:
request -
response -

handleException

public void handleException(Throwable t,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws IOException,
                            javax.servlet.ServletException
Generic handling of exceptions. This stuffs the error messages into the request and forwards them to a JSP error page. Swap this out or override as you see fit.

Overrides:
handleException in class edu.uiuc.ncsa.security.servlet.AbstractServlet
Parameters:
t -
request -
response -
Throws:
IOException
javax.servlet.ServletException


Copyright © 2013. All Rights Reserved.