Package org.xlightweb

Examples of org.xlightweb.IHttpRequestHandler


   

    @Test
    public void testManualContinueTwice() throws Exception {

        IHttpRequestHandler hdl = new IHttpRequestHandler() {

            @Supports100Continue
            public void onRequest(IHttpExchange exchange) throws IOException {
                exchange.sendContinueIfRequested();
                exchange.sendContinueIfRequested();
View Full Code Here


   
   
    @Test
    public void testAutoContinueWithInterceptor() throws Exception {

        IHttpRequestHandler interceptor = new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted", "true");
               
View Full Code Here

   
    @Test
    public void testAutoContinueWithNestedInterceptor() throws Exception {
       
        IHttpRequestHandler interceptor = new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted1", "true");
               
                IHttpResponseHandler hdl = new IHttpResponseHandler() {
                   
                    public void onResponse(IHttpResponse response) throws IOException {
                        response.addHeader("X-Intercepted1", "true");
                        exchange.send(response);
                    }
                   
                    public void onException(IOException ioe) throws IOException {
                        exchange.sendError(ioe);
                    }
                };
               
                exchange.forward(request, hdl);
               
            }
        };
       

        IHttpRequestHandler interceptor2 = new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted2", "true");
               
View Full Code Here


    @Test
    public void testAutoContinueWithNestedInterceptor2() throws Exception {

        IHttpRequestHandler interceptor = new IHttpRequestHandler() {

            @Supports100Continue
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted1", "true");
               
                IHttpResponseHandler hdl = new IHttpResponseHandler() {
                   
                    public void onResponse(IHttpResponse response) throws IOException {
                        response.addHeader("X-Intercepted1", "true");
                        exchange.send(response);
                    }
                   
                    public void onException(IOException ioe) throws IOException {
                        exchange.sendError(ioe);
                    }
                };
               
                exchange.forward(request, hdl);
               
            }
        };
       

        IHttpRequestHandler interceptor2 = new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted2", "true");
               
View Full Code Here

   
   
    @Test
    public void testManualContinueWithNestedInterceptor() throws Exception {
       
        IHttpRequestHandler interceptor = new IHttpRequestHandler() {

            @Supports100Continue
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted1", "true");
               
                IHttpResponseHandler hdl = new IHttpResponseHandler() {
                   
                    public void onResponse(IHttpResponse response) throws IOException {
                        response.addHeader("X-Intercepted1", "true");
                        exchange.send(response);
                    }
                   
                    public void onException(IOException ioe) throws IOException {
                        exchange.sendError(ioe);
                    }
                };
               
                exchange.forward(request, hdl);
               
            }
        };
       

        IHttpRequestHandler interceptor2 = new IHttpRequestHandler() {

            @Supports100Continue
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted2", "true");
View Full Code Here

   
   
    @Test
    public void testManualContinueWithNonAnnotatedInterceptor() throws Exception {

        IHttpRequestHandler interceptor = new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted", "true");
               
View Full Code Here

   
    @Test
    public void testManualContinueWithAnnotatedInterceptor() throws Exception {

        IHttpRequestHandler interceptor = new IHttpRequestHandler() {
           
            @Supports100Continue
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                request.addHeader("X-Intercepted", "true");
View Full Code Here

        RequestHandler reqHdl = new RequestHandler();       
        final HttpServer server = new HttpServer(reqHdl);
        server.start();

       
        IHttpRequestHandler proxyHdl =  new IHttpRequestHandler() {
           
            private HttpClient httpClient = new HttpClient();
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
               
View Full Code Here

        final HttpClient httpClient = new HttpClient();
        httpClient.setFollowsRedirectMode(FollowsRedirectMode.ALL);
        httpClient.setCacheMaxSizeKB(1000);
       
       
        IHttpRequestHandler proxyHdl =  new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
               
                IHttpResponseHandler respHdl = new IHttpResponseHandler() {
                   
View Full Code Here

    public void testStreamedResponse() throws Exception {
     
        RequestHandlerChain chain = new RequestHandlerChain();

       
        IHttpRequestHandler rh = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
                exchange.getRequest();
               
                BodyDataSink dataSink = exchange.send(new HttpResponseHeader(200));
View Full Code Here

TOP

Related Classes of org.xlightweb.IHttpRequestHandler

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.