java.lang.Object
com.sun.net.httpserver.HttpContext
HttpContext represents a mapping between the root URI
 path of an application to a HttpHandler which is invoked to handle
 requests destined for that path on the associated HttpServer or
 HttpsServer.
  HttpContext instances are created by the create methods in
 HttpServer and HttpsServer.
 
 A chain of Filter objects can be added to a HttpContext.
 All exchanges processed by the context can be pre- and post-processed by each
 Filter in the chain.
- Since:
- 1.6
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract AuthenticatorReturns the currently setAuthenticatorfor this context if one exists.abstract HttpHandlerReturns the handler for this context.abstract StringgetPath()Returns the path this context was created with.abstract HttpServerReturns the server this context was created with.abstract AuthenticatorSets theAuthenticatorfor thisHttpContext.abstract voidsetHandler(HttpHandler handler) Sets the handler for this context, if not already set.
- 
Constructor Details- 
HttpContextprotected HttpContext()Constructor for subclasses to call.
 
- 
- 
Method Details- 
getHandlerReturns the handler for this context.- Returns:
- the HttpHandlerfor this context
 
- 
setHandlerSets the handler for this context, if not already set.- Parameters:
- handler- the handler to set for this context
- Throws:
- IllegalArgumentException- if the context for this handler is already set.
- NullPointerException- if handler is- null
 
- 
getPathReturns the path this context was created with.- Returns:
- the context of this path
 
- 
getServerReturns the server this context was created with.- Returns:
- the context of this server
 
- 
getAttributesReturns a mutableMap, which can be used to pass configuration and other data toFiltermodules and to the context's exchange handler.Every attribute stored in this Mapwill be visible to everyHttpExchangeprocessed by this context.- Returns:
- a Mapcontaining the attributes of this context
 
- 
getFiltersReturns this context'sListof filters. This is the actual list used by the server when dispatching requests so modifications to this list immediately affect the handling of exchanges.- Returns:
- a Listcontaining the filters of this context
 
- 
setAuthenticatorSets theAuthenticatorfor thisHttpContext. Once an authenticator is established on a context, all client requests must be authenticated, and the given object will be invoked to validate each request. Each call to this method replaces any previous value set.- Parameters:
- auth- the- Authenticatorto set. If- nullthen any previously set- Authenticatoris removed, and client authentication will no longer be required.
- Returns:
- the previous Authenticator, if any set, ornullotherwise.
 
- 
getAuthenticatorReturns the currently setAuthenticatorfor this context if one exists.- Returns:
- this HttpContext's Authenticator, ornullif none is set
 
 
-