You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2014/05/26 12:13:23 UTC
svn commit: r1597549 - in /httpcomponents/httpcore/trunk/httpcore/src:
examples/org/apache/http/examples/ main/java/org/apache/http/
main/java/org/apache/http/config/ main/java/org/apache/http/impl/bootstrap/
Author: olegk
Date: Mon May 26 10:13:23 2014
New Revision: 1597549
URL: http://svn.apache.org/r1597549
Log:
Bootstrap for embedded server based on classic I/O
Added:
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java (with props)
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java (with props)
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java (with props)
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java (with props)
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java (with props)
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java (with props)
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java (with props)
Modified:
httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
Modified: httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java?rev=1597549&r1=1597548&r2=1597549&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/examples/org/apache/http/examples/ElementalHttpServer.java Mon May 26 10:13:23 2014
@@ -29,50 +29,39 @@ package org.apache.http.examples;
import java.io.File;
import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.net.ServerSocket;
-import java.net.Socket;
+import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.security.KeyStore;
import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
import org.apache.http.ConnectionClosedException;
-import org.apache.http.HttpConnectionFactory;
+import org.apache.http.ExceptionLogger;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
-import org.apache.http.HttpServerConnection;
import org.apache.http.HttpStatus;
import org.apache.http.MethodNotSupportedException;
+import org.apache.http.config.SocketConfig;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.FileEntity;
import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.DefaultBHttpServerConnection;
-import org.apache.http.impl.DefaultBHttpServerConnectionFactory;
-import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.impl.bootstrap.Server;
+import org.apache.http.impl.bootstrap.ServerBootstrap;
import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpProcessor;
-import org.apache.http.protocol.HttpProcessorBuilder;
import org.apache.http.protocol.HttpRequestHandler;
-import org.apache.http.protocol.HttpService;
-import org.apache.http.protocol.ResponseConnControl;
-import org.apache.http.protocol.ResponseContent;
-import org.apache.http.protocol.ResponseDate;
-import org.apache.http.protocol.ResponseServer;
-import org.apache.http.protocol.UriHttpRequestHandlerMapper;
import org.apache.http.util.EntityUtils;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLServerSocketFactory;
-
/**
- * Basic, yet fully functional and spec compliant, HTTP/1.1 file server.
+ * Embedded HTTP/1.1 file server.
*/
public class ElementalHttpServer {
@@ -88,21 +77,7 @@ public class ElementalHttpServer {
port = Integer.parseInt(args[1]);
}
- // 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(docRoot));
-
- // Set up the HTTP service
- HttpService httpService = new HttpService(httpproc, reqistry);
-
- SSLServerSocketFactory sf = null;
+ SSLContext sslcontext = null;
if (port == 8443) {
// Initialize SSL context
ClassLoader cl = ElementalHttpServer.class.getClassLoader();
@@ -117,14 +92,48 @@ public class ElementalHttpServer {
KeyManagerFactory.getDefaultAlgorithm());
kmfactory.init(keystore, "secret".toCharArray());
KeyManager[] keymanagers = kmfactory.getKeyManagers();
- SSLContext sslcontext = SSLContext.getInstance("TLS");
+ sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(keymanagers, null, null);
- sf = sslcontext.getServerSocketFactory();
}
- Thread t = new RequestListenerThread(port, httpService, sf);
- t.setDaemon(false);
- t.start();
+ SocketConfig socketConfig = SocketConfig.custom()
+ .setSoTimeout(15000)
+ .setTcpNoDelay(true)
+ .build();
+
+ final Server server = ServerBootstrap.bootstrap()
+ .setListenerPort(port)
+ .setServerInfo("Test/1.1")
+ .setSocketConfig(socketConfig)
+ .setSslContext(sslcontext)
+ .setExceptionLogger(new StdErrorExceptionLogger())
+ .registerHandler("*", new HttpFileHandler(docRoot))
+ .create();
+
+ server.start();
+ server.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ server.shutdown(5, TimeUnit.SECONDS);
+ }
+ });
+ }
+
+ static class StdErrorExceptionLogger implements ExceptionLogger {
+
+ @Override
+ public void log(final Exception ex) {
+ if (ex instanceof SocketTimeoutException) {
+ System.err.println("Connection timed out");
+ } else if (ex instanceof ConnectionClosedException) {
+ System.err.println(ex.getMessage());
+ } else {
+ ex.printStackTrace();
+ }
+ }
+
}
static class HttpFileHandler implements HttpRequestHandler {
@@ -184,80 +193,4 @@ public class ElementalHttpServer {
}
- static class RequestListenerThread extends Thread {
-
- private final HttpConnectionFactory<DefaultBHttpServerConnection> connFactory;
- private final ServerSocket serversocket;
- private final HttpService httpService;
-
- public RequestListenerThread(
- final int port,
- final HttpService httpService,
- final SSLServerSocketFactory sf) throws IOException {
- this.connFactory = DefaultBHttpServerConnectionFactory.INSTANCE;
- this.serversocket = sf != null ? sf.createServerSocket(port) : new ServerSocket(port);
- this.httpService = httpService;
- }
-
- @Override
- public void run() {
- System.out.println("Listening on port " + this.serversocket.getLocalPort());
- while (!Thread.interrupted()) {
- try {
- // Set up HTTP connection
- Socket socket = this.serversocket.accept();
- System.out.println("Incoming connection from " + socket.getInetAddress());
- HttpServerConnection conn = this.connFactory.createConnection(socket);
-
- // Start worker thread
- Thread t = new WorkerThread(this.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;
- }
- }
- }
- }
-
- static class WorkerThread extends Thread {
-
- private final HttpService httpservice;
- private final HttpServerConnection conn;
-
- public WorkerThread(
- final HttpService httpservice,
- final HttpServerConnection conn) {
- super();
- this.httpservice = httpservice;
- this.conn = conn;
- }
-
- @Override
- public void run() {
- System.out.println("New connection thread");
- HttpContext context = new BasicHttpContext(null);
- try {
- while (!Thread.interrupted() && this.conn.isOpen()) {
- this.httpservice.handleRequest(this.conn, context);
- }
- } catch (ConnectionClosedException ex) {
- System.err.println("Client closed connection");
- } catch (IOException ex) {
- System.err.println("I/O error: " + ex.getMessage());
- } catch (HttpException ex) {
- System.err.println("Unrecoverable HTTP protocol violation: " + ex.getMessage());
- } finally {
- try {
- this.conn.shutdown();
- } catch (IOException ignore) {}
- }
- }
-
- }
-
}
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java Mon May 26 10:13:23 2014
@@ -0,0 +1,53 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http;
+
+/**
+ * @since 4.4
+ */
+public interface ExceptionLogger {
+
+ public static final ExceptionLogger NO_OP = new ExceptionLogger() {
+
+ @Override
+ public void log(final Exception ex) {
+ }
+
+ };
+
+ public static final ExceptionLogger STD_ERR = new ExceptionLogger() {
+
+ @Override
+ public void log(final Exception ex) {
+ ex.printStackTrace();
+ }
+
+ };
+
+ void log(Exception ex);
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ExceptionLogger.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java?rev=1597549&r1=1597548&r2=1597549&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/config/SocketConfig.java Mon May 26 10:13:23 2014
@@ -47,6 +47,7 @@ public class SocketConfig implements Clo
private final boolean tcpNoDelay;
private final int sndBufSize;
private final int rcvBufSize;
+ private int backlogSize;
SocketConfig(
final int soTimeout,
@@ -55,7 +56,8 @@ public class SocketConfig implements Clo
final boolean soKeepAlive,
final boolean tcpNoDelay,
final int sndBufSize,
- final int rcvBufSize) {
+ final int rcvBufSize,
+ final int backlogSize) {
super();
this.soTimeout = soTimeout;
this.soReuseAddress = soReuseAddress;
@@ -64,6 +66,7 @@ public class SocketConfig implements Clo
this.tcpNoDelay = tcpNoDelay;
this.sndBufSize = sndBufSize;
this.rcvBufSize = rcvBufSize;
+ this.backlogSize = backlogSize;
}
/**
@@ -153,6 +156,18 @@ public class SocketConfig implements Clo
return rcvBufSize;
}
+ /**
+ * Determines the maximum queue length for incoming connection indications
+ * (a request to connect) also known as server socket backlog.
+ * <p/>
+ * Default: <code>0</code> (system default)
+ *
+ * @since 4.4
+ */
+ public int getBacklogSize() {
+ return backlogSize;
+ }
+
@Override
protected SocketConfig clone() throws CloneNotSupportedException {
return (SocketConfig) super.clone();
@@ -168,6 +183,7 @@ public class SocketConfig implements Clo
.append(", tcpNoDelay=").append(this.tcpNoDelay)
.append(", sndBufSize=").append(this.sndBufSize)
.append(", rcvBufSize=").append(this.rcvBufSize)
+ .append(", backlogSize=").append(this.backlogSize)
.append("]");
return builder.toString();
}
@@ -185,7 +201,8 @@ public class SocketConfig implements Clo
.setSoKeepAlive(config.isSoKeepAlive())
.setTcpNoDelay(config.isTcpNoDelay())
.setSndBufSize(config.getSndBufSize())
- .setRcvBufSize(config.getRcvBufSize());
+ .setRcvBufSize(config.getRcvBufSize())
+ .setBacklogSize(config.getBacklogSize());
}
public static class Builder {
@@ -197,6 +214,7 @@ public class SocketConfig implements Clo
private boolean tcpNoDelay;
private int sndBufSize;
private int rcvBufSize;
+ private int backlogSize;
Builder() {
this.soLinger = -1;
@@ -244,9 +262,17 @@ public class SocketConfig implements Clo
return this;
}
+ /**
+ * @since 4.4
+ */
+ public Builder setBacklogSize(final int backlogSize) {
+ this.backlogSize = backlogSize;
+ return this;
+ }
+
public SocketConfig build() {
return new SocketConfig(soTimeout, soReuseAddress, soLinger, soKeepAlive, tcpNoDelay,
- sndBufSize, rcvBufSize);
+ sndBufSize, rcvBufSize, backlogSize);
}
}
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java Mon May 26 10:13:23 2014
@@ -0,0 +1,106 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.bootstrap;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.http.ExceptionLogger;
+import org.apache.http.HttpConnectionFactory;
+import org.apache.http.HttpServerConnection;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.protocol.HttpService;
+
+/**
+ * @since 4.4
+ */
+class RequestListener implements Runnable {
+
+ private final SocketConfig socketConfig;
+ private final ServerSocket serversocket;
+ private final HttpService httpService;
+ private final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory;
+ private final ExceptionLogger exceptionLogger;
+ private final ExecutorService executorService;
+ private final AtomicBoolean terminated;
+
+ public RequestListener(
+ final SocketConfig socketConfig,
+ final ServerSocket serversocket,
+ final HttpService httpService,
+ final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory,
+ final ExceptionLogger exceptionLogger,
+ final ExecutorService executorService) {
+ this.socketConfig = socketConfig;
+ this.serversocket = serversocket;
+ this.connectionFactory = connectionFactory;
+ this.httpService = httpService;
+ this.exceptionLogger = exceptionLogger;
+ this.executorService = executorService;
+ this.terminated = new AtomicBoolean(false);
+ }
+
+ @Override
+ public void run() {
+ try {
+ while (!isTerminated() && !Thread.interrupted()) {
+ final Socket socket = this.serversocket.accept();
+ socket.setSoTimeout(this.socketConfig.getSoTimeout());
+ socket.setKeepAlive(this.socketConfig.isSoKeepAlive());
+ socket.setTcpNoDelay(this.socketConfig.isTcpNoDelay());
+ if (this.socketConfig.getRcvBufSize() > 0) {
+ socket.setReceiveBufferSize(this.socketConfig.getRcvBufSize());
+ }
+ if (this.socketConfig.getSndBufSize() > 0) {
+ socket.setSendBufferSize(this.socketConfig.getSndBufSize());
+ }
+ if (this.socketConfig.getSoLinger() >= 0) {
+ socket.setSoLinger(true, this.socketConfig.getSoLinger());
+ }
+ final HttpServerConnection conn = this.connectionFactory.createConnection(socket);
+ final Worker worker = new Worker(this.httpService, conn, this.exceptionLogger);
+ this.executorService.execute(worker);
+ }
+ } catch (Exception ex) {
+ this.exceptionLogger.log(ex);
+ }
+ }
+
+ public boolean isTerminated() {
+ return this.terminated.get();
+ }
+
+ public void terminate() throws IOException {
+ if (this.terminated.compareAndSet(false, true)) {
+ this.serversocket.close();
+ }
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/RequestListener.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java Mon May 26 10:13:23 2014
@@ -0,0 +1,152 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.bootstrap;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.net.ServerSocketFactory;
+
+import org.apache.http.ExceptionLogger;
+import org.apache.http.HttpConnectionFactory;
+import org.apache.http.HttpServerConnection;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.protocol.HttpService;
+
+/**
+ * @since 4.4
+ */
+public class Server {
+
+ enum Status { READY, ACTIVE, STOPPING }
+
+ private final int port;
+ private final InetAddress ifAddress;
+ private final SocketConfig socketConfig;
+ private final ServerSocketFactory serverSocketFactory;
+ private final HttpService httpService;
+ private final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory;
+ private final ExceptionLogger exceptionLogger;
+ private final ExecutorService listenerExecutorService;
+ private final ThreadGroup workerThreads;
+ private final ExecutorService workerExecutorService;
+ private final AtomicReference<Status> status;
+
+ private volatile RequestListener requestListener;
+
+ Server(
+ final int port,
+ final InetAddress ifAddress,
+ final SocketConfig socketConfig,
+ final ServerSocketFactory serverSocketFactory,
+ final HttpService httpService,
+ final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory,
+ final ExceptionLogger exceptionLogger) {
+ this.port = port;
+ this.ifAddress = ifAddress;
+ this.socketConfig = socketConfig;
+ this.serverSocketFactory = serverSocketFactory;
+ this.httpService = httpService;
+ this.connectionFactory = connectionFactory;
+ this.exceptionLogger = exceptionLogger;
+ this.listenerExecutorService = Executors.newSingleThreadExecutor(
+ new ThreadFactoryImpl("HTTP-listener-" + this.port));
+ this.workerThreads = new ThreadGroup("HTTP-workers");
+ this.workerExecutorService = Executors.newCachedThreadPool(
+ new ThreadFactoryImpl("HTTP-worker", this.workerThreads));
+ this.status = new AtomicReference<Status>(Status.READY);
+ }
+
+ public void start() throws IOException {
+ if (this.status.compareAndSet(Status.READY, Status.ACTIVE)) {
+ final ServerSocket serverSocket = this.serverSocketFactory.createServerSocket(
+ this.port, this.socketConfig.getBacklogSize(), this.ifAddress);
+ serverSocket.setReuseAddress(this.socketConfig.isSoReuseAddress());
+ if (this.socketConfig.getRcvBufSize() > 0) {
+ serverSocket.setReceiveBufferSize(this.socketConfig.getRcvBufSize());
+ }
+ this.requestListener = new RequestListener(
+ this.socketConfig,
+ serverSocket,
+ this.httpService,
+ this.connectionFactory,
+ this.exceptionLogger,
+ this.workerExecutorService);
+ this.listenerExecutorService.execute(this.requestListener);
+ }
+ }
+
+ public void stop() {
+ if (this.status.compareAndSet(Status.ACTIVE, Status.STOPPING)) {
+ final RequestListener local = this.requestListener;
+ if (local != null) {
+ try {
+ local.terminate();
+ } catch (IOException ex) {
+ this.exceptionLogger.log(ex);
+ }
+ }
+ this.workerThreads.interrupt();
+ this.listenerExecutorService.shutdown();
+ this.workerExecutorService.shutdown();
+ }
+ }
+
+ public void awaitTermination(final long timeout, final TimeUnit timeUnit) throws InterruptedException {
+ this.workerExecutorService.awaitTermination(timeout, timeUnit);
+ }
+
+ public void shutdown(final long gracePeriod, final TimeUnit timeUnit) {
+ stop();
+ if (gracePeriod > 0) {
+ try {
+ awaitTermination(gracePeriod, timeUnit);
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ final List<Runnable> runnables = this.workerExecutorService.shutdownNow();
+ for (Runnable runnable: runnables) {
+ if (runnable instanceof Worker) {
+ final Worker worker = (Worker) runnable;
+ final HttpServerConnection conn = worker.getConnection();
+ try {
+ conn.shutdown();
+ } catch (IOException ex) {
+ this.exceptionLogger.log(ex);
+ }
+ }
+ }
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Server.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java Mon May 26 10:13:23 2014
@@ -0,0 +1,388 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.bootstrap;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLContext;
+
+import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.ExceptionLogger;
+import org.apache.http.HttpConnectionFactory;
+import org.apache.http.HttpRequestInterceptor;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.HttpResponseInterceptor;
+import org.apache.http.HttpServerConnection;
+import org.apache.http.config.ConnectionConfig;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.impl.DefaultBHttpServerConnectionFactory;
+import org.apache.http.impl.DefaultConnectionReuseStrategy;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.protocol.HttpExpectationVerifier;
+import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
+import org.apache.http.protocol.HttpRequestHandler;
+import org.apache.http.protocol.HttpRequestHandlerMapper;
+import org.apache.http.protocol.HttpService;
+import org.apache.http.protocol.ResponseConnControl;
+import org.apache.http.protocol.ResponseContent;
+import org.apache.http.protocol.ResponseDate;
+import org.apache.http.protocol.ResponseServer;
+import org.apache.http.protocol.UriHttpRequestHandlerMapper;
+
+/**
+ * @since 4.4
+ */
+public class ServerBootstrap {
+
+ private int listenerPort;
+ private InetAddress localAddress;
+ private SocketConfig socketConfig;
+ private ConnectionConfig connectionConfig;
+ private LinkedList<HttpRequestInterceptor> requestFirst;
+ private LinkedList<HttpRequestInterceptor> requestLast;
+ private LinkedList<HttpResponseInterceptor> responseFirst;
+ private LinkedList<HttpResponseInterceptor> responseLast;
+ private String serverInfo;
+ private HttpProcessor httpProcessor;
+ private ConnectionReuseStrategy connStrategy;
+ private HttpResponseFactory responseFactory;
+ private HttpRequestHandlerMapper handlerMapper;
+ private Map<String, HttpRequestHandler> handlerMap;
+ private HttpExpectationVerifier expectationVerifier;
+ private SSLContext sslContext;
+ private HttpConnectionFactory<? extends HttpServerConnection> connectionFactory;
+ private ExceptionLogger exceptionLogger;
+
+ private ServerBootstrap() {
+ }
+
+ public static ServerBootstrap bootstrap() {
+ return new ServerBootstrap();
+ }
+
+ /**
+ * Sets listener port number.
+ */
+ public final ServerBootstrap setListenerPort(final int listenerPort) {
+ this.listenerPort = listenerPort;
+ return this;
+ }
+
+ /**
+ * Assigns local interface for the listener.
+ */
+ public final ServerBootstrap setLocalAddress(final InetAddress localAddress) {
+ this.localAddress = localAddress;
+ return this;
+ }
+
+ /**
+ * Sets socket configuration.
+ */
+ public final ServerBootstrap setSocketConfig(final SocketConfig socketConfig) {
+ this.socketConfig = socketConfig;
+ return this;
+ }
+
+ /**
+ * Sets connection configuration.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionFactory(
+ * org.apache.http.HttpConnectionFactory)} method.
+ */
+ public final ServerBootstrap setConnectionConfig(final ConnectionConfig connectionConfig) {
+ this.connectionConfig = connectionConfig;
+ return this;
+ }
+
+ /**
+ * Assigns {@link HttpProcessor} instance.
+ */
+ public final ServerBootstrap setHttpProcessor(final HttpProcessor httpProcessor) {
+ this.httpProcessor = httpProcessor;
+ return this;
+ }
+
+ /**
+ * Adds this protocol interceptor to the head of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
+ public final ServerBootstrap addInterceptorFirst(final HttpResponseInterceptor itcp) {
+ if (itcp == null) {
+ return this;
+ }
+ if (responseFirst == null) {
+ responseFirst = new LinkedList<HttpResponseInterceptor>();
+ }
+ responseFirst.addFirst(itcp);
+ return this;
+ }
+
+ /**
+ * Adds this protocol interceptor to the tail of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
+ public final ServerBootstrap addInterceptorLast(final HttpResponseInterceptor itcp) {
+ if (itcp == null) {
+ return this;
+ }
+ if (responseLast == null) {
+ responseLast = new LinkedList<HttpResponseInterceptor>();
+ }
+ responseLast.addLast(itcp);
+ return this;
+ }
+
+ /**
+ * Adds this protocol interceptor to the head of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
+ public final ServerBootstrap addInterceptorFirst(final HttpRequestInterceptor itcp) {
+ if (itcp == null) {
+ return this;
+ }
+ if (requestFirst == null) {
+ requestFirst = new LinkedList<HttpRequestInterceptor>();
+ }
+ requestFirst.addFirst(itcp);
+ return this;
+ }
+
+ /**
+ * Adds this protocol interceptor to the tail of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
+ public final ServerBootstrap addInterceptorLast(final HttpRequestInterceptor itcp) {
+ if (itcp == null) {
+ return this;
+ }
+ if (requestLast == null) {
+ requestLast = new LinkedList<HttpRequestInterceptor>();
+ }
+ requestLast.addLast(itcp);
+ return this;
+ }
+
+ /**
+ * Assigns <tt>Server</tt> response header value.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
+ public final ServerBootstrap setServerInfo(final String serverInfo) {
+ this.serverInfo = serverInfo;
+ return this;
+ }
+
+ /**
+ * Assigns {@link ConnectionReuseStrategy} instance.
+ */
+ public final ServerBootstrap setConnectionReuseStrategy(final ConnectionReuseStrategy connStrategy) {
+ this.connStrategy = connStrategy;
+ return this;
+ }
+
+ /**
+ * Assigns {@link HttpResponseFactory} instance.
+ */
+ public final ServerBootstrap setResponseFactory(final HttpResponseFactory responseFactory) {
+ this.responseFactory = responseFactory;
+ return this;
+ }
+
+ /**
+ * Assigns {@link HttpRequestHandlerMapper} instance.
+ */
+ public final ServerBootstrap setHandlerMapper(final HttpRequestHandlerMapper handlerMapper) {
+ this.handlerMapper = handlerMapper;
+ return this;
+ }
+
+ /**
+ * Registers the given {@link HttpRequestHandler} as a handler for URIs
+ * matching the given pattern.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHandlerMapper(
+ * org.apache.http.protocol.HttpRequestHandlerMapper)} method.
+ *
+ * @param pattern the pattern to register the handler for.
+ * @param handler the handler.
+ */
+ public final ServerBootstrap registerHandler(final String pattern, final HttpRequestHandler handler) {
+ if (pattern == null || handler == null) {
+ return this;
+ }
+ if (handlerMap == null) {
+ handlerMap = new HashMap<String, HttpRequestHandler>();
+ }
+ handlerMap.put(pattern, handler);
+ return this;
+ }
+
+ /**
+ * Assigns {@link HttpExpectationVerifier} instance.
+ */
+ public final ServerBootstrap setExpectationVerifier(final HttpExpectationVerifier expectationVerifier) {
+ this.expectationVerifier = expectationVerifier;
+ return this;
+ }
+
+ /**
+ * Assigns {@link HttpConnectionFactory} instance.
+ */
+ public final ServerBootstrap setConnectionFactory(
+ final HttpConnectionFactory<? extends HttpServerConnection> connectionFactory) {
+ this.connectionFactory = connectionFactory;
+ return this;
+ }
+
+ /**
+ * Assigns {@link javax.net.ssl.SSLContext} instance.
+ */
+ public final ServerBootstrap setSslContext(final SSLContext sslContext) {
+ this.sslContext = sslContext;
+ return this;
+ }
+
+ /**
+ * Assigns {@link org.apache.http.ExceptionLogger} instance.
+ */
+ public final ServerBootstrap setExceptionLogger(final ExceptionLogger exceptionLogger) {
+ this.exceptionLogger = exceptionLogger;
+ return this;
+ }
+
+ public Server create() {
+
+ HttpProcessor httpProcessorCopy = this.httpProcessor;
+ if (httpProcessorCopy == null) {
+
+ final HttpProcessorBuilder b = HttpProcessorBuilder.create();
+ if (requestFirst != null) {
+ for (final HttpRequestInterceptor i: requestFirst) {
+ b.addFirst(i);
+ }
+ }
+ if (responseFirst != null) {
+ for (final HttpResponseInterceptor i: responseFirst) {
+ b.addFirst(i);
+ }
+ }
+
+ String serverInfoCopy = this.serverInfo;
+ if (serverInfoCopy == null) {
+ serverInfoCopy = "Apache-HttpCore/1.1";
+ }
+
+ b.addAll(
+ new ResponseDate(),
+ new ResponseServer(serverInfoCopy),
+ new ResponseContent(),
+ new ResponseConnControl());
+ if (requestLast != null) {
+ for (final HttpRequestInterceptor i: requestLast) {
+ b.addLast(i);
+ }
+ }
+ if (responseLast != null) {
+ for (final HttpResponseInterceptor i: responseLast) {
+ b.addLast(i);
+ }
+ }
+ httpProcessorCopy = b.build();
+ }
+
+ HttpRequestHandlerMapper handlerMapperCopy = this.handlerMapper;
+ if (handlerMapperCopy == null) {
+ final UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
+ if (handlerMap != null) {
+ for (Map.Entry<String, HttpRequestHandler> entry: handlerMap.entrySet()) {
+ reqistry.register(entry.getKey(), entry.getValue());
+ }
+ }
+ handlerMapperCopy = reqistry;
+ }
+
+ ConnectionReuseStrategy connStrategyCopy = this.connStrategy;
+ if (connStrategyCopy == null) {
+ connStrategyCopy = DefaultConnectionReuseStrategy.INSTANCE;
+ }
+
+ HttpResponseFactory responseFactoryCopy = this.responseFactory;
+ if (responseFactoryCopy == null) {
+ responseFactoryCopy = DefaultHttpResponseFactory.INSTANCE;
+ }
+
+ final HttpService httpService = new HttpService(
+ httpProcessorCopy, connStrategyCopy, responseFactoryCopy, handlerMapperCopy,
+ this.expectationVerifier);
+
+ final ServerSocketFactory serverSocketFactory;
+ if (this.sslContext != null) {
+ serverSocketFactory = this.sslContext.getServerSocketFactory();
+ } else {
+ serverSocketFactory = ServerSocketFactory.getDefault();
+ }
+
+ HttpConnectionFactory<? extends HttpServerConnection> connectionFactoryCopy = this.connectionFactory;
+ if (connectionFactoryCopy == null) {
+ if (this.connectionConfig != null) {
+ connectionFactoryCopy = new DefaultBHttpServerConnectionFactory(this.connectionConfig);
+ } else {
+ connectionFactoryCopy = DefaultBHttpServerConnectionFactory.INSTANCE;
+ }
+ }
+
+ ExceptionLogger exceptionLoggerCopy = this.exceptionLogger;
+ if (exceptionLoggerCopy == null) {
+ exceptionLoggerCopy = ExceptionLogger.NO_OP;
+ }
+
+ return new Server(
+ this.listenerPort > 0 ? this.listenerPort : 8080,
+ this.localAddress,
+ this.socketConfig != null ? this.socketConfig : SocketConfig.DEFAULT,
+ serverSocketFactory,
+ httpService,
+ connectionFactoryCopy,
+ exceptionLoggerCopy);
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ServerBootstrap.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java Mon May 26 10:13:23 2014
@@ -0,0 +1,56 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.bootstrap;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @since 4.4
+ */
+class ThreadFactoryImpl implements ThreadFactory {
+
+ private final String namePrefix;
+ private final ThreadGroup group;
+ private final AtomicLong count;
+
+ ThreadFactoryImpl(final String namePrefix, final ThreadGroup group) {
+ this.namePrefix = namePrefix;
+ this.group = group;
+ this.count = new AtomicLong();
+ }
+
+ ThreadFactoryImpl(final String namePrefix) {
+ this(namePrefix, null);
+ }
+
+ @Override
+ public Thread newThread(final Runnable target) {
+ return new Thread(this.group, target, this.namePrefix + "-" + this.count.incrementAndGet());
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/ThreadFactoryImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java Mon May 26 10:13:23 2014
@@ -0,0 +1,81 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.bootstrap;
+
+import java.io.IOException;
+
+import org.apache.http.ExceptionLogger;
+import org.apache.http.HttpServerConnection;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpCoreContext;
+import org.apache.http.protocol.HttpService;
+
+/**
+ * @since 4.4
+ */
+class Worker implements Runnable {
+
+ private final HttpService httpservice;
+ private final HttpServerConnection conn;
+ private final ExceptionLogger exceptionLogger;
+
+ Worker(
+ final HttpService httpservice,
+ final HttpServerConnection conn,
+ final ExceptionLogger exceptionLogger) {
+ super();
+ this.httpservice = httpservice;
+ this.conn = conn;
+ this.exceptionLogger = exceptionLogger;
+ }
+
+ public HttpServerConnection getConnection() {
+ return this.conn;
+ }
+
+ @Override
+ public void run() {
+ try {
+ final BasicHttpContext localContext = new BasicHttpContext();
+ final HttpCoreContext context = HttpCoreContext.adapt(localContext);
+ while (!Thread.interrupted() && this.conn.isOpen()) {
+ this.httpservice.handleRequest(this.conn, context);
+ localContext.clear();
+ }
+ this.conn.close();
+ } catch (Exception ex) {
+ this.exceptionLogger.log(ex);
+ } finally {
+ try {
+ this.conn.shutdown();
+ } catch (IOException ex) {
+ this.exceptionLogger.log(ex);
+ }
+ }
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/Worker.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java?rev=1597549&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java Mon May 26 10:13:23 2014
@@ -0,0 +1,31 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+/**
+ * Embedded server bootstrap.
+ */
+package org.apache.http.impl.bootstrap;
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/bootstrap/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain