Examples of IHttpRequestHandler


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 {
                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.getBody().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.getBody().readString()));
            }
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

        RequestHandlerChain chain = new RequestHandlerChain();
       
        File file = QAUtil.createTestfile_400k();
        String basepath = file.getParentFile().getAbsolutePath();
       
        IHttpRequestHandler businessHandler = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
                exchange.send(new HttpResponse(200, "text/plain", "OK"));
            }
        };
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

  
  @Test
  public void testGetWithExpireHeader() 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");
                exchange.send(resp);
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

 
  @Ignore
    @Test
    public void testGetWithExpireHeaderAndPOST() 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");
                exchange.send(resp);
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

 

    @Test
    public void testGetWithExpireAndCacheControlHeader() 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=21600");
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

   
   
    @Test
    public void testNegativeExpired() 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", "-1");
                exchange.send(resp);
View Full Code Here

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

public final class HttpClientDoubleCacheHandlerTest  {

    @Test
    public void testGetWithExpireHeader() 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");
                exchange.send(resp);
View Full Code Here

Examples of org.xlightweb.IHttpRequestHandler

public final class HttpClientDoubleCacheHandlerTest  {

    @Test
    public void testGetWithExpireHeader() 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");
                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.