APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.httpserver

pack-priv Class HttpContextImpl

extends HttpContext
Class Inheritance
Imports
java.util.*, java.lang.System.Logger, java.util.concurrent.ConcurrentHashMap, .CopyOnWriteArrayList, com.sun.net.httpserver.*

HttpContext represents a mapping between a protocol (http or https) together with a root URI path to a HttpHandler which is invoked to handle requests destined for the protocol/path on the associated HttpServer.

HttpContext instances are created by HttpServer#createContext(String, String, HttpHandler, Object)

Field Summary

Modifier and TypeField and Description
private final Map<String, Object>
private Authenticator
private final AuthFilter
private HttpHandler
private final String
private final String
private final ServerImpl
private final List<Filter>
private final List<Filter>

Constructor Summary

AccessConstructor and Description
pack-priv
HttpContextImpl(String protocol, String path, HttpHandler cb, ServerImpl server)

constructor is package private.

Method Summary

Modifier and TypeMethod and Description
public Map<String, Object>
getAttributes()

Implements abstract com.sun.net.httpserver.HttpContext.getAttributes.

returns a mutable Map, which can be used to pass configuration and other data to Filter modules and to the context's exchange handler.

public Authenticator
getAuthenticator()

Implements abstract com.sun.net.httpserver.HttpContext.getAuthenticator.

Returns the currently set Authenticator for this context if one exists.

public List<Filter>
getFilters()

Implements abstract com.sun.net.httpserver.HttpContext.getFilters.

Returns this context's List of filters.

public HttpHandler

Returns:

the HttpHandler for this context
getHandler
()

Implements abstract com.sun.net.httpserver.HttpContext.getHandler.

returns the handler for this context

pack-priv System.Logger
public String

Returns:

this context's path
getPath
()

Implements abstract com.sun.net.httpserver.HttpContext.getPath.

returns the path this context was created with

public String

Returns:

this context's path
getProtocol
()

returns the protocol this context was created with

public HttpServer

Returns:

this context's server
getServer
()

Implements abstract com.sun.net.httpserver.HttpContext.getServer.

returns the server this context was created with

pack-priv ServerImpl
pack-priv List<Filter>
public Authenticator
public void
setHandler(HttpHandler h)

Implements abstract com.sun.net.httpserver.HttpContext.setHandler.

Sets the handler for this context, if not already set.

Field Detail

attributesback to summary
private final Map<String, Object> attributes
authenticatorback to summary
private Authenticator authenticator
authfilterback to summary
private final AuthFilter authfilter
handlerback to summary
private HttpHandler handler
pathback to summary
private final String path
protocolback to summary
private final String protocol
serverback to summary
private final ServerImpl server
sfiltersback to summary
private final List<Filter> sfilters
ufiltersback to summary
private final List<Filter> ufilters

Constructor Detail

HttpContextImplback to summary
pack-priv HttpContextImpl(String protocol, String path, HttpHandler cb, ServerImpl server)

constructor is package private.

Method Detail

getAttributesback to summary
public Map<String, Object> getAttributes()

Implements abstract com.sun.net.httpserver.HttpContext.getAttributes.

returns a mutable Map, which can be used to pass configuration and other data to Filter modules and to the context's exchange handler.

Every attribute stored in this Map will be visible to every HttpExchange processed by this context

getAuthenticatorback to summary
public Authenticator getAuthenticator()

Implements abstract com.sun.net.httpserver.HttpContext.getAuthenticator.

Doc from com.sun.net.httpserver.HttpContext.getAuthenticator.

Returns the currently set Authenticator for this context if one exists.

getFiltersback to summary
public List<Filter> getFilters()

Implements abstract com.sun.net.httpserver.HttpContext.getFilters.

Doc from com.sun.net.httpserver.HttpContext.getFilters.

Returns this context's List of filters. This is the actual list used by the server when dispatching requests so modifications to this list immediately affect the handling of exchanges.

getHandlerback to summary
public HttpHandler getHandler()

Implements abstract com.sun.net.httpserver.HttpContext.getHandler.

returns the handler for this context

Returns:HttpHandler

the HttpHandler for this context

getLoggerback to summary
pack-priv System.Logger getLogger()
getPathback to summary
public String getPath()

Implements abstract com.sun.net.httpserver.HttpContext.getPath.

returns the path this context was created with

Returns:String

this context's path

getProtocolback to summary
public String getProtocol()

returns the protocol this context was created with

Returns:String

this context's path

getServerback to summary
public HttpServer getServer()

Implements abstract com.sun.net.httpserver.HttpContext.getServer.

returns the server this context was created with

Returns:HttpServer

this context's server

getServerImplback to summary
pack-priv ServerImpl getServerImpl()
getSystemFiltersback to summary
pack-priv List<Filter> getSystemFilters()
setAuthenticatorback to summary
public Authenticator setAuthenticator(Authenticator auth)

Implements abstract com.sun.net.httpserver.HttpContext.setAuthenticator.

Doc from com.sun.net.httpserver.HttpContext.setAuthenticator.

Sets the Authenticator for this HttpContext. 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.

setHandlerback to summary
public void setHandler(HttpHandler h)

Implements abstract com.sun.net.httpserver.HttpContext.setHandler.

Doc from com.sun.net.httpserver.HttpContext.setHandler.

Sets the handler for this context, if not already set.