| java.lang.Object com.lutris.appserver.server.httpPresentation.HttpPresentationManager
HttpPresentationManager | public class HttpPresentationManager (Code) | | Presentation manager class. Handles loading and execution of
presentation objects.
version: $Revision: 1.3 $ author: Mark Diekhans |
Constructor Summary | |
public | HttpPresentationManager(String appPresentationPrefix, Application presApplication, ClassLoader applicationClassLoader, boolean cacheClasses, boolean cacheFiles) Construct a HTTP presentation manager.
Parameters: appPresentationPrefix - Prefix added to the file name portionof the URL. |
HttpPresentationManager | public HttpPresentationManager(String appPresentationPrefix, Application presApplication, ClassLoader applicationClassLoader, boolean cacheClasses, boolean cacheFiles) throws HttpPresentationException(Code) | | Construct a HTTP presentation manager.
Parameters: appPresentationPrefix - Prefix added to the file name portionof the URL. The resulting names is used to search for classes andfiles on the class path. Parameters: presApplication - Application object that this presentation isassociated with. Parameters: applicationClassLoader - the class loader to use for the application. Parameters: cacheClasses - Enables or disables caching of presentation objectclasses in memory. Parameters: cacheFiles - Enables or disables caching of files (html, gif, etc)that are servered as part of the application. |
Run | public void Run(HttpPresentationRequest request, HttpPresentationResponse response) throws HttpPresentationException, IOException(Code) | | The method is invoked to fulfill an HTTP request. This function is
thread-safe and does not need synchronization. It is expected that the
protocol layer invoking this function provide multi-threading to handle
requests.
The alogrithm for handling a request is:
presObj = requestUrl
while request-not-handled {
if not error-handler-redirect
invoke-application-request-preprocessor presObj
load-presentation-object-class
invoke-presentation-object
if not error-handler-redirect
invoke-application-request-postprocessor presObj
if (client-side-page-redirect-exception) {
send-redirect-to-client
break
}
if (server-side-page-redirect-exception) {
(Not implemented yet)
set-request-to-redirectUrl
presObj = redirectUrl
continue
}
if (401-unauthorized-exception) {
set-header-and-response-code
break
}
if (other-exception) {
presObj = find-error-handler
}
}
Parameters: request - Request object for the protocol invoking the manager. Parameters: response - Response object for the protocol invoking the manager. exception: HttpPresentationException - All exceptions will be encapsulatedin an exception of this class. |
addMimeType | public void addMimeType(String mimeType, String extension)(Code) | | Add a new mime type to extension mapping.
|
flushCache | public void flushCache()(Code) | | Flush the presentation object and resource caches.
|
getAppClassLoader | public ClassLoader getAppClassLoader()(Code) | | Get the application class loader.
The application class loader. |
getAppFileAsStream | public InputStream getAppFileAsStream(String appFileName) throws IOException, HttpPresentationException(Code) | | Get a file associated with the application. The file is located
in the same manner as presentation objects are located. That is,
prepending the presentationPrefix to the specified
path and searching the class path for a directory or JAR containing
the file.
Parameters: appfileName - The file name relative to theto the application's presentationPrefix . An input stream associated with the file. exception: IOException - If the file can not be found or opened. |
getServlet | public Servlet getServlet()(Code) | | Get the servlet we are running in. Currently this class is only
used in a servlet (HttpPresentationServlet), so this value will
always be set. But in the future this class may be used in other
non-servlet enviornments, in which case this method will return
null.
The servlet we are running in, if any. |
getServletContext | public ServletContext getServletContext()(Code) | | Get the servlet context used to initialize the servlet we are running
in. Currently this class is only used in a servlet
(HttpPresentationServlet), so this value will always be set. But in
the future this class may be used in other non-servlet enviornments,
in which case this method will return null.
The servlet context used to initialize the servlet we arerunning in, if any. |
getSession | public Session getSession(ServletRequest request)(Code) | | Looks up the session object (if any) that would be used to
process the request. This is will not used normally, because the
session is give to the application's preprocessor method and the
presentation objects. Also, it is not normal to have a raw
ServletRequest. The debugger uses this to examine the session data
before and after each request. Consider this an internal use onlyu
method.
Parameters: request - The (raw) request that would be sent in to this application.The session object that would be associated with the request.Returns null if none is found; a new session is not created. |
isPOCacheEnabled | public boolean isPOCacheEnabled()(Code) | | Determine if the PO cache is enabled.
true is the cache is enabled. |
isPresentationRequest | public boolean isPresentationRequest(HttpPresentationRequest request) throws HttpPresentationException(Code) | | Determine if a request URL references a presentation object.
Parameters: request - The request for the presentation. true if the URL has a presentation object MIME type. |
isResourceCacheEnabled | public boolean isResourceCacheEnabled()(Code) | | Determine if the file resource class cache is enabled.
true is the cache is enabled. |
setServletAndContext | public void setServletAndContext(Servlet servlet, ServletContext servletContext)(Code) | | Notify the presentation manager which servlet we are running in.
This will be done immediatly after this object is created, if
this ojbject is created by an HttpPresentationServlet (currently
the only creator). In the future, if this class is used in non-servlet
situations, this need not be called.
Parameters: servlet - The servlet we are running in. Parameters: servletContext - The ServletContext used to initialize the servlet we are running in. |
sizeofPOCache | public int sizeofPOCache()(Code) | | Return the number of entries in the PO cache.
the number of entries in the cache or 0 is disabled. |
sizeofResourceCache | public int sizeofResourceCache()(Code) | | Return the number of entries in the resource cache.
the number of entries in the cache or 0 is disabled. |
|
|