Examples of BasicHttpRequest


Examples of de.ioexception.www.http.impl.BasicHttpRequest

  @Override
  protected HttpRequest parseRequest(InputStream inputStream) throws IOException
  {
    String firstLine = readLine(inputStream);

    BasicHttpRequest request = new BasicHttpRequest();

    request.setVersion(HttpVersion.extractVersion(firstLine));
    request.setRequestUri(firstLine.split(" ", 3)[1]);
    request.setMethod(HttpMethod.extractMethod(firstLine));

    Map<String, String> headers = new HashMap<String, String>();

    String nextLine = "";
    while (!(nextLine = readLine(inputStream)).equals(""))
    {
      String values[] = nextLine.split(":", 2);
      headers.put(values[0], values[1].trim());
    }
    request.setHeaders(headers);

    if (headers.containsKey(Http.CONTENT_LENGTH))
    {
      int size = Integer.parseInt(headers.get(Http.CONTENT_LENGTH));
      byte[] data = new byte[size];
      int n;
      for (int i = 0; i < size && (n = inputStream.read()) != -1; i++)
      {
        data[i] = (byte) n;
      }
      request.setEntity(data);
    }
    else
    {
      request.setEntity(null);
    }

    return request;
  }
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

                    msgContext, format, new URL(epr.getAddress()));
            String path = (msgContext.isPropertyTrue(NhttpConstants.POST_TO_URI) ?
                    reqURI.toString() : reqURI.getPath() +
                    (reqURI.getQuery() != null ? "?" + reqURI.getQuery() : ""));

            httpRequest = new BasicHttpRequest(httpMethod, path,
                    msgContext.isPropertyTrue(NhttpConstants.FORCE_HTTP_1_0) ?
                            HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1);

            httpRequest.setHeader(HTTP.CONTENT_TYPE, messageFormatter.getContentType(
                    msgContext, format, msgContext.getSoapAction()));

        } else {

            httpRequest = new BasicHttpRequest(
                httpMethod,
                msgContext.isPropertyTrue(NhttpConstants.POST_TO_URI) ?
                    epr.getAddress() : new URL(epr.getAddress()).getPath(),
                msgContext.isPropertyTrue(NhttpConstants.FORCE_HTTP_1_0) ?
                    HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1);
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

        final String      uri = "/random/" + rsplen;

        ExecReqThread[] threads = new ExecReqThread [COUNT];
        for (int i=0; i<COUNT; i++) {

            HttpRequest request = new BasicHttpRequest
                ("GET", uri, HttpVersion.HTTP_1_1);

            ExecReqThread.RequestSpec ertrs = new ExecReqThread.RequestSpec();
            ertrs.executor = httpExecutor;
            ertrs.processor = httpProcessor;
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);

        // a new context is created for each testcase, no need to reset
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);

        // a new context is created for each testcase, no need to reset
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);

        // a new context is created for each testcase, no need to reset
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);

        // a new context is created for each testcase, no need to reset
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);

        // a new context is created for each testcase, no need to reset
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

                                          new ProxySelectorMockup(null));

        HttpHost target =
            new HttpHost("www.test.invalid", 80, "http");
        HttpRequest request =
            new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);

        HttpRoute route = hrp.determineRoute(target, request, null);

        assertEquals("wrong target", target, route.getTargetHost());
        assertEquals("not direct", 1, route.getHopCount());
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest

                                          new ProxySelectorMockup(proxies));

        HttpHost target =
            new HttpHost("www.test.invalid", 80, "http");
        HttpRequest request =
            new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);

        HttpRoute route = hrp.determineRoute(target, request, null);

        assertEquals("wrong target", target, route.getTargetHost());
        assertEquals("not via proxy", 2, route.getHopCount());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.