Examples of HttpVersion


Examples of org.apache.http.HttpVersion

            throw new ProtocolException("Transfer-encoding header already present");
        }
        if (response.containsHeader(HTTP.CONTENT_LEN)) {
            throw new ProtocolException("Content-Length header already present");
        }
        HttpVersion ver = response.getStatusLine().getHttpVersion();
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            long len = entity.getContentLength();
            if (entity.isChunked() && ver.greaterEquals(HttpVersion.HTTP_1_1)) {
                response.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
            } else if (len >= 0) {
                response.addHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
            }
            // Specify a content type if known
View Full Code Here

Examples of org.apache.mina.http.api.HttpVersion

            generalHeaders.put(header[0].toLowerCase(), header[1].trim());
        }

        String[] elements = REQUEST_LINE_PATTERN.split(requestLine);
        HttpMethod method = HttpMethod.valueOf(elements[0]);
        HttpVersion version = HttpVersion.fromString(elements[2]);
        String[] pathFrags = QUERY_STRING_PATTERN.split(elements[1]);
        String requestedPath = pathFrags[0];

        // we put the buffer position where we found the beginning of the HTTP body
        buffer.position(headersAndBody[0].length() + 4);
View Full Code Here

Examples of org.eclipse.jetty.http.HttpVersion

    protected abstract void send(HttpExchange exchange);

    protected void normalizeRequest(Request request)
    {
        String method = request.getMethod();
        HttpVersion version = request.getVersion();
        HttpFields headers = request.getHeaders();
        ContentProvider content = request.getContent();
        ProxyConfiguration.Proxy proxy = destination.getProxy();

        // Make sure the path is there
        String path = request.getPath();
        if (path.trim().length() == 0)
        {
            path = "/";
            request.path(path);
        }
        if (proxy != null && !HttpMethod.CONNECT.is(method))
        {
            path = request.getURI().toString();
            request.path(path);
        }

        // If we are HTTP 1.1, add the Host header
        if (version.getVersion() > 10)
        {
            if (!headers.containsKey(HttpHeader.HOST.asString()))
                headers.put(getHttpDestination().getHostField());
        }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.HttpVersion

   * Creates a response builder
   * txn-status is complete by default
   */
  public ResponseBuilder() {
    response = new DefaultHttpResponse(
        new HttpVersion("STREST", 0, 1, true), HttpResponseStatus.OK);
    this.txnStatus(StrestUtil.HEADERS.TXN_STATUS_VALUES.COMPLETE);
  }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.HttpVersion

    }
  }
 
  public RequestBuilder() {
    request = new DefaultHttpRequest(
        new HttpVersion("STREST", 0, 1, true), HttpMethod.GET, "/");
    this.txnId(StrestUtil.generateTxnId());
    this.txnAccept(StrestUtil.HEADERS.TXN_ACCEPT_VALUES.MULTI);
  }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.HttpVersion

  }
 
  public static HttpRequest create(HttpMethod method, String action) throws URISyntaxException {
    URI uri = new URI(action);
    HttpRequest request = new DefaultHttpRequest(
        new HttpVersion("STREST", 0, 1, true), method, uri.toASCIIString());
       
//        request.setHeader(HttpHeaders.Names.ACCEPT_ENCODING, HttpHeaders.Values.GZIP);
        request.setHeader(StrestUtil.HEADERS.TXN_ID, generateTxnId());
        request.setProtocolVersion(new HttpVersion("STREST", 0, 1, true));
        return request;
  }
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.