Examples of IHttpRequestHandler


Examples of org.xlightweb.IHttpRequestHandler


    @Test
    public void testGetAlreadyExpired() throws Exception {
       
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
                HttpResponse resp = new HttpResponse(200, "text/plain", "test");
                resp.setHeader("Expires", "Fri, 30 Oct 2011 14:19:41 GMT");
                resp.setHeader("Cache-Control", "public, max-age=1");
View Full Code Here

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

        server.start();
     
        HttpClient client = new HttpClient();
       
       
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
       
               
                IHttpResponseHandler respHdl = new IHttpResponseHandler() {
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

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

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

Examples of org.xlightweb.IHttpRequestHandler

        System.setProperty("org.xlightweb.showDetailedError", "true");
       
        RequestHandlerChain chain = new RequestHandlerChain();

       
        IHttpRequestHandler rh = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
               
                BodyDataSink dataSink = exchange.forward(request.getRequestHeader());
                dataSink.write("addedLine\r\n");
                dataSink.write(request.getBlockingBody().readString());
                dataSink.close();
            }
        };
        chain.addLast(rh);
       
       
        IHttpRequestHandler rh2 = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
                IHttpRequest request = exchange.getRequest();
                exchange.send(new HttpResponse(200, request.getBlockingBody().readString()));
            }
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

  public void testReplaceRequest() throws Exception {
      System.out.println("testReplaceRequest");
 
    RequestHandlerChain chain = new RequestHandlerChain();
   
    IHttpRequestHandler filter = new IHttpRequestHandler() {

      public void onRequest(final IHttpExchange exchange) throws IOException {

        PostRequest newRequest = new PostRequest(exchange.getRequest().getRequestUrl().toString(), "text/plain", "Hello");
       
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

      System.setProperty("org.xlightweb.showDetailedError", "true");

     
    RequestHandlerChain chain = new RequestHandlerChain();
   
    IHttpRequestHandler filter = new IHttpRequestHandler() {

      public void onRequest(final IHttpExchange exchange) throws IOException {
       
        IHttpResponseHandler respHdl = new IHttpResponseHandler() {
       
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

  public void testReplaceResponse() throws Exception {
      System.out.println("testReplaceResponse");
 
    RequestHandlerChain chain = new RequestHandlerChain();
   
    IHttpRequestHandler filter = new IHttpRequestHandler() {

      public void onRequest(final IHttpExchange exchange) throws IOException {

        IHttpResponseHandler respHdl = new IHttpResponseHandler() {
       
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

  public void testReplaceResponseChunked() throws Exception {
      System.out.println("testReplaceResponseChunked");
 
    RequestHandlerChain chain = new RequestHandlerChain();
   
    IHttpRequestHandler filter = new IHttpRequestHandler() {

      public void onRequest(final IHttpExchange exchange) throws IOException {

        IHttpResponseHandler respHdl = new IHttpResponseHandler() {
       
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

  public void testReplaceResponseBound() throws Exception {
      System.out.println("testReplaceResponseBound");
 
    RequestHandlerChain chain = new RequestHandlerChain();
   
    IHttpRequestHandler filter = new IHttpRequestHandler() {

      public void onRequest(final IHttpExchange exchange) throws IOException {

        IHttpResponseHandler respHdl = new IHttpResponseHandler() {
       
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.