org.cdlib.xtf.servletBase
Class SessionURLRewriter

Object
  extended by SequenceReceiver
      extended by ProxyReceiver
          extended by SessionURLRewriter
All Implemented Interfaces:
Result, Receiver

public class SessionURLRewriter
extends ProxyReceiver

If session data has been established, this class takes care of adding the session ID to URLs output by a Saxon transformation.


Field Summary
private  String elementName
           
private  Pattern encodeURLPattern
           
private  HttpServletRequest httpRequest
           
private  HttpServletResponse httpResponse
           
private  NamePool namePool
           
 
Fields inherited from class ProxyReceiver
nextReceiver
 
Fields inherited from class SequenceReceiver
pipelineConfiguration, previousAtomic, systemId
 
Fields inherited from interface Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
SessionURLRewriter(Receiver underlyingReceiver, Pattern encodeURLPattern, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
          Construct the URL rewriter, recording a reference to the receiver that will get the data, and the HTTP servlet response we'll use to get session info and to rewrite URLs.
 
Method Summary
 void attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
          Called when an attribute is output.
private  String getLocalName(int nameCode)
          Get the local name corresponding to the given namecode
 void startElement(int nameCode, int typeCode, int locationId, int properties)
          Called when an element begins.
 
Methods inherited from class ProxyReceiver
append, characters, close, comment, endDocument, endElement, getConfiguration, getDocumentLocator, getNamePool, getUnderlyingReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startContent, startDocument
 
Methods inherited from class SequenceReceiver
getPipelineConfiguration, getSystemId
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encodeURLPattern

private Pattern encodeURLPattern

httpRequest

private HttpServletRequest httpRequest

httpResponse

private HttpServletResponse httpResponse

namePool

private NamePool namePool

elementName

private String elementName
Constructor Detail

SessionURLRewriter

SessionURLRewriter(Receiver underlyingReceiver,
                   Pattern encodeURLPattern,
                   HttpServletRequest httpRequest,
                   HttpServletResponse httpResponse)
Construct the URL rewriter, recording a reference to the receiver that will get the data, and the HTTP servlet response we'll use to get session info and to rewrite URLs.

Method Detail

startElement

public void startElement(int nameCode,
                         int typeCode,
                         int locationId,
                         int properties)
                  throws XPathException
Called when an element begins. We simply record the name for later reference.

Specified by:
startElement in interface Receiver
Overrides:
startElement in class ProxyReceiver
Throws:
XPathException

attribute

public void attribute(int nameCode,
                      int typeCode,
                      CharSequence value,
                      int locationId,
                      int properties)
               throws XPathException
Called when an attribute is output. If it needs a session ID added, we do so here.

Specified by:
attribute in interface Receiver
Overrides:
attribute in class ProxyReceiver
Throws:
XPathException

getLocalName

private String getLocalName(int nameCode)
Get the local name corresponding to the given namecode