|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectHttpServlet
com.globalmentor.net.http.BasicHTTPServlet
com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>
com.globalmentor.net.http.DefaultHTTPServlet
com.guiseframework.platform.web.GuiseHTTPServlet
public class GuiseHTTPServlet
The servlet that controls a Guise web applications.
Each Guise session's platform will be locked during normal web page generation context will be active at one one time.
This implementation only works with Guise applications that descend from AbstractGuiseApplication.
For all ResourceReadDestinations, this servlet recognizes a query parameter named "guiseContentDisposition"
specifying the content disposition of the content to return; the value is the serialize version of a ContentDispositionType value.
| Nested Class Summary | |
|---|---|
protected static class |
GuiseHTTPServlet.CSSResource
A resource that represents a CSS file, decorating an existing resource. |
protected class |
GuiseHTTPServlet.DestinationResource
A resource that is accessed through a Guise session's resource destination. |
protected static class |
GuiseHTTPServlet.IE6CSSResource
A resource that represents an IE6 CSS file, decorating an existing resource. |
| Nested classes/interfaces inherited from class com.globalmentor.net.http.DefaultHTTPServlet |
|---|
com.globalmentor.net.http.DefaultHTTPServlet.AbstractByteCacheDecoratorResource, com.globalmentor.net.http.DefaultHTTPServlet.AbstractDescriptionResource, com.globalmentor.net.http.DefaultHTTPServlet.AbstractURLHTTPServletResource, com.globalmentor.net.http.DefaultHTTPServlet.DefaultHTTPServletResource, com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource |
| Field Summary | |
|---|---|
static java.lang.String |
APPLICATION_INIT_PARAMETER
The init parameter, "application", used to specify the relative path to the application description file. |
static java.lang.String |
DATA_APPLICATION_FILENAME
The name of the application configuration file in the data directory for supplemental application initialization. |
protected com.globalmentor.io.IOOperation<java.io.Writer> |
elffWriterInitializer
The initializer for initializing ELFF writers. |
protected com.globalmentor.io.IOOperation<java.io.Writer> |
elffWriterUninitializer
The uninitializer for uninitializing ELFF writers. |
static java.lang.String |
GUISE_CONTENT_DISPOSITION_URI_QUERY_PARAMETER
The URI query parameter indicating that the content disposition of the content of a ResourceReadDestination. |
static java.lang.String |
GUISE_ENVIRONMENT_INIT_PARAMETER_PREFIX
The init parameter prefix, "guise-environment:", used to indicate a Guise environment property. |
static java.lang.String |
GUISE_ENVIRONMENT_URI_INIT_PARAMETER_SUFFIX
The init parameter suffix, ".uri", used to indicate that a Guise environment property should be processed as a URI. |
static java.lang.String |
SEND_RESOURCE_VIEWPORT_ID
The ID of the viewport to use for sending resources. |
| Fields inherited from class com.globalmentor.net.http.AbstractHTTPServlet |
|---|
LIST_DIRECTORIES |
| Fields inherited from class com.globalmentor.net.http.BasicHTTPServlet |
|---|
LOG_HTTP_INIT_PARAMETER, LOG_LEVEL_INIT_PARAMETER, NONCE_EXPIRATION_DURATION |
| Constructor Summary | |
|---|---|
GuiseHTTPServlet()
Default constructor. |
|
| Method Summary | |
|---|---|
protected void |
authenticated(HttpServletRequest request,
java.net.URI resourceURI,
java.lang.String method,
java.lang.String requestURI,
java.security.Principal principal,
java.lang.String realm,
com.globalmentor.net.http.AuthenticateCredentials credentials,
boolean authenticated)
Called when a principal has went through authentication and indicates the result of authentication. |
protected void |
beginModalNavigation(GuiseApplication guiseApplication,
GuiseSession guiseSession,
ModalNavigation modalNavigation)
Begins modal navigation based upon modal navigation information. |
protected boolean |
canSubstitute(HttpServletRequest request,
java.net.URI requestedResourceURI,
java.net.URI substituteResourceURI)
Determines if another URI can be substituted for the requested URI. |
void |
destroy()
Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. |
void |
doGet(HttpServletRequest request,
HttpServletResponse response)
Services the GET method. |
void |
doPut(HttpServletRequest request,
HttpServletResponse response)
Services the PUT method. |
protected boolean |
exists(HttpServletRequest request,
java.net.URI resourceURI)
Determines if the resource at a given URI exists. |
static com.globalmentor.urf.ploop.PLOOPTURFIO<AbstractGuiseApplication> |
getApplicationIO()
|
protected void |
getComponentsByDepictName(Component component,
java.lang.String depictName,
java.util.Set<Component> componentSet)
Retrieves all descendant components, including the given component, that have a given depict name. |
com.globalmentor.text.elff.ELFF |
getELFF()
|
protected AbstractGuiseApplication |
getGuiseApplication()
|
protected HTTPServletGuiseContainer |
getGuiseContainer()
Returns the Guise container. |
protected char[] |
getPassword(java.security.Principal principal)
Looks up the corresponding password for the given principal. |
protected java.security.Principal |
getPrincipal(java.lang.String id)
Looks up a principal from the given ID. |
protected java.lang.String |
getRealm(java.net.URI resourceURI)
Determines the realm applicable for the resource indicated by the given URI. |
protected java.util.List<GuiseEvent> |
getRequestEvents(HTTPServletGuiseRequest guiseRequest,
GuiseSession guiseSession,
DepictContext depictContext)
Retrieves events from the HTTP request. |
protected com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource |
getResource(HttpServletRequest request,
java.net.URI resourceURI)
Determines the requested resource. |
void |
init(HttpServletRequest request)
Initializes the servlet upon receipt of the first request. |
void |
init(ServletConfig servletConfig)
Initializes the servlet. |
protected AbstractGuiseApplication |
initGuiseApplication(ServletConfig servletConfig)
Initializes bindings between paths and associated navigation frame classes. |
protected boolean |
isAuthorized(HttpServletRequest request,
java.net.URI resourceURI,
java.lang.String method,
java.security.Principal principal,
java.lang.String realm)
Checks whether the given principal is authorized to invoke the given method on the given resource. |
protected boolean |
isValid(HttpServletRequest request,
com.globalmentor.security.Nonce nonce)
Determines if the given nonce is valid. |
protected void |
redirect(HTTPServletGuiseRequest guiseRequest,
GuiseApplication guiseApplication,
RedirectDestination redirectDestination,
Bookmark bookmark)
Processes a redirect from a redirect destination. |
protected void |
redirect(HTTPServletGuiseRequest guiseRequest,
GuiseApplication guiseApplication,
java.net.URI redirectNavigationURI,
Bookmark bookmark,
boolean permanent)
Redirects to the given navigation path, preserving the given bookmark. |
protected void |
serveResource(HttpServletRequest request,
HttpServletResponse response,
com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource resource,
boolean serveContent)
Serves a resource that has been verified to exist This version sets the content description and content disposition of ResourceReadDestination. |
protected void |
synchronizeCookies(HttpServletRequest request,
HttpServletResponse response,
GuiseSession guiseSession)
Synchronizes the cookies in a request with the environment properties in a Guise session. |
| Methods inherited from class com.globalmentor.net.http.DefaultHTTPServlet |
|---|
createCollection, createResource, deleteResource, getChildResources, getContentLength, getContentType, getInputStream, getLastModifiedDate, getOutputStream, isCollection |
| Methods inherited from class com.globalmentor.net.http.AbstractHTTPServlet |
|---|
doDelete, doHead, doOptions, doPost, getAllowedMethods, getResourceURI, getResourceURI, getXML, isReadOnly, isRedirectSupported, serveResource, setReadOnly, setXML |
| Methods inherited from class com.globalmentor.net.http.BasicHTTPServlet |
|---|
checkAuthorization, checkAuthorization, createAuthenticateChallenge, createNonce, doMethod, getContextPath, getLogFile, getNonce, getNoncePrincipalID, getNoncePrivateKey, getPrincipal, getResourceContextAbsolutePath, getServletPath, isAuthenticated, isStale, service, setNoncePrincipalID, storeNonce |
| 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 APPLICATION_INIT_PARAMETER
public static final java.lang.String GUISE_ENVIRONMENT_INIT_PARAMETER_PREFIX
public static final java.lang.String GUISE_ENVIRONMENT_URI_INIT_PARAMETER_SUFFIX
public static final java.lang.String GUISE_CONTENT_DISPOSITION_URI_QUERY_PARAMETER
ResourceReadDestination.
The value will be the serialize version of a ContentDispositionType value.
public static final java.lang.String SEND_RESOURCE_VIEWPORT_ID
public static final java.lang.String DATA_APPLICATION_FILENAME
protected final com.globalmentor.io.IOOperation<java.io.Writer> elffWriterInitializer
Start-Date directive.
protected final com.globalmentor.io.IOOperation<java.io.Writer> elffWriterUninitializer
End-Date directive.
| Constructor Detail |
|---|
public GuiseHTTPServlet()
| Method Detail |
|---|
public static com.globalmentor.urf.ploop.PLOOPTURFIO<AbstractGuiseApplication> getApplicationIO()
protected HTTPServletGuiseContainer getGuiseContainer()
java.lang.IllegalStateException - if this method is called before any requests have been processed.protected AbstractGuiseApplication getGuiseApplication()
public com.globalmentor.text.elff.ELFF getELFF()
public void init(ServletConfig servletConfig)
throws ServletException
init in class com.globalmentor.net.http.BasicHTTPServletservletConfig - The servlet configuration.
ServletException - if there is a problem initializing.
protected AbstractGuiseApplication initGuiseApplication(ServletConfig servletConfig)
throws ServletException
servletConfig - The servlet configuration.
java.lang.IllegalArgumentException - if the one of the frame bindings is not expressed in correct format.
java.lang.IllegalArgumentException - if the one of the classes specified as a frame binding could not be found.
java.lang.IllegalArgumentException - if the one of the classes specified as a frame binding could not be found.
java.lang.ClassCastException - if the one of the classes specified as a frame binding does not represent a subclass of a frame component.
ServletException - if there is a problem initializing the application or frame bindings.Frame
public void init(HttpServletRequest request)
throws ServletException
init in class com.globalmentor.net.http.BasicHTTPServletrequest - The servlet request.
java.lang.IllegalStateException - if this servlet has already been initialized from a request.
ServletException - if there is a problem initializing.
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
java.io.IOException
doGet in class com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>request - The HTTP request.response - The HTTP response.
ServletException - if there is a problem servicing the request.
java.io.IOException - if there is an error reading or writing data.
public void doPut(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
java.io.IOException
doPut in class com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>request - The HTTP request.response - The HTTP response.
ServletException - if there is a problem servicing the request.
java.io.IOException - if there is an error reading or writing data.
protected void redirect(HTTPServletGuiseRequest guiseRequest,
GuiseApplication guiseApplication,
RedirectDestination redirectDestination,
Bookmark bookmark)
throws com.globalmentor.net.http.HTTPRedirectException
HTTPRedirectException will be thrown.
guiseRequest - The Guise request information.guiseApplication - The Guise application.redirectDestination - The destination indicating how and to where redirection should occur.bookmark - The requested bookmark, or null if no bookmark is requested
java.lang.IllegalArgumentException - if the referenced destination does not specify a path (instead specifying a path pattern, for example).
com.globalmentor.net.http.HTTPRedirectException - unconditionally to indicate how and to where redirection should occur.
protected void redirect(HTTPServletGuiseRequest guiseRequest,
GuiseApplication guiseApplication,
java.net.URI redirectNavigationURI,
Bookmark bookmark,
boolean permanent)
throws com.globalmentor.net.http.HTTPRedirectException
HTTPRedirectException will be thrown.
guiseRequest - The Guise request information.guiseApplication - The Guise application.redirectNavigationURI - The absolute or application-relative URI to which redirection should occur in navigation space.bookmark - The requested bookmark, or null if no bookmark is requestedpermanent - true if the redirect should be permanent.
com.globalmentor.net.http.HTTPRedirectException - unconditionally to indicate how and to where redirection should occur.
protected void synchronizeCookies(HttpServletRequest request,
HttpServletResponse response,
GuiseSession guiseSession)
request - The HTTP request.response - The HTTP response.guiseSession - The Guise session.
protected void serveResource(HttpServletRequest request,
HttpServletResponse response,
com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource resource,
boolean serveContent)
throws ServletException,
java.io.IOException
ResourceReadDestination.
If there is a query parameter named "guiseContentDisposition", the value will indicate the content disposition
through the use of the serialize version of a ContentDispositionType value. @param request The HTTP request.
serveResource in class com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>response - The HTTP response.resource - The resource being served.serveContent - true if the contents of the resource should be returned.request - The HTTP request.
java.lang.IllegalArgumentException - if the content disposition parameter, if any, is unrecognized.
ServletException - if there is a problem servicing the request.
java.io.IOException - if there is an error reading or writing data.GUISE_CONTENT_DISPOSITION_URI_QUERY_PARAMETER
protected void getComponentsByDepictName(Component component,
java.lang.String depictName,
java.util.Set<Component> componentSet)
component - The component to check, along with all descendants, for components with the given depict name.depictName - The name for which to check.componentSet - The set of components collecting the components with the given depict name.
java.lang.NullPointerException - if the given depict name is null.WebComponentDepictor.getDepictName()
protected java.util.List<GuiseEvent> getRequestEvents(HTTPServletGuiseRequest guiseRequest,
GuiseSession guiseSession,
DepictContext depictContext)
throws java.io.IOException
request - The HTTP request.guiseSession - The Guise session object.depictContext - The platform depict object.
java.io.IOException - if there is an error reading or writing data.
protected void beginModalNavigation(GuiseApplication guiseApplication,
GuiseSession guiseSession,
ModalNavigation modalNavigation)
guiseApplication - The Guise application.guiseSession - The Guise session.modalNavigation - The modal navigation informationpublic void destroy()
destroy in class com.globalmentor.net.http.BasicHTTPServlet
protected java.security.Principal getPrincipal(java.lang.String id)
throws com.globalmentor.net.http.HTTPInternalServerErrorException
getPrincipal in class com.globalmentor.net.http.BasicHTTPServletid - The ID of the principal.
null if no principal could be determined.
com.globalmentor.net.http.HTTPInternalServerErrorException - if there is an error getting the principal.
protected char[] getPassword(java.security.Principal principal)
throws com.globalmentor.net.http.HTTPInternalServerErrorException
getPassword in class com.globalmentor.net.http.BasicHTTPServletprincipal - The principal for which a password should be returned.
null if no password is associated with the given principal.
com.globalmentor.net.http.HTTPInternalServerErrorException - if there is an error getting the principal's password.
protected java.lang.String getRealm(java.net.URI resourceURI)
throws com.globalmentor.net.http.HTTPInternalServerErrorException
getRealm in class com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>resourceURI - The URI of the resource requested.
null if the given resource is not in a known realm.
com.globalmentor.net.http.HTTPInternalServerErrorException - if there is an error getting the realm.AbstractHTTPServlet.isReadOnly()
protected boolean isAuthorized(HttpServletRequest request,
java.net.URI resourceURI,
java.lang.String method,
java.security.Principal principal,
java.lang.String realm)
throws com.globalmentor.net.http.HTTPInternalServerErrorException
isAuthorized in class com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>request - The HTTP request.resourceURI - The URI of the resource requested.method - The HTTP method requested on the resource.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 perform the given method on the resource represented by the given URI.
com.globalmentor.net.http.HTTPInternalServerErrorException - if there is an error determining if the principal is authorized.AbstractHTTPServlet.isReadOnly()
protected boolean isValid(HttpServletRequest request,
com.globalmentor.security.Nonce nonce)
isValid in class com.globalmentor.net.http.BasicHTTPServletrequest - The HTTP request.nonce - The nonce to check for validity.
true if the nonce is not valid.BasicHTTPServlet.getNoncePrivateKey()
protected void authenticated(HttpServletRequest request,
java.net.URI resourceURI,
java.lang.String method,
java.lang.String requestURI,
java.security.Principal principal,
java.lang.String realm,
com.globalmentor.net.http.AuthenticateCredentials credentials,
boolean authenticated)
authenticated in class com.globalmentor.net.http.BasicHTTPServletrequest - The HTTP request.resourceURI - The URI of the resource requested.method - The HTTP method requested on the resource.requestURI - The request URI as given in the HTTP request.principal - The principal requesting authentication, or null if the principal is not known.realm - The realm for which the principal was authenticated.credentials - The principal's credentials, or null if no credentials are available.authenticated - true if the principal succeeded in authentication, else false.GuiseSession.setPrincipal(Principal)
protected boolean canSubstitute(HttpServletRequest request,
java.net.URI requestedResourceURI,
java.net.URI substituteResourceURI)
throws java.io.IOException
canSubstitute in class com.globalmentor.net.http.AbstractHTTPServlet<com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource>request - The HTTP request indicating the requested resource.requestedResourceURI - The requested absolute URI of the resource.substituteResourceURI - The URI to the URI which may be substited for the first URI.
true if the provided URI may be substitued for the requested URI.
java.io.IOException - if there is an error checking whether URI substitution can occur.
protected boolean exists(HttpServletRequest request,
java.net.URI resourceURI)
throws java.io.IOException
exists in class com.globalmentor.net.http.DefaultHTTPServletrequest - The HTTP request in response to which which existence of the resource is being determined.resourceURI - The URI of the requested resource.
true if the resource exists, else false.
java.io.IOException - if there is an error accessing the resource.GuiseApplication.hasAsset(URIPath),
GuiseApplication.hasDestination(URIPath)
protected com.globalmentor.net.http.DefaultHTTPServlet.HTTPServletResource getResource(HttpServletRequest request,
java.net.URI resourceURI)
throws java.lang.IllegalArgumentException,
java.io.IOException
getResource in class com.globalmentor.net.http.DefaultHTTPServletrequest - The HTTP request in response to which the resource is being retrieved.resourceURI - The URI of the requested resource.
java.lang.IllegalArgumentException - if the given resource URI does not represent a valid resource.
java.io.IOException - if there is an error accessing the resource.GuiseApplication.hasAsset(URIPath),
GuiseApplication.getInputStream(URIPath),
ResourceReadDestination
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||