List of usage examples for org.apache.http.impl.nio NHttpConnectionBase getContext
public HttpContext getContext()
From source file:org.opcfoundation.ua.transport.https.HttpsServer.java
public HttpsServer(Application application) throws ServiceResultException { super(CloseableObjectState.Closed, CloseableObjectState.Closed); this.application = application; this.ioConfig = new IOReactorConfig(); this.securityPolicies = application.getHttpsSettings().getHttpsSecurityPolicies(); // Disable Nagle's ioConfig.setTcpNoDelay(false);/*from w ww.j a va2s . c o m*/ HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] { // Use standard server-side protocol interceptors new ResponseDate(), new ResponseServer(), new ResponseContent(), new ResponseConnControl() }); // Create request handler registry registry = new RequestResolver(); // Register the default handler for all URIs final Map<NHttpServerConnection, HttpsServerConnection> connMap = Collections .synchronizedMap(new HashMap<NHttpServerConnection, HttpsServerConnection>()); // Create connection re-use strategy connectionReuseStrategy = new DefaultConnectionReuseStrategy(); // Create server-side HTTP protocol handler protocolHandler = new HttpAsyncService(httpproc, connectionReuseStrategy, registry, getHttpParams()) { @Override public void connected(final NHttpServerConnection conn) { NHttpConnectionBase conn2 = (NHttpConnectionBase) conn; log.info("connected: {} {}<-> {} context={} socketTimeout={}", HttpsServer.this.getBoundSocketAddresses(), conn2.getLocalAddress(), conn2.getRemoteAddress(), conn2.getContext(), conn2.getSocketTimeout()); HttpsServerConnection httpsConnection = new HttpsServerConnection(HttpsServer.this, conn); connMap.put(conn, httpsConnection); connections.addConnection(httpsConnection); super.connected(conn); } @Override public void closed(final NHttpServerConnection conn) { NHttpConnectionBase conn2 = (NHttpConnectionBase) conn; log.info("closed: {} {}<-> {} context={} socketTimeout={}", HttpsServer.this.getBoundSocketAddresses(), conn2.getLocalAddress(), conn2.getRemoteAddress(), conn2.getContext(), conn2.getSocketTimeout()); HttpsServerConnection conn3 = connMap.remove(conn); connections.removeConnection(conn3); super.closed(conn); } }; // Create a service server for connections that query endpoints (url = "") discoveryServer = new Server(application); discoveryServer.setEndpointBindings(endpointBindings); EndpointBinding discoveryBinding = new EndpointBinding(this, discoveryEndpoint, discoveryServer); discoveryHandler = new HttpsServerEndpointHandler(discoveryBinding); }