Code example for HttpRequest

Methods: containsHeadergetRequestLine

0
    public void process(final HttpRequest request, final HttpContext context)
            throws HttpException, IOException { 
        if (request == null) {
            throw new IllegalArgumentException("HTTP request may not be null");
        } 
        if (context == null) {
            throw new IllegalArgumentException("HTTP context may not be null");
        } 
 
        ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
        String method = request.getRequestLine().getMethod();
        if (method.equalsIgnoreCase("CONNECT") && ver.lessEquals(HttpVersion.HTTP_1_0)) {
            return; 
        } 
 
        if (!request.containsHeader(HTTP.TARGET_HOST)) {
            HttpHost targethost = (HttpHost) context
                .getAttribute(ExecutionContext.HTTP_TARGET_HOST);
            if (targethost == null) {
                HttpConnection conn = (HttpConnection) context
                    .getAttribute(ExecutionContext.HTTP_CONNECTION);
Stop searching for code, let great code find you!  Add Codota to your java IDE