Java 类org.apache.http.protocol.ResponseDate 实例源码
项目:sbc-qsystem
文件:QSystemHtmlInstance.java
private QSystemHtmlInstance() {
this.params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000).
setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024).
setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).
setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).
setParameter(CoreProtocolPNames.ORIGIN_SERVER, "QSystemReportHttpServer/1.1");
// Set up the HTTP protocol processor
final BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
// Set up request handlers
final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpQSystemReportsHandler());
// Set up the HTTP service
this.httpService = new HttpService(
httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory(), reqistry, this.params);
}
项目:yaacc-code
文件:YaaccUpnpServerService.java
public RequestListenerThread(Context context) throws IOException, BindException {
serversocket = new ServerSocket(PORT);
params = new BasicHttpParams();
params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
httpProcessor.addInterceptor(new ResponseDate());
httpProcessor.addInterceptor(new ResponseServer());
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
// Set up the HTTP service
this.httpService = new YaaccHttpService(httpProcessor, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory(), context);
}
项目:dsworkbench
文件:ReportServer.java
public RequestListenerThread(int port, final String docroot) throws IOException {
this.serversocket = new ServerSocket(port);
this.params = new SyncBasicHttpParams();
this.params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024).setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[]{
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpFileHandler());
// Set up the HTTP service
this.httpService = new HttpService(
httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory(),
reqistry,
this.params);
}
项目:gondola
文件:LocalTestServer.java
public LocalTestServer(HttpRequestHandler handler) {
try {
setUp();
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer(LocalServerTestBase.ORIGIN))
.add(new ResponseContent())
.add(new ResponseConnControl())
.add(new RequestBasicAuth())
.add(new ResponseBasicUnauthorized()).build();
this.serverBootstrap.setHttpProcessor(httpproc);
this.serverBootstrap.registerHandler("*", handler);
host = start();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:DroidDLNA
文件:HttpServerConnectionUpnpStream.java
protected HttpServerConnectionUpnpStream(ProtocolFactory protocolFactory,
HttpServerConnection connection,
final HttpParams params) {
super(protocolFactory);
this.connection = connection;
this.params = params;
// The Date header is recommended in UDA, need to document the requirement in StreamServer interface?
httpProcessor.addInterceptor(new ResponseDate());
// The Server header is only required for Control so callers have to add it to UPnPMessage
// httpProcessor.addInterceptor(new ResponseServer());
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
httpService =
new UpnpHttpService(
httpProcessor,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory()
);
httpService.setParams(params);
}
项目:dlna-for-android
文件:HttpServer.java
public ListenerThread(InetAddress address, int port, HttpParams params,
HttpRequestHandlerRegistry handlerRegistry) throws IOException {
this.params = params;
this.serverSocket = new ServerSocket(port, 0, address);
BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
this.httpService = new HttpService(httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory());
this.httpService.setParams(params);
this.httpService.setHandlerResolver(handlerRegistry);
}
项目:Cherry
文件:WebEngine.java
private HttpProcessor getHttpProcessor() {
if (null == _httpProcessor) {
final HttpProcessorBuilder httpProcessorBuilder = HttpProcessorBuilder.create();
httpProcessorBuilder.add(new ResponseDate());
httpProcessorBuilder.add(new ResponseServer(getOriginServer()));
httpProcessorBuilder.add(new ResponseContent());
httpProcessorBuilder.add(new ResponseConnControl());
httpProcessorBuilder.add(getRequestInterceptorService());
httpProcessorBuilder.add(getResponseInterceptorService());
_httpProcessor = httpProcessorBuilder.build();
}
return _httpProcessor;
}
项目:nio-benchmark
文件:AsyncServer.java
public void start() throws Exception {
// Create HTTP protocol basic processing chain
HttpProcessor httpProcessor = HttpProcessorBuilder.create()
.add(new ResponseDate()).add(new ResponseContent())
.add(new ResponseConnControl()).build();
// Create server
HttpAsyncService protocolHandler = new HttpAsyncService(httpProcessor,
uriMapper);
NHttpConnectionFactory<DefaultNHttpServerConnection> connFactory = new DefaultNHttpServerConnectionFactory();
IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(
protocolHandler, connFactory);
IOReactorConfig config = IOReactorConfig.custom()
.setIoThreadCount(threads).setSoReuseAddress(true).build();
ListeningIOReactor ioReactor = new DefaultListeningIOReactor(config);
// Start server
ioReactor.listen(new InetSocketAddress(port));
ioReactor.execute(ioEventDispatch);
}
项目:haogrgr-test
文件:HttpSrvMain.java
public static void main(String[] args) throws Exception {
int port = 8080;
String docRoot = "D:\\svn_file\\TEST2\\150503\\web-customer";
// Set up the HTTP protocol processor
HttpProcessor httpproc = HttpProcessorBuilder.create().add(new ResponseDate())
.add(new ResponseServer("Haogrgr/1.1")).add(new ResponseContent())
.add(new ResponseConnControl()).build();
// Set up request handlers
UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
reqistry.register("*", new HttpFileHandler(docRoot));
// Set up the HTTP service
HttpService httpService = new HttpService(httpproc, reqistry);
Thread t = new RequestListenerThread(port, httpService, null);
t.setDaemon(false);
t.start();
}
项目:gen-server-http-listener
文件:RequestListenerThread.java
/**
* Default constructor which specifies the <code>port</code> to listen to
* for requests and the <code>handlers</code>, which specify how to handle
* the request.
*
* @param port
* the port to listen to
* @param handlers
* the handlers, which specify how to handle the different
* requests
*
* @throws IOException
* if some IO operation fails
*/
public RequestListenerThread(final int port,
final Map<String, IHandler> handlers) throws IOException {
super(port);
// Set up the HTTP protocol processor
final HttpProcessor httpproc = new ImmutableHttpProcessor(
new HttpResponseInterceptor[] { new ResponseDate(),
new ResponseServer(), new ResponseContent(),
new ResponseConnControl() });
// Set up request handlers
UriHttpRequestHandlerMapper registry = new UriHttpRequestHandlerMapper();
for (final Entry<String, IHandler> entry : handlers.entrySet()) {
registry.register(entry.getKey(), entry.getValue());
}
// Set up the HTTP service
httpService = new HttpService(httpproc, registry);
connFactory = DefaultBHttpServerConnectionFactory.INSTANCE;
}
项目:outcomes
文件:TestHttpCore.java
@Test
public void test() throws ExecutionException, InterruptedException {
HttpHost target = new HttpHost("localhost");
BasicConnPool connpool = new BasicConnPool();
connpool.setMaxTotal(200);
connpool.setDefaultMaxPerRoute(10);
connpool.setMaxPerRoute(target, 20);
Future<BasicPoolEntry> future = connpool.lease(target, null);
BasicPoolEntry poolEntry = future.get();
HttpClientConnection conn = poolEntry.getConnection();
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer("MyServer-HTTP/1.1"))
.add(new ResponseContent())
.add(new ResponseConnControl())
.build();
HttpRequestHandler myRequestHandler = new HttpRequestHandler() {
public void handle(
HttpRequest request,
HttpResponse response,
HttpContext context) throws HttpException, IOException {
response.setStatusCode(HttpStatus.SC_OK);
response.setEntity(
new StringEntity("some important message",
ContentType.TEXT_PLAIN));
}
};
UriHttpRequestHandlerMapper handlerMapper = new UriHttpRequestHandlerMapper();
handlerMapper.register("/service/*", myRequestHandler);
HttpService httpService = new HttpService(httpproc, handlerMapper);
}
项目:PhET
文件:ElementalHttpServer.java
public RequestListenerThread(int port, final String docroot) throws IOException {
this.serversocket = new ServerSocket(port);
this.params = new SyncBasicHttpParams();
this.params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpFileHandler(docroot));
// Set up the HTTP service
this.httpService = new HttpService(
httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory(),
reqistry,
this.params);
}
项目:cosmic
文件:ApiServer.java
public ListenerThread(final ApiServer requestHandler, final int port) {
try {
_serverSocket = new ServerSocket(port);
} catch (final IOException ioex) {
s_logger.error("error initializing api server", ioex);
return;
}
_params = new BasicHttpParams();
_params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
final BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
// Set up request handlers
final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", requestHandler);
// Set up the HTTP service
_httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
_httpService.setParams(_params);
_httpService.setHandlerResolver(reqistry);
}
项目:cosmic
文件:ClusterServiceServletContainer.java
public ListenerThread(final HttpRequestHandler requestHandler, final int port) {
_executor = Executors.newCachedThreadPool(new NamedThreadFactory("Cluster-Listener"));
try {
_serverSocket = new ServerSocket(port);
} catch (final IOException ioex) {
s_logger.error("error initializing cluster service servlet container", ioex);
return;
}
_params = new BasicHttpParams();
_params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
final BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
// Set up request handlers
final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("/clusterservice", requestHandler);
// Set up the HTTP service
_httpService = new HttpService(httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
_httpService.setParams(_params);
_httpService.setHandlerResolver(reqistry);
}
项目:java-binrepo-proxy
文件:ElementalReverseProxy.java
public RequestListenerThread(final int port, final HttpHost target) throws IOException {
this.target = target;
this.serversocket = new ServerSocket(port);
// Set up HTTP protocol processor for incoming connections
final HttpProcessor inhttpproc = new ImmutableHttpProcessor(
new HttpRequestInterceptor[] {
new RequestContent(),
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent("Test/1.1"),
new RequestExpectContinue(true)
});
// Set up HTTP protocol processor for outgoing connections
final HttpProcessor outhttpproc = new ImmutableHttpProcessor(
new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer("Test/1.1"),
new ResponseContent(),
new ResponseConnControl()
});
// Set up outgoing request executor
final HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
// Set up incoming request handler
final UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
reqistry.register("*", new ProxyHandler(
this.target,
outhttpproc,
httpexecutor));
// Set up the HTTP service
this.httpService = new HttpService(inhttpproc, reqistry);
}
项目:java-binrepo-proxy
文件:HttpCoreTransportServer.java
public RequestListenerThread(final int port, final HttpHost target, final TransportHandler handler) throws IOException {
this.target = target;
this.serversocket = new ServerSocket(port);
// Set up HTTP protocol processor for incoming connections
final HttpProcessor inhttpproc = new ImmutableHttpProcessor(
new HttpRequestInterceptor[] {
new RequestContent(),
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent("Test/1.1"),
new RequestExpectContinue(true)
});
// Set up HTTP protocol processor for outgoing connections
final HttpProcessor outhttpproc = new ImmutableHttpProcessor(
new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer("Test/1.1"),
new ResponseContent(),
new ResponseConnControl()
});
// Set up outgoing request executor
final HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
// Set up incoming request handler
final UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
reqistry.register("*", new ProxyHandler(
this.target,
outhttpproc,
httpexecutor,
handler));
// Set up the HTTP service
this.httpService = new HttpService(inhttpproc, reqistry);
}
项目:Camel
文件:HttpTestServer.java
/**
* Obtains an HTTP protocol processor with default interceptors.
*
* @return a protocol processor for server-side use
*/
protected HttpProcessor newProcessor() {
return new ImmutableHttpProcessor(new HttpResponseInterceptor[] {new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()});
}
项目:purecloud-iot
文件:TestClientAuthentication.java
@Before @Override
public void setUp() throws Exception {
super.setUp();
final HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer(LocalServerTestBase.ORIGIN))
.add(new ResponseContent())
.add(new ResponseConnControl())
.add(new RequestBasicAuth())
.add(new ResponseBasicUnauthorized()).build();
this.serverBootstrap.setHttpProcessor(httpproc);
}
项目:purecloud-iot
文件:TestClientAuthentication.java
@Test
public void testBasicAuthenticationSuccessOnNonRepeatablePutExpectContinue() throws Exception {
final HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer(LocalServerTestBase.ORIGIN))
.add(new ResponseContent())
.add(new ResponseConnControl())
.add(new RequestBasicAuth())
.add(new ResponseBasicUnauthorized()).build();
this.serverBootstrap.setHttpProcessor(httpproc)
.setExpectationVerifier(new AuthExpectationVerifier())
.registerHandler("*", new AuthHandler());
final HttpHost target = start();
final RequestConfig config = RequestConfig.custom()
.setExpectContinueEnabled(true)
.build();
final HttpPut httpput = new HttpPut("/");
httpput.setConfig(config);
httpput.setEntity(new InputStreamEntity(
new ByteArrayInputStream(
new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } ),
-1));
final HttpClientContext context = HttpClientContext.create();
final TestCredentialsProvider credsProvider = new TestCredentialsProvider(
new UsernamePasswordCredentials("test", "test"));
context.setCredentialsProvider(credsProvider);
final HttpResponse response = this.httpclient.execute(target, httpput, context);
final HttpEntity entity = response.getEntity();
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
Assert.assertNotNull(entity);
}
项目:purecloud-iot
文件:TestClientReauthentication.java
@Before @Override
public void setUp() throws Exception {
super.setUp();
final HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer(LocalServerTestBase.ORIGIN))
.add(new ResponseContent())
.add(new ResponseConnControl())
.add(new RequestBasicAuth())
.add(new ResponseBasicUnauthorized()).build();
this.serverBootstrap.setHttpProcessor(httpproc);
}
项目:purecloud-iot
文件:TestClientAuthenticationFallBack.java
@Before @Override
public void setUp() throws Exception {
super.setUp();
final HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer(LocalServerTestBase.ORIGIN))
.add(new ResponseContent())
.add(new ResponseConnControl())
.add(new RequestBasicAuth())
.add(new ResponseBasicUnauthorized()).build();
this.serverBootstrap.setHttpProcessor(httpproc);
}
项目:openxds
文件:IheHttpFactory.java
public HttpProcessor newHttpProcessor() {
BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
httpProcessor.addInterceptor(new RequestSessionCookie());
httpProcessor.addInterceptor(new ResponseDate());
httpProcessor.addInterceptor(new ResponseServer());
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
httpProcessor.addInterceptor(new ResponseSessionCookie());
return httpProcessor;
}
项目:hssd
文件:RequestListenerThread.java
public RequestListenerThread(int port, String docRoot)
throws IOException {
this.docRoot = docRoot;
this.serversocket = new ServerSocket(port);
this.params = new SyncBasicHttpParams();
this.params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
HttpProcessor httpproc = new ImmutableHttpProcessor(
new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpFileHandler(docRoot));
// Set up the HTTP service
this.httpService = new HttpService(
httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory(),
reqistry,
this.params);
this.serversocket.setSoTimeout(3000);
}
项目:Blackhole
文件:WebServer.java
public WebServer(Context context){
super(SERVER_NAME);
this.setContext(context);
serverPort = WebServer.DEFAULT_SERVER_PORT;
httpproc = new BasicHttpProcessor();
httpContext = new BasicHttpContext();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
httpService = new HttpService(httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory());
registry = new HttpRequestHandlerRegistry();
registry.register(ALL_PATTERN, new AssetHandler(context));
registry.register(HOME_PATTERN, new ListingHandler(context));
registry.register(NONE_PATTERN, new ListingHandler(context));
registry.register(DIR_PATTERN, new ListingHandler(context));
registry.register(FILE_PATTERN, new FileHandler(context));
registry.register(GETAPK_PATTERN, new GetApkHandler(context));
registry.register(UPLOAD_PATTERN, new UploadHandler(context));
registry.register(DOWNLOAD_ALL_PATTERN, new DownloadAllHandler(context));
httpService.setHandlerResolver(registry);
}
项目:oap
文件:NioServer.java
@SneakyThrows
public NioServer( int port, int workers ) {
this.port = port;
this.mapper.register( "/static/*", new NioClasspathResourceHandler( "/static", "/WEB-INF" ) );
val ioReactorConfig = IOReactorConfig.custom().setIoThreadCount( workers ).build();
val httpProcessor = HttpProcessorBuilder.create()
.add( new ResponseDate() )
.add( new ResponseServer( "OAP Server/1.0" ) )
.add( new ResponseContent() )
.add( new ResponseConnControl() )
.build();
SSLContext sslContext = getSslContext( port );
server = ServerBootstrap.bootstrap()
.setListenerPort( port )
.setServerInfo( "OAP Server/1.0" )
.setConnectionReuseStrategy( DefaultClientConnectionReuseStrategy.INSTANCE )
.setHttpProcessor( httpProcessor )
.setIOReactorConfig( ioReactorConfig )
.setSslContext( sslContext )
.setExceptionLogger( ex -> log.debug( ex.getMessage(), ex ) )
.setHandlerMapper( mapper )
.create();
}
项目:OpsDev
文件:ElementalHttpServer.java
public static void startServer(int port) {
// 设置端口号 后期需要对端口号进行判断是否已经被占用,并把端口号信息写进模板中
isRun = true;
// Set up the HTTP protocol processor
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer("Test/1.1"))
.add(new ResponseContent())
.add(new ResponseConnControl()).build();
// Set up request handlers
UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
reqistry.register("*", new HttpFileHandler(null));
// Set up the HTTP service
httpService = new HttpService(httpproc, reqistry);
SSLServerSocketFactory sf = null;
try {
t = new RequestListenerThread(port, httpService, sf);
} catch (IOException e) {
e.printStackTrace();
}
t.setDaemon(true);
t.start();
}
项目:wso2-axis2
文件:HttpFactory.java
public HttpProcessor newHttpProcessor() {
BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
httpProcessor.addInterceptor(new RequestSessionCookie());
httpProcessor.addInterceptor(new ResponseDate());
httpProcessor.addInterceptor(new ResponseServer());
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
httpProcessor.addInterceptor(new ResponseSessionCookie());
return httpProcessor;
}
项目:cloudstack
文件:ApiServer.java
public ListenerThread(final ApiServer requestHandler, final int port) {
try {
_serverSocket = new ServerSocket(port);
} catch (final IOException ioex) {
s_logger.error("error initializing api server", ioex);
return;
}
_params = new BasicHttpParams();
_params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
final BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
// Set up request handlers
final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", requestHandler);
// Set up the HTTP service
_httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
_httpService.setParams(_params);
_httpService.setHandlerResolver(reqistry);
}
项目:cloudstack
文件:ClusterServiceServletContainer.java
public ListenerThread(HttpRequestHandler requestHandler, int port) {
_executor = Executors.newCachedThreadPool(new NamedThreadFactory("Cluster-Listener"));
try {
_serverSocket = new ServerSocket(port);
} catch (IOException ioex) {
s_logger.error("error initializing cluster service servlet container", ioex);
return;
}
_params = new BasicHttpParams();
_params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new ResponseDate());
httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("/clusterservice", requestHandler);
// Set up the HTTP service
_httpService = new HttpService(httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
_httpService.setParams(_params);
_httpService.setHandlerResolver(reqistry);
}
项目:opentravelmate
文件:HttpServer.java
/**
* Create a server socket on an available port and process the requests.
*/
public void start() throws IOException {
// Prepare the HTTP server
this.serverSocket = new ServerSocket(0);
HttpParams httpParams = new BasicHttpParams()
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
httpProcessor.addInterceptor(new ResponseDate());
httpProcessor.addInterceptor(new ResponseServer());
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
HttpRequestHandlerRegistry registry = new HttpRequestHandlerRegistry();
for (Map.Entry<String, HttpRequestHandler> entry : requestHandlerByPattern.entrySet()) {
registry.register(entry.getKey(), entry.getValue());
}
HttpService httpService = new HttpService(httpProcessor, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
httpService.setParams(httpParams);
httpService.setHandlerResolver(registry);
// Handle incoming connections
executorService.execute(new RequestListener(this.serverSocket, httpParams, httpService, executorService, exceptionListener));
}
项目:tunebot
文件:WebServer.java
public RequestListenerThread(int port) throws IOException {
this.serversocket = new ServerSocket(port);
this.params = new SyncBasicHttpParams();
this.params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up the HTTP protocol processor
HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpFileHandler());
// Set up the HTTP service
this.httpService = new HttpService(
httpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory(),
reqistry,
this.params);
}
项目:PhET
文件:ElementalReverseProxy.java
public RequestListenerThread(int port, final HttpHost target) throws IOException {
this.target = target;
this.serversocket = new ServerSocket(port);
this.params = new SyncBasicHttpParams();
this.params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
// Set up HTTP protocol processor for incoming connections
HttpProcessor inhttpproc = new ImmutableHttpProcessor(
new HttpRequestInterceptor[] {
new RequestContent(),
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent(),
new RequestExpectContinue()
});
// Set up HTTP protocol processor for outgoing connections
HttpProcessor outhttpproc = new ImmutableHttpProcessor(
new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
// Set up outgoing request executor
HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
// Set up incoming request handler
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new ProxyHandler(
this.target,
outhttpproc,
httpexecutor));
// Set up the HTTP service
this.httpService = new HttpService(
inhttpproc,
new DefaultConnectionReuseStrategy(),
new DefaultHttpResponseFactory(),
reqistry,
this.params);
}
项目:PhET
文件:NHttpFileServer.java
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Please specify document root directory");
System.exit(1);
}
boolean useFileChannels = true;
if (args.length >= 2) {
String s = args[1];
if (s.equalsIgnoreCase("disableFileChannels")) {
useFileChannels = false;
}
}
HttpParams params = new SyncBasicHttpParams();
params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 20000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
AsyncNHttpServiceHandler handler = new AsyncNHttpServiceHandler(
httpproc,
new DefaultHttpResponseFactory(),
new DefaultConnectionReuseStrategy(),
params);
final HttpFileHandler filehandler = new HttpFileHandler(args[0], useFileChannels);
NHttpRequestHandlerResolver resolver = new NHttpRequestHandlerResolver() {
public NHttpRequestHandler lookup(String requestURI) {
return filehandler;
}
};
handler.setHandlerResolver(resolver);
// Provide an event logger
handler.setEventListener(new EventLogger());
IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);
ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
try {
ioReactor.listen(new InetSocketAddress(8080));
ioReactor.execute(ioEventDispatch);
} catch (InterruptedIOException ex) {
System.err.println("Interrupted");
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
}
System.out.println("Shutdown");
}
项目:PhET
文件:NHttpServer.java
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Please specify document root directory");
System.exit(1);
}
HttpParams params = new SyncBasicHttpParams();
params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
BufferingHttpServiceHandler handler = new BufferingHttpServiceHandler(
httpproc,
new DefaultHttpResponseFactory(),
new DefaultConnectionReuseStrategy(),
params);
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpFileHandler(args[0]));
handler.setHandlerResolver(reqistry);
// Provide an event logger
handler.setEventListener(new EventLogger());
IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);
ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
try {
ioReactor.listen(new InetSocketAddress(8080));
ioReactor.execute(ioEventDispatch);
} catch (InterruptedIOException ex) {
System.err.println("Interrupted");
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
}
System.out.println("Shutdown");
}
项目:PhET
文件:NHttpSSLServer.java
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Please specify document root directory");
System.exit(1);
}
ClassLoader cl = NHttpSSLServer.class.getClassLoader();
URL url = cl.getResource("test.keystore");
KeyStore keystore = KeyStore.getInstance("jks");
keystore.load(url.openStream(), "nopassword".toCharArray());
KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
kmfactory.init(keystore, "nopassword".toCharArray());
KeyManager[] keymanagers = kmfactory.getKeyManagers();
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(keymanagers, null, null);
HttpParams params = new SyncBasicHttpParams();
params
.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "Jakarta-HttpComponents-NIO/1.1");
HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
new ResponseDate(),
new ResponseServer(),
new ResponseContent(),
new ResponseConnControl()
});
BufferingHttpServiceHandler handler = new BufferingHttpServiceHandler(
httpproc,
new DefaultHttpResponseFactory(),
new DefaultConnectionReuseStrategy(),
params);
// Set up request handlers
HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
reqistry.register("*", new HttpFileHandler(args[0]));
handler.setHandlerResolver(reqistry);
// Provide an event logger
handler.setEventListener(new EventLogger());
IOEventDispatch ioEventDispatch = new SSLServerIOEventDispatch(
handler,
sslcontext,
params);
ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
try {
ioReactor.listen(new InetSocketAddress(8080));
ioReactor.execute(ioEventDispatch);
} catch (InterruptedIOException ex) {
System.err.println("Interrupted");
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
}
System.out.println("Shutdown");
}
项目:purecloud-iot
文件:TestConnectionReuse.java
@Test
public void testKeepAliveHeaderRespected() throws Exception {
final HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer(LocalServerTestBase.ORIGIN))
.add(new ResponseContent())
.add(new ResponseConnControl())
.add(new ResponseKeepAlive()).build();
this.serverBootstrap.setHttpProcessor(httpproc)
.registerHandler("/random/*", new RandomHandler());
this.connManager.setMaxTotal(1);
this.connManager.setDefaultMaxPerRoute(1);
final HttpHost target = start();
HttpResponse response = this.httpclient.execute(target, new HttpGet("/random/2000"));
EntityUtils.consume(response.getEntity());
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
response = this.httpclient.execute(target, new HttpGet("/random/2000"));
EntityUtils.consume(response.getEntity());
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
// Now sleep for 1.1 seconds and let the timeout do its work
Thread.sleep(1100);
response = this.httpclient.execute(target, new HttpGet("/random/2000"));
EntityUtils.consume(response.getEntity());
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
// Do another request just under the 1 second limit & make
// sure we reuse that connection.
Thread.sleep(500);
response = this.httpclient.execute(target, new HttpGet("/random/2000"));
EntityUtils.consume(response.getEntity());
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
}
项目:SparrowWorker
文件:HttpWorker.java
/**
* @param args the command line arguments
* @throws java.lang.Exception
*/
public static void main(String[] args) throws Exception {
int fixedExecutorSize = 4;
if (args.length != 2) {
System.err.println("Invalid command line parameters for worker");
System.exit(-1);
}
// Set worker mode
String mode = args[1];
// Creating fixed size executor
ThreadPoolExecutor taskExecutor = new ThreadPoolExecutor(fixedExecutorSize, fixedExecutorSize, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
int port = Integer.parseInt(args[0]);
// Set up the HTTP protocol processor
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer("Test/1.1"))
.add(new ResponseContent())
.add(new ResponseConnControl()).build();
// Set up request handler (either generic or late binding)
UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
if (mode.equals("--late"))
reqistry.register("*", new LateBindingRequestHandler(taskExecutor));
else
reqistry.register("*", new GenericRequestHandler(taskExecutor));
// Set up the HTTP service
HttpService httpService = new HttpService(httpproc, reqistry);
SSLServerSocketFactory sf = null;
// SSL code removed as it is not needed
// create a thread to listen for possible scheduler available connections
Thread t = new RequestListenerThread(port, httpService, sf);
System.out.println("Request Listener Thread created");
t.setDaemon(false);
t.start();
// main thread should wait for the listener to exit before shutdown the
// task executor pool
t.join();
// shutdown task executor pool and wait for any taskExecutor thread
// still running
taskExecutor.shutdown();
while (!taskExecutor.isTerminated()) {}
System.out.println("Finished all task executor threads");
}
项目:SparrowScheduler
文件:HttpScheduler.java
/**
* @param args the command line arguments
* @throws java.lang.Exception
*/
public static void main(String[] args) throws Exception{
if (args.length != 2) {
System.err.println("Invalid command line parameters for worker");
System.exit(-1);
}
int fixedExecutorSize = 4;
//Creating fixed size executor
ThreadPoolExecutor taskCommExecutor = new ThreadPoolExecutor(fixedExecutorSize, fixedExecutorSize, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
// Used for late binding
JobMap jobMap = new JobMap();
// Set port number
int port = Integer.parseInt(args[0]);
// Set worker mode
String mode = args[1].substring(2);
// Set up the HTTP protocol processor
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer("Test/1.1"))
.add(new ResponseContent())
.add(new ResponseConnControl()).build();
// Set up request handlers
UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
// Different handlers for late binding and generic cases
if (mode.equals("late"))
reqistry.register("*", new LateBindingRequestHandler(taskCommExecutor, jobMap));
else
reqistry.register("*", new GenericRequestHandler(taskCommExecutor, mode));
// Set up the HTTP service
HttpService httpService = new HttpService(httpproc, reqistry);
SSLServerSocketFactory sf = null;
// create a thread to listen for possible client available connections
Thread t;
if (mode.equals("late"))
t = new LateBindingRequestListenerThread(port, httpService, sf);
else
t = new GenericRequestListenerThread(port, httpService, sf);
System.out.println("Request Listener Thread created");
t.setDaemon(false);
t.start();
// main thread should wait for the listener to exit before shutdown the
// task executor pool
t.join();
// shutdown task executor pool and wait for any taskCommExecutor thread
// still running
taskCommExecutor.shutdown();
while (!taskCommExecutor.isTerminated()) {}
System.out.println("Finished all task communication executor threads");
System.out.println("Finished all tasks");
}
项目:dcl
文件:SimpleHttpServer.java
public SimpleHttpServer(int port, ConnectedAddressesProvider connectedAddressesProvider){
this.connFactory = DefaultBHttpServerConnectionFactory.INSTANCE;
// Set up the HTTP protocol processor
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate())
.add(new ResponseServer("Test/1.1"))
.add(new ResponseContent())
.add(new ResponseConnControl()).build();
// Set up request handlers
UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
reqistry.register("*", new HttpRequestHandlerNew(connectedAddressesProvider));
// Set up the HTTP service
httpService = new HttpService(httpproc, reqistry);
try {
serversocket = new ServerSocket(port, 1, InetAddress.getByName("127.0.0.1"));
System.out.println("Listening on port " + serversocket.getLocalPort());
while (!Thread.interrupted()) {
try {
// Set up HTTP connection
Socket socket = serversocket.accept();
System.out.println("Incoming connection from " + socket.getInetAddress());
HttpServerConnection conn = connFactory.createConnection(socket);
// Start worker thread
Thread t = new WorkerThread(httpService, conn);
t.setDaemon(true);
t.start();
} catch (InterruptedIOException ex) {
break;
} catch (IOException e) {
System.err.println("I/O error initialising connection thread: "
+ e.getMessage());
break;
}
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
项目:Megapode
文件:HttpServer.java
public static void start(String[] args) throws Exception {
int port = 8082;
if (args.length >= 1) {
port = Integer.parseInt(args[0]);
}
ActorSystem system = ActorSystem.create("Application-System");
Properties config = new Properties();
config.load(HttpServer.class.getResourceAsStream("/megapode.conf"));
ActorRef master = system.actorOf(
Props.create(CoordinatingActor.class, config), "Coordinator");
// Set up the HTTP protocol processor
HttpProcessor httpproc = HttpProcessorBuilder.create()
.add(new ResponseDate()).add(new ResponseServer("Test/1.1"))
.add(new ResponseContent()).add(new ResponseConnControl())
.build();
// Set up request handlers
UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
reqistry.register("*", new HttpHandler(system, master));
// Set up the HTTP service
HttpService httpService = new HttpService(httpproc, reqistry);
SSLServerSocketFactory sf = null;
if (port == 8443) {
// Initialize SSL context
ClassLoader cl = HttpServer.class.getClassLoader();
URL url = cl.getResource("my.keystore");
if (url == null) {
System.out.println("Keystore not found");
System.exit(1);
}
KeyStore keystore = KeyStore.getInstance("jks");
keystore.load(url.openStream(), "secret".toCharArray());
KeyManagerFactory kmfactory = KeyManagerFactory
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmfactory.init(keystore, "secret".toCharArray());
KeyManager[] keymanagers = kmfactory.getKeyManagers();
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(keymanagers, null, null);
sf = sslcontext.getServerSocketFactory();
}
RequestListenerThread t = new RequestListenerThread(port, httpService,
sf);
t.setDaemon(false);
t.start();
t.join();
}