Package org.xlightweb

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


   
   
    @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

        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

    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

        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

  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

      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

  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

  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

  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

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.