org.jasig.portal.channels
Class CGenericXSLT

java.lang.Object
  extended by org.jasig.portal.channels.CGenericXSLT
All Implemented Interfaces:
IMultithreadedCacheable, IMultithreadedChannel

public class CGenericXSLT
extends java.lang.Object
implements IMultithreadedChannel, IMultithreadedCacheable

A channel which transforms XML for rendering in the portal.

Static channel parameters to be supplied:

  1. "xmlUri" - a URI representing the source XML document
  2. "sslUri" - a URI representing the corresponding .ssl (stylesheet list) file
  3. "xslTitle" - a title representing the stylesheet (optional) If no title parameter is specified, a default stylesheet will be chosen according to the media
  4. "xslUri" - a URI representing the stylesheet to use If xslUri is supplied, sslUri and xslTitle will be ignored.
  5. "cacheTimeout" - the amount of time (in seconds) that the contents of the channel should be cached (optional). If this parameter is left out, a default timeout value will be used.
  6. "upc_localConnContext" - The class name of the ILocalConnectionContext implementation. Use when local data needs to be sent with the request for the URL.
  7. "upc_allow_xmlUri_prefixes" - Optional parameter specifying as a whitespace delimited String the allowable xmlUri prefixes. Defaults to "http:// https://"
  8. "upc_deny_xmlUri_prefixes" - Optional parameter specifying as a whitespace delimited String URI prefixes that should block a URI as xmlUri even if it matched one of the allow prefixes. Defaults to ""
  9. "restrict_xmlUri_inStaticData" - Optional parameter specifying whether the xmlUri should be restricted according to the allow and deny prefix rules above as presented in ChannelStaticData or just as presented in ChannelRuntimeData. "true" means both ChannelStaticData and ChannelRuntimeData will be restricted. Any other value or the parameter not being present means only ChannelRuntimeData will be restricted. It is important to set this value to true when using subscribe-time channel parameter configuration of the xmlUri.

    The xmlUri and xslTitle static parameters above can be overridden by including parameters of the same name (xmlUri and/or xslTitle) in the HttpRequest string. Prior to uPortal 2.5.1 sslUri and xslUri could also be overridden -- these features have been removed to improve the security of CGenericXSLT instances.

    Additionally, as of uPortal 2.5.1, the xmlUri must match an allowed URI prefix. By default http:// and https:// URIs are allowed. If you are using the empty document or another XML file from the classpath or from the filesystem, you will need to allow a prefix to or the full path of that resource.

    This channel can be used for all XML formats including RSS. Any other parameters passed to this channel via HttpRequest will get passed in turn to the XSLT stylesheet as stylesheet parameters. They can be read in the stylesheet as follows: <xsl:param name="yourParamName">aDefaultValue</xsl:param>

    CGenericXSLT is also useful for channels that have no dynamic data. In these types of channels, all the markup comes from the XSLT stylesheets. An empty XML document can be used and is included with CGenericXSLT. Just set the xml parameter to this empty document and allow the path to the empty document.

    Version:
    $Revision: 1.65.2.6 $
    Author:
    Steve Toth, stoth@interactivebusiness.com, Ken Weiner, kweiner@unicon.net, Peter Kharchenko pkharchenko@interactivebusiness.com (multithreading,caching)

    Nested Class Summary
    private  class CGenericXSLT.CState
               
     
    Field Summary
    private static org.apache.commons.logging.Log log
               
    (package private)  java.util.Map stateTable
               
    (package private) static java.lang.String systemCacheId
               
     
    Constructor Summary
    CGenericXSLT()
               
     
    Method Summary
     ChannelCacheKey generateKey(java.lang.String uid)
              Requests the channel to generate a key uniqly describing it's current state, and a description of key usage.
    private  java.lang.String getKey(CGenericXSLT.CState state)
               
     ChannelRuntimeProperties getRuntimeProperties(java.lang.String uid)
               
     boolean isCacheValid(java.lang.Object validity, java.lang.String uid)
              Requests the channel to verify validity of the retreived cache based on the validator object.
     void receiveEvent(PortalEvent ev, java.lang.String uid)
               
     void renderXML(org.xml.sax.ContentHandler out, java.lang.String uid)
               
     void setRuntimeData(ChannelRuntimeData rd, java.lang.String uid)
               
     void setStaticData(ChannelStaticData sd, java.lang.String uid)
               
     
    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

    stateTable

    java.util.Map stateTable

    systemCacheId

    static final java.lang.String systemCacheId
    See Also:
    Constant Field Values
    Constructor Detail

    CGenericXSLT

    public CGenericXSLT()
    Method Detail

    setStaticData

    public void setStaticData(ChannelStaticData sd,
                              java.lang.String uid)
                       throws ResourceMissingException
    Specified by:
    setStaticData in interface IMultithreadedChannel
    uid - a string uniqly identifying a channel "instance" in the system. For example, a combination of session id and channel instance id would fit the bill.
    Throws:
    ResourceMissingException

    setRuntimeData

    public void setRuntimeData(ChannelRuntimeData rd,
                               java.lang.String uid)
    Specified by:
    setRuntimeData in interface IMultithreadedChannel

    receiveEvent

    public void receiveEvent(PortalEvent ev,
                             java.lang.String uid)
    Specified by:
    receiveEvent in interface IMultithreadedChannel

    getRuntimeProperties

    public ChannelRuntimeProperties getRuntimeProperties(java.lang.String uid)
    Specified by:
    getRuntimeProperties in interface IMultithreadedChannel

    renderXML

    public void renderXML(org.xml.sax.ContentHandler out,
                          java.lang.String uid)
                   throws PortalException
    Specified by:
    renderXML in interface IMultithreadedChannel
    Throws:
    PortalException

    generateKey

    public ChannelCacheKey generateKey(java.lang.String uid)
    Description copied from interface: IMultithreadedCacheable
    Requests the channel to generate a key uniqly describing it's current state, and a description of key usage.

    Specified by:
    generateKey in interface IMultithreadedCacheable

    isCacheValid

    public boolean isCacheValid(java.lang.Object validity,
                                java.lang.String uid)
    Description copied from interface: IMultithreadedCacheable
    Requests the channel to verify validity of the retreived cache based on the validator object.

    Specified by:
    isCacheValid in interface IMultithreadedCacheable

    getKey

    private java.lang.String getKey(CGenericXSLT.CState state)