|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.opencms.flex.CmsJspLoader
The JSP loader which enables the execution of JSP in OpenCms.
It does NOT extend A_CmsLauncher, since JSP are not related
to the OpenCms Template mechanism. However, it implements the
launcher interface so that JSP can be sub-elements in XMLTemplace pages.
I_CmsResourceLoader,
I_CmsLauncher| Field Summary | |
static String |
C_DEFAULT_JSP_ENCODING
Encoding to write JSP files to disk ( ISO-8859-1) |
static String |
C_DIRECTIVE_END
Special JSP directive tag start ( %>) |
static String |
C_DIRECTIVE_START
Special JSP directive tag start ( <%@) |
static String |
C_JSP_EXTENSION
Extension for JSP managed by OpenCms ( .jsp) |
static String |
C_LOADER_ERRORPAGECOMMIT
Name of "error pages are commited or not" runtime property |
static String |
C_LOADER_JSPEXPORTURL
Name of export URL runtime property |
| Fields inherited from interface com.opencms.launcher.I_CmsLauncher |
C_TYPE_DUMP, C_TYPE_JAVASCRIPT, C_TYPE_JSP, C_TYPE_LINK, C_TYPE_PDF, C_TYPE_VELOCITY, C_TYPE_XML |
| Fields inherited from interface com.opencms.flex.I_CmsResourceLoader |
C_LOADER_CACHENAME, C_LOADER_CACHEPROPERTY, C_LOADER_EXCEPTION_PREFIX, C_LOADER_STREAMPROPERTY |
| Constructor Summary | |
CmsJspLoader()
The constructor of the class is empty, the initial instance will be created by the launcher manager upon startup of OpenCms. |
|
| Method Summary | |
void |
clearCache()
This is part of the I_CmsLauncher interface, but for JSP so far this is a NOOP. |
void |
destroy()
Destroy this ResourceLoder, this is a NOOP so far. |
static String |
getJspName(String name)
Translates the JSP file name for a OpenCms VFS resourcn to the name used in the "real" file system. |
static String |
getJspPath(String name,
boolean online)
Returns the absolute path in the "real" file system for a given JSP. |
static String |
getJspRepository()
Returns the absolute path in the "real" file system for the JSP repository toplevel directory. |
static String |
getJspUri(String name,
boolean online)
Returns the uri for a given JSP in the "real" file system, i.e. the path in the file system relative to the web application directory. |
int |
getLauncherId()
Returns the ID that indicates the type of the launcher. |
String |
getResourceLoaderInfo()
Return a String describing the ResourceLoader, which is "The OpenCms default resource loader for JSP" |
void |
init(A_OpenCms openCms)
Initialize the ResourceLoader, here the configuration for the JSP repository (directories used) is set. |
void |
initlaunch(CmsObject cms,
CmsFile file,
String startTemplateClass,
A_OpenCms openCms)
Start launch method called by the OpenCms system to show a resource, this basically processes the resource and returns the output. |
void |
load(CmsObject cms,
CmsFile file,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Basic top-page processing method for this I_CmsResourceLoader, this method is called by initlaunch() if a JSP is requested and
the original request was from the launcher manager. |
byte[] |
loadTemplate(CmsObject cms,
CmsFile file)
Method to enable JSPs to be used as sub-elements in XMLTemplates. |
void |
service(CmsObject cms,
CmsResource file,
CmsFlexRequest req,
CmsFlexResponse res)
Does the job of including the JSP, this method should usually be called from a CmsFlexRequestDispatcher only. |
static void |
setJspExportUrl(String value)
Set's the JSP export URL. |
void |
setOpenCms(A_OpenCms openCms)
This is part of the I_CmsLauncher interface, used here to call the init() method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String C_DIRECTIVE_START
<%@)
public static final String C_DIRECTIVE_END
%>)
public static final String C_DEFAULT_JSP_ENCODING
ISO-8859-1)
public static final String C_JSP_EXTENSION
.jsp)
public static final String C_LOADER_JSPEXPORTURL
public static final String C_LOADER_ERRORPAGECOMMIT
| Constructor Detail |
public CmsJspLoader()
To initilize the fields in this class, the setOpenCms()
method will be called by the launcher.
CmsLauncherManager,
setOpenCms(A_OpenCms openCms)| Method Detail |
public void clearCache()
clearCache in interface I_CmsLauncherpublic void setOpenCms(A_OpenCms openCms)
setOpenCms in interface I_CmsLauncherinit(A_OpenCms openCms)public int getLauncherId()
com.opencms.launcher.I_CmsLauncher.C_TYPE_JSP.
getLauncherId in interface I_CmsLauncherI_CmsLauncher
public void initlaunch(CmsObject cms,
CmsFile file,
String startTemplateClass,
A_OpenCms openCms)
throws CmsException
This is part of the Launcher interface.
All requests will be forwarded to the load() method of this
class. That forms the link between the Launcher and Loader interfaces.
Exceptions thrown in the load() method of this loader
will be handled here, usually by wrapping them in a CmsException
that will then be shown in the OpenCms error dialog.
initlaunch in interface I_CmsLaunchercms - CmsObject Object for accessing system resources.file - CmsFile Object with the selected resource to be shown.startTemplateClass - Name of the template class to start with.openCms - a instance of A_OpenCms for redirect-needs
CmsException - all exeptions in the load process of a JSP will be caught here and wrapped to a CmsExceptionI_CmsLauncher,
load(CmsObject cms, CmsFile file, HttpServletRequest req, HttpServletResponse res)public void destroy()
destroy in interface I_CmsResourceLoaderpublic String getResourceLoaderInfo()
"The OpenCms default resource loader for JSP"
getResourceLoaderInfo in interface I_CmsResourceLoaderpublic void init(A_OpenCms openCms)
init in interface I_CmsResourceLoaderopenCms - An OpenCms object to use for initalizing.public static void setJspExportUrl(String value)
This is required after init() called if the URL was not set in opencms.
properties.
public void load(CmsObject cms,
CmsFile file,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
IOException
initlaunch() if a JSP is requested and
the original request was from the launcher manager.
load in interface I_CmsResourceLoadercms - The initialized CmsObject which provides user permissionsfile - The requested OpenCms VFS resourcereq - The original servlet requestres - The original servlet response
javax.servlet.ServletException - might be thrown in the process of including the JSP
IOException - might be thrown in the process of including the JSPI_CmsResourceLoader,
initlaunch(CmsObject cms, CmsFile file, String startTemplateClass, A_OpenCms openCms)
public byte[] loadTemplate(CmsObject cms,
CmsFile file)
throws CmsException
cms - The initialized CmsObject which provides user permissionsfile - The requested OpenCms VFS resource
CmsException - In case the Loader can not process the requested resourceCmsJspTemplatepublic static String getJspName(String name)
The name given must be a absolute URI in the OpenCms VFS, e.g. CmsFile.getAbsolutePath()
name - The file to calculate the JSP name for
public static String getJspUri(String name,
boolean online)
name - The name of the JSP fileonline - Flag to check if this is request is online or not
public static String getJspPath(String name,
boolean online)
name - The name of the JSP fileonline - Flag to check if this is request is online or not
public static String getJspRepository()
public void service(CmsObject cms,
CmsResource file,
CmsFlexRequest req,
CmsFlexResponse res)
throws javax.servlet.ServletException,
IOException
CmsFlexRequestDispatcher only.This method is called directly if the element is called as a sub-element from another I_CmsResourceLoader.
One of the tricky issues is the correct cascading of the Exceptions, so that you are able to identify the true origin of the problem. This ia achived by imprinting a String C_EXCEPTION_PREFIX to the exception message.
service in interface I_CmsResourceLoadercms - Used to access the OpenCms VFSfile - The reqested JSP file resource in the VFSreq - The current requestres - The current response
javax.servlet.ServletException - might be thrown in the process of including the JSP
IOException - might be thrown in the process of including the JSPCmsFlexRequestDispatcher
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||