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

public Class HttpsServerImpl

extends HttpsServer
Class Inheritance
Imports
java.net.*, java.io.*, java.util.concurrent.*, com.sun.net.httpserver.*

Field Summary

Modifier and TypeField and Description
pack-priv ServerImpl

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
bind(InetSocketAddress addr, int backlog)

Implements abstract com.sun.net.httpserver.HttpServer.bind.

Binds a currently unbound HttpServer to the given address and port number.

public HttpContextImpl
createContext(String path, HttpHandler handler)

Implements abstract com.sun.net.httpserver.HttpServer.createContext.

Creates a HttpContext.

public HttpContextImpl
createContext(String path)

Implements abstract com.sun.net.httpserver.HttpServer.createContext.

Creates a HttpContext without initially specifying a handler.

public InetSocketAddress
getAddress()

Implements abstract com.sun.net.httpserver.HttpServer.getAddress.

Returns the address this server is listening on

public Executor
getExecutor()

Implements abstract com.sun.net.httpserver.HttpServer.getExecutor.

Returns this server's Executor object if one was specified with setExecutor(Executor), or null if none was specified.

public HttpsConfigurator
getHttpsConfigurator()

Implements abstract com.sun.net.httpserver.HttpsServer.getHttpsConfigurator.

Gets this server's HttpsConfigurator object, if it has been set.

public void
removeContext(String path)

Implements abstract com.sun.net.httpserver.HttpServer.removeContext.

Removes the context identified by the given path from the server.

public void
removeContext(HttpContext context)

Implements abstract com.sun.net.httpserver.HttpServer.removeContext.

Removes the given context from the server.

public void
public void
public void
start()

Implements abstract com.sun.net.httpserver.HttpServer.start.

Starts this server in a new background thread.

public void
stop(int delay)

Implements abstract com.sun.net.httpserver.HttpServer.stop.

Stops this server by closing the listening socket and disallowing any new exchanges from being processed.

Inherited from com.sun.net.httpserver.HttpsServer:
createcreatecreate

Field Detail

serverback to summary
pack-priv ServerImpl server

Constructor Detail

HttpsServerImplback to summary
pack-priv HttpsServerImpl() throws IOException
HttpsServerImplback to summary
pack-priv HttpsServerImpl(InetSocketAddress addr, int backlog) throws IOException

Method Detail

bindback to summary
public void bind(InetSocketAddress addr, int backlog) throws IOException

Implements abstract com.sun.net.httpserver.HttpServer.bind.

Doc from com.sun.net.httpserver.HttpServer.bind.

Binds a currently unbound HttpServer to the given address and port number. A maximum backlog can also be specified. This is the maximum number of queued incoming connections to allow on the listening socket. Queued TCP connections exceeding this limit may be rejected by the TCP implementation.

createContextback to summary
public HttpContextImpl createContext(String path, HttpHandler handler)

Implements abstract com.sun.net.httpserver.HttpServer.createContext.

Doc from com.sun.net.httpserver.HttpServer.createContext.

Creates a HttpContext. A HttpContext represents a mapping from a URI path to a exchange handler on this HttpServer. Once created, all requests received by the server for the path will be handled by calling the given handler object. The context is identified by the path, and can later be removed from the server using this with the removeContext(String) method.

The path specifies the root URI path for this context. The first character of path must be '/'.

The class overview describes how incoming request URIs are mapped to HttpContext instances.

createContextback to summary
public HttpContextImpl createContext(String path)

Implements abstract com.sun.net.httpserver.HttpServer.createContext.

Doc from com.sun.net.httpserver.HttpServer.createContext.

Creates a HttpContext without initially specifying a handler. The handler must later be specified using HttpContext#setHandler(HttpHandler). A HttpContext represents a mapping from a URI path to an exchange handler on this HttpServer. Once created, and when the handler has been set, all requests received by the server for the path will be handled by calling the handler object. The context is identified by the path, and can later be removed from the server using this with the removeContext(String) method.

The path specifies the root URI path for this context. The first character of path must be '/'.

The class overview describes how incoming request URIs are mapped to HttpContext instances.

getAddressback to summary
public InetSocketAddress getAddress()

Implements abstract com.sun.net.httpserver.HttpServer.getAddress.

Doc from com.sun.net.httpserver.HttpServer.getAddress.

Returns the address this server is listening on

getExecutorback to summary
public Executor getExecutor()

Implements abstract com.sun.net.httpserver.HttpServer.getExecutor.

Doc from com.sun.net.httpserver.HttpServer.getExecutor.

Returns this server's Executor object if one was specified with setExecutor(Executor), or null if none was specified.

getHttpsConfiguratorback to summary
public HttpsConfigurator getHttpsConfigurator()

Implements abstract com.sun.net.httpserver.HttpsServer.getHttpsConfigurator.

Doc from com.sun.net.httpserver.HttpsServer.getHttpsConfigurator.

Gets this server's HttpsConfigurator object, if it has been set.

removeContextback to summary
public void removeContext(String path) throws IllegalArgumentException

Implements abstract com.sun.net.httpserver.HttpServer.removeContext.

Doc from com.sun.net.httpserver.HttpServer.removeContext.

Removes the context identified by the given path from the server. Removing a context does not affect exchanges currently being processed but prevents new ones from being accepted.

Exceptions
IllegalArgumentException:
if no handler corresponding to this path exists.
removeContextback to summary
public void removeContext(HttpContext context) throws IllegalArgumentException

Implements abstract com.sun.net.httpserver.HttpServer.removeContext.

Doc from com.sun.net.httpserver.HttpServer.removeContext.

Removes the given context from the server. Removing a context does not affect exchanges currently being processed but prevents new ones from being accepted.

setExecutorback to summary
public void setExecutor(Executor executor)

Implements abstract com.sun.net.httpserver.HttpServer.setExecutor.

Doc from com.sun.net.httpserver.HttpServer.setExecutor.

Sets this server's java.util.concurrent.Executor object. An Executor must be established before start() is called. All HTTP requests are handled in tasks given to the executor. If this method is not called (before start()) or if it is called with a null Executor, then a default implementation is used, which uses the thread which was created by the start() method.

setHttpsConfiguratorback to summary
public void setHttpsConfigurator(HttpsConfigurator config)

Implements abstract com.sun.net.httpserver.HttpsServer.setHttpsConfigurator.

Doc from com.sun.net.httpserver.HttpsServer.setHttpsConfigurator.

Sets this server's HttpsConfigurator object.

startback to summary
public void start()

Implements abstract com.sun.net.httpserver.HttpServer.start.

Doc from com.sun.net.httpserver.HttpServer.start.

Starts this server in a new background thread. The background thread inherits the priority, thread group and context class loader of the caller.

stopback to summary
public void stop(int delay)

Implements abstract com.sun.net.httpserver.HttpServer.stop.

Doc from com.sun.net.httpserver.HttpServer.stop.

Stops this server by closing the listening socket and disallowing any new exchanges from being processed. The method will then block until all current exchange handlers have completed or else when approximately delay seconds have elapsed (whichever happens sooner). Then, all open TCP connections are closed, the background thread created by start() exits, and the method returns. Once stopped, a HttpServer cannot be re-used.