Package org.apache.http.protocol

Examples of org.apache.http.protocol.HttpRequestHandler


    private final AtomicInteger counter = new AtomicInteger();

    @Override
    protected void registerHandler(LocalTestServer server) {
        server.register("/", new HttpRequestHandler() {
            public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    // ignore
View Full Code Here


  @Override
  //handleRequest() -> doService() -> service()
  protected void doService(HttpRequest request, HttpResponse response, HttpContext context) {
    try {
      LOG.trace("doService() >> " + request.getRequestLine().getUri());
      HttpRequestHandler handler = null;
      if (handlerResolver != null) {
        handler = handlerResolver.lookup(request.getRequestLine().getUri());
        if (handler == null) {
          handler = handlerResolver.lookup("/");
        }
      } else if (hostResolver != null) {
        handler = hostResolver.lookup(request, context);
      }
          if (handler != null) {
            handler.handle(request, response, context);
          } else {
              throw new NotFoundException();
          }
    } catch (Exception e) {
      if (e instanceof org.tamacat.httpd.exception.HttpException) {
View Full Code Here

      resolver = hostHandler.get(DEFAULT_HOST);
    }
    if (LOG.isTraceEnabled() && resolver != null) {
      LOG.trace("handler: " + resolver.getClass().getName());
    }
    HttpRequestHandler handler = null;
    if (resolver != null) {
      handler = resolver.lookup(request.getRequestLine().getUri());
      if (handler == null) {
        handler = resolver.lookup("/");
      }
View Full Code Here

        this.localServer.start();
    }

    @Test
    public void testCookieMatchingWithVirtualHosts() throws Exception {
        this.localServer.register("*", new HttpRequestHandler() {
            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {

View Full Code Here

        this.mgr.releaseConnection(conn, null, -1, null);
    }

    @Test
    public void testReleaseOnIOException() throws Exception {
        this.localServer.register("/dropdead", new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
View Full Code Here

    @Test
    public void testAbortRetry_HTTPCLIENT_1120() throws Exception {
        final int port = this.localServer.getServiceAddress().getPort();
        final CountDownLatch wait = new CountDownLatch(1);

        this.localServer.register("*", new HttpRequestHandler(){
            public void handle(final HttpRequest request, final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
                try {
                    wait.countDown(); // trigger abort
                    Thread.sleep(2000); // allow time for abort to happen
View Full Code Here

    }

    @Test
    public void testBasicRedirect302NoLocation() throws Exception {
        final HttpHost target = getServerHttp();
        this.localServer.register("*", new HttpRequestHandler() {

            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
View Full Code Here

    private final AtomicInteger counter = new AtomicInteger();

    @Override
    protected void registerHandler(LocalTestServer server) {
        server.register("/", new HttpRequestHandler() {
            public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    // ignore
View Full Code Here

       
        try {

            this.httpProcessor.process(request, context);

            HttpRequestHandler handler = null;
            if (this.handlerResolver != null) {
                String requestURI = request.getRequestLine().getUri();
                handler = this.handlerResolver.lookup(requestURI);
            }
            if (handler != null) {
                handler.handle(request, response, context);
            } else {
                response.setStatusCode(HttpStatus.SC_NOT_IMPLEMENTED);
            }

        } catch (HttpException ex) {
View Full Code Here

       
        try {

            this.httpProcessor.process(request, context);

            HttpRequestHandler handler = null;
            if (this.handlerResolver != null) {
                String requestURI = request.getRequestLine().getUri();
                handler = this.handlerResolver.lookup(requestURI);
            }
            if (handler != null) {
                handler.handle(request, response, context);
            } else {
                response.setStatusCode(HttpStatus.SC_NOT_IMPLEMENTED);
            }
           
        } catch (HttpException ex) {
View Full Code Here

TOP

Related Classes of org.apache.http.protocol.HttpRequestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.