org.jasig.portal.utils
Class CookieCutter

java.lang.Object
  extended by org.jasig.portal.utils.CookieCutter

public class CookieCutter
extends java.lang.Object

CookieCutter is a utility class which stores, sends and receives cookies for a CWebProxy channel instance. It can be used in other classes where appropriate. All cookies which are sent from the proxied application (and therefore need to be sent back) are kept in a Vector.


Nested Class Summary
private  class CookieCutter.ChannelCookie
          This class is used by any channel receiving cookies from a backend application to store cookie information.
 
Field Summary
private  java.util.Vector cookies
           
private static org.apache.commons.logging.Log log
           
private  boolean supportSetCookie2
           
 
Constructor Summary
CookieCutter()
          Instantiates a new CookieCutter object.
 
Method Summary
 boolean cookiesExist()
          Returns true if cookies need to be sent to proxied application.
private  void processSetCookie2Header(java.lang.String headerVal, java.lang.String domain, java.lang.String path, java.lang.String port)
          Processes the Cookie2 header.
private  void processSetCookieHeader(java.lang.String headerVal, java.lang.String domain, java.lang.String path, java.lang.String port)
          Processes the Cookie header.
 void sendCookieHeader(java.net.HttpURLConnection httpUrlConnect, java.lang.String domain, java.lang.String path, java.lang.String port)
          Sends a cookie header to origin server according to the Netscape specification.
 void storeCookieHeader(java.net.HttpURLConnection httpUrlConnect, java.lang.String domain, java.lang.String path, java.lang.String port)
          Parses the cookie headers and stores the cookies in the cookies Vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

cookies

private java.util.Vector cookies

supportSetCookie2

private boolean supportSetCookie2
Constructor Detail

CookieCutter

public CookieCutter()
Instantiates a new CookieCutter object.

Method Detail

cookiesExist

public boolean cookiesExist()
Returns true if cookies need to be sent to proxied application.


sendCookieHeader

public void sendCookieHeader(java.net.HttpURLConnection httpUrlConnect,
                             java.lang.String domain,
                             java.lang.String path,
                             java.lang.String port)
Sends a cookie header to origin server according to the Netscape specification.

Parameters:
httpUrlConnect - The HttpURLConnection handling this URL connection
domain - The domain value of the cookie
path - The path value of the cookie
port - The port value of the cookie

storeCookieHeader

public void storeCookieHeader(java.net.HttpURLConnection httpUrlConnect,
                              java.lang.String domain,
                              java.lang.String path,
                              java.lang.String port)
Parses the cookie headers and stores the cookies in the cookies Vector.


processSetCookie2Header

private void processSetCookie2Header(java.lang.String headerVal,
                                     java.lang.String domain,
                                     java.lang.String path,
                                     java.lang.String port)
Processes the Cookie2 header.

Parameters:
headerVal - The value of the header
domain - The domain value of the cookie
path - The path value of the cookie
port - The port value of the cookie

processSetCookieHeader

private void processSetCookieHeader(java.lang.String headerVal,
                                    java.lang.String domain,
                                    java.lang.String path,
                                    java.lang.String port)
                             throws java.text.ParseException
Processes the Cookie header.

Parameters:
headerVal - The value of the header
domain - The domain value of the cookie
path - The path value of the cookie
port - The port value of the cookie
Throws:
java.text.ParseException