Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.opencms.flex.cache
Class CmsFlexRequestDispatcher  view CmsFlexRequestDispatcher download CmsFlexRequestDispatcher.java

java.lang.Object
  extended bycom.opencms.flex.cache.CmsFlexRequestDispatcher
All Implemented Interfaces:
javax.servlet.RequestDispatcher

public class CmsFlexRequestDispatcher
extends java.lang.Object
implements javax.servlet.RequestDispatcher

Implementation of the javax.servlet.RequestDispatcher interface to allow JSPs to be loaded from OpenCms.

This dispatcher will load data from 3 different data sources:

  1. Form the "real" system Filesystem (e.g. for JSP pages)
  2. From the OpenCms VFS
  3. From the Flex cache

Version:
$Revision: 1.7.2.1 $

Field Summary
private static int DEBUG
          Internal DEBUG flag.
private  java.lang.String m_ext_target
          The external target that will be included by the RequestDispatcher, needed if this is not a dispatcher to a cms resource
private  javax.servlet.RequestDispatcher m_rd
          The "real" RequestDispatcher, used when a true include (to the file system) is needed.
private  java.lang.String m_vfs_target
          The OpenCms VFS target that will be included by the RequestDispatcher.
 
Constructor Summary
CmsFlexRequestDispatcher(javax.servlet.RequestDispatcher rd, java.lang.String vfs_target, java.lang.String ext_target)
          Creates a new instance of CmsFlexRequestDispatcher.
 
Method Summary
 void forward(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
          Wrapper for the standard servlet API call.
 void include(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
          Wrapper for dispatching to a file from the OpenCms VFS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_rd

private javax.servlet.RequestDispatcher m_rd
The "real" RequestDispatcher, used when a true include (to the file system) is needed.


m_vfs_target

private java.lang.String m_vfs_target
The OpenCms VFS target that will be included by the RequestDispatcher.


m_ext_target

private java.lang.String m_ext_target
The external target that will be included by the RequestDispatcher, needed if this is not a dispatcher to a cms resource


DEBUG

private static final int DEBUG
Internal DEBUG flag. Set to 9 for maximum verbosity.

See Also:
Constant Field Values
Constructor Detail

CmsFlexRequestDispatcher

public CmsFlexRequestDispatcher(javax.servlet.RequestDispatcher rd,
                                java.lang.String vfs_target,
                                java.lang.String ext_target)
Creates a new instance of CmsFlexRequestDispatcher.

Method Detail

forward

public void forward(javax.servlet.ServletRequest req,
                    javax.servlet.ServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
Wrapper for the standard servlet API call.

Forward calls are actually NOT wrapped by OpenCms as of now. So they should not be used in JSP pages or servlets.

Specified by:
forward in interface javax.servlet.RequestDispatcher

include

public void include(javax.servlet.ServletRequest req,
                    javax.servlet.ServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
Wrapper for dispatching to a file from the OpenCms VFS.

This method will dispatch to cache, to real file system or to the OpenCms VFS, whatever is needed.

This method is much more complex then it sould be because of the internal standard buffering of JSP pages. Because of that I can not just intercept and buffer the stream, since I don't have access to it (it is wrapped internally in the JSP pages, which have their own buffer). That leads to a solution where the data is first written to the bufferd stream, but without includes. Then it is parsed again later (in response.processCacheEntry()), enriched with the included elements that have been ommitted in the first case. I would love to see a simpler solution, but this works for now.

Specified by:
include in interface javax.servlet.RequestDispatcher