org.apache.jetspeed.portal.portlets
Class ServletProxyPortlet

java.lang.Object
  extended byorg.apache.jetspeed.portal.portlets.AbstractPortlet
      extended byorg.apache.jetspeed.portal.portlets.ServletProxyPortlet
All Implemented Interfaces:
Cacheable, Portlet, PortletState, org.apache.turbine.services.cache.Refreshable, java.io.Serializable

public class ServletProxyPortlet
extends AbstractPortlet

This portlet class is intended to be used for internal URLs that will not work properly if they are part of the same request as the Jetspeed/Turbine controller servlet--Struts-mapped URLs are an example of these.
ServletProxyPortlet uses an application context-relative URL as an input parameter. It uses data obtained from org.apache.turbine.util.RunData to construct an absolute URL and append the session id to it. Using this URL, it constructs a java.net.URL object, retrieves the content from it, and converts the content to a String. Finally, it returns an ECS StringElement created with this String for Jetspeed to render as a portlet. Content is returned as-is; no filtering is performed on the html before returning it.

This portlet accepts 3 parameters:
URL (required) -- the web application-context relative URL (a query string may be used to pass parameters)
session_token (optional) -- token key used by the web server to pass the session id on the query string
protocol (optional) -- protocol to use to make the URL request

Author:
Joe Barefoot
See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_PROTOCOL
          The default protocol used to construct the URL -- http
static java.lang.String DEFAULT_SESSION_TOKEN
          The default token to use to pass the session ID on the query String -- jsessionid
static java.lang.String PROTOCOL_PARAMETER_NAME
          The name of the parameter to hold the protocol to use (optional, default is http)
static java.lang.String SESSION_TOKEN_PARAMETER_NAME
          The name of the parameter to hold the token by which the session ID is passed on the query string (optional, default is jsessionid) This is included to accomodate all web servers, as the token is usually different from one server to another.
static java.lang.String URL_PARAMETER_NAME
          The name of the parameter to hold our application context-relative URL
 
Fields inherited from class org.apache.jetspeed.portal.portlets.AbstractPortlet
content
 
Fields inherited from interface org.apache.jetspeed.portal.Portlet
PORTLET_MAXIMIZED, PORTLET_MINIMIZED, PORTLET_NORMAL
 
Constructor Summary
ServletProxyPortlet()
           
 
Method Summary
 org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData rundata)
          Gets content by proxy (java.net.URL) from an internal URL and returns it
protected  java.lang.String processURL(org.apache.turbine.util.RunData rundata)
          Constructs a full URL to retrieve content from.
 
Methods inherited from class org.apache.jetspeed.portal.portlets.AbstractPortlet
allowClose, allowCustomize, allowInfo, allowMaximize, allowMinimize, allowPrintFriendly, allowView, clearContent, getAllowEdit, getAllowMaximize, getAllowView, getAttribute, getContent, getContent, getCreationTime, getDescription, getDescription, getExpirationMillis, getExpire, getHandle, getHandle, getID, getImage, getImage, getInstance, getName, getPortletConfig, getTitle, getTitle, init, isCacheable, isClosed, isMinimized, isShowTitleBar, providesCustomization, refresh, setAttribute, setCacheable, setCachedObject, setClosed, setContent, setContent, setContent, setCreationTime, setDescription, setExpirationMillis, setHandle, setID, setImage, setMinimized, setName, setPortletConfig, setTitle, setTitle, supportsType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_PARAMETER_NAME

public static final java.lang.String URL_PARAMETER_NAME
The name of the parameter to hold our application context-relative URL

See Also:
Constant Field Values

PROTOCOL_PARAMETER_NAME

public static final java.lang.String PROTOCOL_PARAMETER_NAME
The name of the parameter to hold the protocol to use (optional, default is http)

See Also:
Constant Field Values

SESSION_TOKEN_PARAMETER_NAME

public static final java.lang.String SESSION_TOKEN_PARAMETER_NAME
The name of the parameter to hold the token by which the session ID is passed on the query string (optional, default is jsessionid) This is included to accomodate all web servers, as the token is usually different from one server to another.

See Also:
Constant Field Values

DEFAULT_PROTOCOL

public static final java.lang.String DEFAULT_PROTOCOL
The default protocol used to construct the URL -- http

See Also:
Constant Field Values

DEFAULT_SESSION_TOKEN

public static final java.lang.String DEFAULT_SESSION_TOKEN
The default token to use to pass the session ID on the query String -- jsessionid

See Also:
Constant Field Values
Constructor Detail

ServletProxyPortlet

public ServletProxyPortlet()
Method Detail

getContent

public org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData rundata)
Gets content by proxy (java.net.URL) from an internal URL and returns it

Specified by:
getContent in interface Portlet
Overrides:
getContent in class AbstractPortlet
Parameters:
rundata - The RunData object for the current request
Returns:
an ECS StringElement

processURL

protected java.lang.String processURL(org.apache.turbine.util.RunData rundata)
Constructs a full URL to retrieve content from. Override to append custom (default) query parameters, etc.

Parameters:
rundata - The RunData object for the current request
Returns:
An absolute URL with the session ID appended


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