@Override public void process(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException { final HttpCoreContext coreContext = HttpCoreContext.adapt(httpContext); final HttpInetConnection conn = coreContext.getConnection(HttpInetConnection.class); if (!conn.isOpen()) { return;
public void handle( final HttpRequest request, final HttpResponse response, final HttpContext context) throws HttpException, IOException { String target = request.getRequestLine().getUri(); final File file = new File(this.docRoot, URLDecoder.decode(target, "UTF-8")); HttpCoreContext coreContext = HttpCoreContext.adapt(context); HttpConnection conn = coreContext.getConnection(HttpConnection.class); response.setStatusCode(HttpStatus.SC_OK); FileEntity body = new FileEntity(file, ContentType.create("text/html", (Charset) null)); response.setEntity(body); System.out.println(conn + ": serving file " + file.getPath()); new Thread() { @Override public void run() { System.out.println("Stopping HTTP Server..."); server.stop(); } }.start(); } }
HttpHost targethost = corecontext.getTargetHost(); if (targethost == null) { final HttpConnection conn = corecontext.getConnection(); if (conn instanceof HttpInetConnection) {
HttpHost targethost = corecontext.getTargetHost(); if (targethost == null) { final HttpConnection conn = corecontext.getConnection(); if (conn instanceof HttpInetConnection) {
HttpHost targethost = corecontext.getTargetHost(); if (targethost == null) { final HttpConnection conn = corecontext.getConnection(); if (conn instanceof HttpInetConnection) {
HttpHost targethost = corecontext.getTargetHost(); if (targethost == null) { final HttpConnection conn = corecontext.getConnection(); if (conn instanceof HttpInetConnection) {
HttpHost targetHost = coreContext.getTargetHost(); if (targetHost == null) { final HttpConnection conn = coreContext.getConnection(); if (conn instanceof HttpInetConnection) {
HttpHost targethost = corecontext.getTargetHost(); if (targethost == null) { final HttpConnection conn = corecontext.getConnection(); if (conn instanceof HttpInetConnection) {
final HttpConnection conn = coreContext.getConnection(HttpConnection.class); response.setStatusCode(HttpStatus.SC_OK); final HttpEntity body = file.isDirectory()
final HttpConnection conn = coreContext.getConnection(HttpConnection.class); response.setStatusCode(HttpStatus.SC_OK); final HttpEntity body = file.isDirectory()