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

Quick Search    Search Deep

Source code: com/opencms/flex/I_CmsResourceLoader.java


1   /*
2    * File   : $Source: /usr/local/cvs/opencms/src/com/opencms/flex/Attic/I_CmsResourceLoader.java,v $
3    * Date   : $Date: 2003/05/13 13:18:20 $
4    * Version: $Revision: 1.6.2.1 $
5    *
6    * This library is part of OpenCms -
7    * the Open Source Content Mananagement System
8    *
9    * Copyright (C) 2002 - 2003 Alkacon Software (http://www.alkacon.com)
10   *
11   * This library is free software; you can redistribute it and/or
12   * modify it under the terms of the GNU Lesser General Public
13   * License as published by the Free Software Foundation; either
14   * version 2.1 of the License, or (at your option) any later version.
15   *
16   * This library is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19   * Lesser General Public License for more details.
20   *
21   * For further information about Alkacon Software, please see the
22   * company website: http://www.alkacon.com
23   *
24   * For further information about OpenCms, please see the
25   * project website: http://www.opencms.org
26   * 
27   * You should have received a copy of the GNU Lesser General Public
28   * License along with this library; if not, write to the Free Software
29   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30   */
31  
32  package com.opencms.flex;
33  
34  import com.opencms.file.CmsFile;
35  import com.opencms.file.CmsObject;
36  import com.opencms.file.CmsResource;
37  
38  import java.io.IOException;
39  
40  import javax.servlet.ServletException;
41  import javax.servlet.ServletRequest;
42  import javax.servlet.ServletResponse;
43  import javax.servlet.http.HttpServletRequest;
44  import javax.servlet.http.HttpServletResponse;
45  
46  /**
47   * This interface describes a resource loader for OpenCms, 
48   * a class that can load a resource from the VFS, 
49   * process it's contents and deliver the result to the user.<p>
50   *
51   * The I_CmsResourceLoader operates with Request and Response in 
52   * much the same way as a standard Java web application.<p>
53   * 
54   * The I_CmsResourceLoader is closely related to the {@link com.opencms.launcher.I_CmsLauncher}
55   * interface. In essence, both interfaces serve the same purpose. 
56   * However, the I_ResourceLoader is much closer related to the standard 
57   * Java Servlet API then the I_CmsLauncher, which makes it easier to 
58   * understand for the novice OpenCms programmer. That way, a programmer
59   * will hopefully need less time to get productive with OpenCms.<p>
60   * 
61   * This interface uses a standard servlet
62   * {@link javax.servlet.http.HttpServletRequestWrapper} / {@link javax.servlet.http.HttpServletResponseWrapper}
63   * that provide access to a special implementation of the {@link javax.servlet.RequestDispatcher}.
64   * The handling of the output written to the response is done by this 
65   * dispatcher. The results are then passed back to OpenCms which 
66   * will deliver them to the requesting user.<p>
67   *
68   * @author  Alexander Kandzior (a.kandzior@alkacon.com)
69   * 
70   * @version $Revision: 1.6.2.1 $
71   * @since FLEX alpha 1
72   * 
73   * @see com.opencms.flex.cache.CmsFlexRequest
74   * @see com.opencms.flex.cache.CmsFlexResponse
75   * @see com.opencms.flex.cache.CmsFlexRequestDispatcher
76   */
77  public interface I_CmsResourceLoader {
78      
79      /** The name of the VFS property that steers the caching */
80      public static final String C_LOADER_CACHEPROPERTY = "cache";
81      
82      /** The name of the VFS property that steers the streaming */
83      public static final String C_LOADER_STREAMPROPERTY = "stream";
84      
85      /** Name of FlexCache runtime property */
86      public static final String C_LOADER_CACHENAME = "flex.cache";
87      
88      /** Prefix for exception message that occurs in a loaded file */
89      public static final String C_LOADER_EXCEPTION_PREFIX = "Resource loader error in file";         
90                 
91      /** 
92       * Initialize the ResourceLoader.
93       *
94       * @param openCms An A_OpenCms object to use for initalizing.
95       */
96      public void init(com.opencms.core.A_OpenCms openCms);
97      
98      /** Destroy this ResourceLoder */
99      public void destroy();
100         
101     /** Return a String describing the ResourceLoader */
102     public String getResourceLoaderInfo();
103             
104     /**
105      * Basic top-page processing method for a I_CmsResourceLoader,
106      * this method is called if the page is called as a sub-element 
107      * on a page not already loded with a I_CmsResourceLoader,
108      * which most often would be an I_CmsLauncher then.<p>
109      *
110      * @param cms the initialized CmsObject which provides user permissions
111      * @param file the requested OpenCms VFS resource
112      * @param req the original servlet request
113      * @param res the original servlet response
114      * 
115      * @throws ServletException might be thrown in the process of including the JSP 
116      * @throws IOException might be thrown in the process of including the JSP 
117      * 
118      * @see #service(CmsObject, CmsResource, ServletRequest, ServletResponse)
119      */
120     public void load(CmsObject cms, CmsFile file, HttpServletRequest req, HttpServletResponse res) 
121     throws ServletException, IOException;
122     
123     /**
124      * Does the job of including the requested resource, 
125      * this method is called directly if the element is 
126      * called as a sub-element from another I_CmsResourceLoader.<p>
127      * 
128      * @param cms used to access the OpenCms VFS
129      * @param file the reqested JSP file resource in the VFS
130      * @param req the current request
131      * @param res the current response
132      * 
133      * @throws ServletException might be thrown in the process of including the JSP 
134      * @throws IOException might be thrown in the process of including the JSP 
135      * 
136      * @see com.opencms.flex.cache.CmsFlexRequestDispatcher
137      */   
138     public void service(CmsObject cms, CmsResource file, ServletRequest req, ServletResponse res) 
139     throws ServletException, IOException;
140 }