|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.guiseframework.AbstractGuiseContainer
com.guiseframework.platform.web.HTTPServletGuiseContainer
public class HTTPServletGuiseContainer
A Guise container for Guise HTTP servlets.
There will be one servlet Guise container per ServletContext, which usually corresponds to a single web application on a JVM.
| Nested Class Summary | |
|---|---|
protected static class |
HTTPServletGuiseContainer.GuiseApplicationHTTPSessionKey
A key suitable for a hash map made up of a Guise application and an HTTP session. |
| Field Summary | |
|---|---|
static java.lang.String |
RESOURCES_DIRECTORY_PATH
The absolute path, relative to the servlet context, of the resources directory. |
| Constructor Summary | |
|---|---|
HTTPServletGuiseContainer(java.net.URI baseURI,
ServletContext servletContext)
Servlet contains and container base URI constructor. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
getContextAbsoluteResourcePath(java.lang.String containerRelativeResourcePath)
Determines the servlet context-relative absolute path of the given container-relative path. |
static HTTPServletGuiseContainer |
getGuiseContainer(ServletContext servletContext,
java.net.URI baseURI)
Retrieves the Guise container associated with the given servlet context. |
protected GuiseSession |
getGuiseSession(GuiseApplication guiseApplication,
HttpServletRequest httpRequest,
HttpSession httpSession)
Retrieves a Guise session for the given HTTP session. |
java.io.InputStream |
getInputStream(java.net.URI uri)
Retrieves an input stream to the entity at the given URI. |
protected char[] |
getPassword(AbstractGuiseApplication application,
java.security.Principal principal)
Looks up the corresponding password for the given principal. |
protected java.security.Principal |
getPrincipal(AbstractGuiseApplication application,
java.lang.String id)
Looks up an application principal from the given ID. |
protected java.lang.String |
getRealm(AbstractGuiseApplication application,
java.net.URI resourceURI)
Determines the realm applicable for the resource indicated by the given URI. |
protected java.io.InputStream |
getResourceInputStream(java.lang.String resourcePath)
Retrieves an input stream to the resource at the given path. |
protected ServletContext |
getServletContext()
|
protected boolean |
hasResource(java.lang.String resourcePath)
Determines if the container has a resource available stored at the given resource path. |
protected void |
installApplication(AbstractGuiseApplication application,
java.net.URI baseURI,
java.io.File homeDirectory,
java.io.File logDirectory,
java.io.File tempDirectory)
Installs the given application at the given context path. |
protected boolean |
isAuthorized(AbstractGuiseApplication application,
java.net.URI resourceURI,
java.security.Principal principal,
java.lang.String realm)
Checks whether the given principal is authorized to access the resouce at the given application path. |
protected java.util.Set<GuiseSession> |
removeGuiseSessions(HttpSession httpSession)
Removes the Guise sessions for the given HTTP session. |
protected void |
uninstallApplication(AbstractGuiseApplication application)
Uninstalls the given application. |
| Methods inherited from class com.guiseframework.AbstractGuiseContainer |
|---|
addGuiseSession, getBasePath, getBaseURI, removeGuiseSession, resolvePath, resolveURI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String RESOURCES_DIRECTORY_PATH
| Constructor Detail |
|---|
public HTTPServletGuiseContainer(java.net.URI baseURI,
ServletContext servletContext)
baseURI - The base URI of the container, an absolute URI that ends with the base path, which ends with a slash ('/'), indicating the base path of the application base paths.servletContext - The servlet context with which this container is associated.
java.lang.NullPointerException - if the base URI and/or servlet context is null.
java.lang.IllegalArgumentException - if the base URI is not absolute or does not end with a slash ('/') character.| Method Detail |
|---|
public static HTTPServletGuiseContainer getGuiseContainer(ServletContext servletContext,
java.net.URI baseURI)
servletContext - The servlet context with which this container is associated.baseURI - The base URI of the container, an absolute URI that ends with the base path, which ends with a slash ('/'), indicating the base path of the application base paths.
java.lang.NullPointerException - if the servlet context and/or base URI is null.
java.lang.IllegalArgumentException - if the base URI is not absolute or does not end with a slash ('/') character.protected final ServletContext getServletContext()
protected void installApplication(AbstractGuiseApplication application,
java.net.URI baseURI,
java.io.File homeDirectory,
java.io.File logDirectory,
java.io.File tempDirectory)
throws java.io.IOException
installApplication in class AbstractGuiseContainerbaseURI - The base URI at which the application is being installed.homeDirectory - The home directory of the application.logDirectory - The log directory of the application.tempDirectory - The temporary directory of the application.application - The application to install.
java.lang.NullPointerException - if the application, base URI, home directory, log directory, and/or temprary directory is null.
java.lang.IllegalArgumentException - if the given base URI is not absolute or the path of which is not absolute or not a collection.
java.lang.IllegalStateException - if the application is already installed in some container.
java.lang.IllegalStateException - if there is already an application installed in this container at the given context path.
java.io.IOException - if there is an I/O error when installing the application.protected void uninstallApplication(AbstractGuiseApplication application)
uninstallApplication in class AbstractGuiseContainerapplication - The application to uninstall.
java.lang.NullPointerException - if the application is null.
java.lang.IllegalStateException - if the application is not installed in this container.
protected GuiseSession getGuiseSession(GuiseApplication guiseApplication,
HttpServletRequest httpRequest,
HttpSession httpSession)
guiseApplication - The Guise application that will own the Guise session.httpRequest - The HTTP request with which the Guise session is associated.httpSession - The HTTP session for which a Guise session should be retrieved.
HTTPServletGuiseSessionManagerprotected java.util.Set<GuiseSession> removeGuiseSessions(HttpSession httpSession)
httpSession - The HTTP session which should be removed along with its corresponding Guise session.
HTTPServletGuiseSessionManagerprotected boolean hasResource(java.lang.String resourcePath)
hasResource in class AbstractGuiseContainerresourcePath - A container-relative path to a resource in the resource storage area.
true if a resource exists at the given resource path.
java.lang.IllegalArgumentException - if the given resource path is absolute.
java.lang.IllegalArgumentException - if the given path is not a valid path.protected java.io.InputStream getResourceInputStream(java.lang.String resourcePath)
getResourceInputStream in class AbstractGuiseContainerresourcePath - A container-relative path to a resource in the resource storage area.
null if no resource exists at the given resource path.
java.lang.IllegalArgumentException - if the given resource path is absolute.
public java.io.InputStream getInputStream(java.net.URI uri)
throws java.io.IOException
getInputStream in interface GuiseContainergetInputStream in class AbstractGuiseContaineruri - A URI to the entity; either absolute or relative to the container.
null if no entity exists at the given resource path.
java.lang.NullPointerException - if the given URI is null.
java.io.IOException - if there was an error connecting to the entity at the given URI.AbstractGuiseContainer.getBaseURI()protected java.lang.String getContextAbsoluteResourcePath(java.lang.String containerRelativeResourcePath)
containerRelativeResourcePath - A container-relative path to a resource in the resource storage area.
java.lang.IllegalArgumentException - if the given resource path is absolute.
protected java.security.Principal getPrincipal(AbstractGuiseApplication application,
java.lang.String id)
getPrincipal in class AbstractGuiseContainerapplication - The application for which a principal should be returned for the given ID.id - The ID of the principal.
null if no principal could be determined.
protected char[] getPassword(AbstractGuiseApplication application,
java.security.Principal principal)
getPassword in class AbstractGuiseContainerapplication - The application for which a password should e retrieved for the given principal.principal - The principal for which a password should be returned.
null if no password is associated with the given principal.
protected java.lang.String getRealm(AbstractGuiseApplication application,
java.net.URI resourceURI)
getRealm in class AbstractGuiseContainerapplication - The application for a realm should be returned for the given resouce URI.resourceURI - The URI of the resource requested.
null if the given resource is not in a known realm.GuiseApplication.relativizeURI(URI)
protected boolean isAuthorized(AbstractGuiseApplication application,
java.net.URI resourceURI,
java.security.Principal principal,
java.lang.String realm)
isAuthorized in class AbstractGuiseContainerapplication - The application for which a principal should be authorized for a given resouce URI.resourceURI - The URI of the resource requested.principal - The principal requesting authentication, or null if the principal is not known.realm - The realm with which the resource is associated, or null if the realm is not known.
true if the given principal is authorized to access the resource represented by the given resource URI.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||