org.apache.jetspeed.services.webpage
Interface SiteSession

All Known Implementing Classes:
AbstractSiteSession

public interface SiteSession

Standard interface for all proxied sessions. Handles the communication and session state between the webpage service and a single site

Version:
$Id: SiteSession.java,v 1.3 2004/02/23 03:46:26 jford Exp $
Author:
David Sean Taylor

Method Summary
 boolean addCookieToSession(javax.servlet.http.Cookie cookie)
          Given a cookie, it first checks to see if that cookie is already managed in this session.
 void drainContent(java.net.URLConnection con, javax.servlet.http.HttpServletResponse response)
          Retrieves the content from the URL Connection stream and writes it to servlet response
 int getCacheCount()
          Gets the cache count for this session.
 java.lang.String getContentAsString(java.net.URLConnection con, ProxyRunData data, java.lang.String url)
          Gets the HTML content from the URL Connection stream and returns it as a Stream
 int getHitCount()
          Gets the hitcount for this session.
 void incCacheCount()
          Increments the hitcount for this session.
 void incHitCount()
          Increments the hitcount for this session.
 boolean logon(ProxyRunData data)
          Logs on to the target host
 boolean logout(ProxyRunData data)
          Logs out of the target host
 void proxy(java.lang.String site, ProxyRunData data)
          Given a site URL, proxies the content of that site.
 void rewriteContent(ProxyRunData data, java.net.URLConnection con, int contentType, java.lang.String url)
          Reads stream for proxied host, runs a rewriter against that stream, rewriting relevant links, and writes the parsed stream back to the client.
 

Method Detail

proxy

public void proxy(java.lang.String site,
                  ProxyRunData data)
           throws java.io.IOException
Given a site URL, proxies the content of that site. The actual rules on rewriting the proxied resource are dependent on implementation and configuration parameters. For example, all HTTP hyperlinks(HREFs) could be rewritten as proxied hyperlinks back to this Proxy. Or all relative references to web resources (images, stylesheets, ...) could be rewritten as absolute references, but are not proxied.

Parameters:
site - the proxied resource address.
data - the request specific rundata.
Throws:
java.io.IOException - a servlet exception.

getContentAsString

public java.lang.String getContentAsString(java.net.URLConnection con,
                                           ProxyRunData data,
                                           java.lang.String url)
                                    throws java.io.IOException
Gets the HTML content from the URL Connection stream and returns it as a Stream

Parameters:
con - The URLConnection to read from.
data - the request specific rundata.
Returns:
The HTML Content from the stream.
Throws:
java.io.IOException - a servlet exception.

drainContent

public void drainContent(java.net.URLConnection con,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.io.IOException
Retrieves the content from the URL Connection stream and writes it to servlet response

Parameters:
con - The URLConnection to read from.
Throws:
java.io.IOException - a servlet exception.

addCookieToSession

public boolean addCookieToSession(javax.servlet.http.Cookie cookie)
Given a cookie, it first checks to see if that cookie is already managed in this session. If it is, it means that the session has timed out and that the network element has now created a new session. In that case, replace the cookie, and re-establish the session (logon) If its a new cookie, we will still need to logon, and and the cookie to the managed cookies collection for this session.

Parameters:
cookie - new cookie returned from target server.
Returns:
true when a new cookie added, false when updated.

logon

public boolean logon(ProxyRunData data)
              throws java.io.IOException
Logs on to the target host

Parameters:
data - the request specific rundata.
Throws:
java.io.IOException - a servlet exception.

logout

public boolean logout(ProxyRunData data)
               throws java.io.IOException
Logs out of the target host

Parameters:
data - the request specific rundata.
Throws:
java.io.IOException - a servlet exception.

rewriteContent

public void rewriteContent(ProxyRunData data,
                           java.net.URLConnection con,
                           int contentType,
                           java.lang.String url)
                    throws java.io.IOException
Reads stream for proxied host, runs a rewriter against that stream, rewriting relevant links, and writes the parsed stream back to the client.

Parameters:
con - the URLConnection with proxied host.
contentType - the contentType of the request.
Throws:
java.io.IOException - a servlet exception.

getHitCount

public int getHitCount()
Gets the hitcount for this session.

Returns:
the hitcount for this session.

incHitCount

public void incHitCount()
Increments the hitcount for this session.


getCacheCount

public int getCacheCount()
Gets the cache count for this session.

Returns:
the cache count for this session.

incCacheCount

public void incCacheCount()
Increments the hitcount for this session.



Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.