Examples of IHttpRequestHandler


Examples of org.xlightweb.IHttpRequestHandler

   
   
    @BeforeClass
    public static void setUp() throws Exception {
        IHttpRequestHandler hdl = new RequestHandler();
       
        proxyServer = new HttpServer(0, hdl);
        proxyServer.start();
       
        proxySslServer = new HttpServer(0, hdl, SSLTestContextFactory.getSSLContext(), true);
        proxySslServer.start();
       
       
        IHttpRequestHandler busiHdl = new BusinessRequestHandler();
        server = new HttpServer(0, busiHdl);
        server.start();
       
        sslServer = new HttpServer(0, busiHdl, SSLTestContextFactory.getSSLContext(), true);
        sslServer.start();
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

   
    @Test
    public void testManualContinue3() throws Exception {
       
       
        IHttpRequestHandler hdl = new IHttpRequestHandler() {
           
            @Supports100Continue
            public void onRequest(IHttpExchange exchange) throws IOException {
               
                exchange.send(new HttpResponse(100))// send continue
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

   

    @Test
    public void testManualContinueTwice() throws Exception {

        IHttpRequestHandler hdl = new IHttpRequestHandler() {

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

Examples of org.xlightweb.IHttpRequestHandler

   
   
    @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

Examples of org.xlightweb.IHttpRequestHandler

   
    @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

Examples of org.xlightweb.IHttpRequestHandler


    @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

Examples of org.xlightweb.IHttpRequestHandler

   
   
    @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

Examples of org.xlightweb.IHttpRequestHandler

   
   
    @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

Examples of org.xlightweb.IHttpRequestHandler

   
    @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

Examples of org.xlightweb.IHttpRequestHandler

  
  @Test
  public void testSimple() throws Exception {
     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
                HttpResponse resp = new HttpResponse(200, "text/plain", "test");
                resp.setHeader("Cache-Control", "public, max-age=1000");
                exchange.send(resp);
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.