Package org.apache.http

Examples of org.apache.http.HttpException


        if (response == null) {
            throw new IllegalArgumentException("HTTP response may not be null");
        }
        assertNotClosed();
        if (this.response != null) {
            throw new HttpException("Response already submitted");
        }
        this.responseWriter.write(response);
        this.hasBufferedOutput = this.outbuf.hasData();

        if (response.getStatusLine().getStatusCode() >= 200) {
View Full Code Here


                    final NHttpResponseTrigger trigger,
                    final HttpContext context) throws HttpException, IOException {
                String s = request.getRequestLine().getUri();
                int idx = s.indexOf('x');
                if (idx == -1) {
                    throw new HttpException("Unexpected request-URI format");
                }
                String pattern = s.substring(0, idx);
                int count = Integer.parseInt(s.substring(idx + 1, s.length()));
               
                StringBuilder buffer = new StringBuilder();
View Full Code Here

            @Override
            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
                throw new HttpException(request.getRequestLine().getUri());
            }

        };

        NHttpRequestExecutionHandler requestExecutionHandler = new TestRequestExecutionHandler() {
View Full Code Here

                new Thread() {
                    @Override
                    public void run() {
                        try { Thread.sleep(10); } catch(InterruptedException ie) {}
                        trigger.handleException(
                                new HttpException(request.getRequestLine().getUri()));
                    }
                }.start();
            }

        };
View Full Code Here

                String s = request.getRequestLine().getUri();
                URI uri;
                try {
                    uri = new URI(s);
                } catch (URISyntaxException ex) {
                    throw new HttpException("Invalid request URI: " + s);
                }
                int index = Integer.parseInt(uri.getQuery());
                byte[] data = (byte []) testData.get(index);
                ByteArrayEntity entity = new ByteArrayEntity(data);
                response.setEntity(entity);
View Full Code Here

                String s = request.getRequestLine().getUri();
                URI uri;
                try {
                    uri = new URI(s);
                } catch (URISyntaxException ex) {
                    throw new HttpException("Invalid request URI: " + s);
                }
                int index = Integer.parseInt(uri.getQuery());

                byte[] data = (byte []) testData.get(index);
                ByteArrayEntity entity = new ByteArrayEntity(data);
View Full Code Here

                String s = request.getRequestLine().getUri();
                URI uri;
                try {
                    uri = new URI(s);
                } catch (URISyntaxException ex) {
                    throw new HttpException("Invalid request URI: " + s);
                }
                int index = Integer.parseInt(uri.getQuery());
                byte[] data = (byte []) testData.get(index);
                ByteArrayEntity entity = new ByteArrayEntity(data);
                response.setEntity(entity);
View Full Code Here

        if (response == null) {
            throw new IllegalArgumentException("HTTP response may not be null");
        }
        assertNotClosed();
        if (this.response != null) {
            throw new HttpException("Response already submitted");
        }
        this.lineBuffer.clear();
        BasicStatusLine.format(this.lineBuffer, response.getStatusLine());
        this.outbuf.writeLine(this.lineBuffer);
        for (Iterator it = response.headerIterator(); it.hasNext(); ) {
View Full Code Here

        if (request == null) {
            throw new IllegalArgumentException("HTTP request may not be null");
        }
        assertNotClosed();
        if (this.request != null) {
            throw new HttpException("Request already submitted");
        }
        this.lineBuffer.clear();
        BasicRequestLine.format(this.lineBuffer, request.getRequestLine());
        this.outbuf.writeLine(this.lineBuffer);
        for (Iterator it = request.headerIterator(); it.hasNext(); ) {
View Full Code Here

                    Credentials creds = credsProvider.getCredentials(
                        new AuthScope(
                        targetHost.getHostName(),
                        targetHost.getPort() ) );
                    if( creds == null ) {
                        throw new HttpException( "No credentials for preemptive authentication" );
                    }
                    authState.setAuthScheme( authScheme );
                    authState.setCredentials( creds );
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.http.HttpException

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.