Package ch.mimo.netty.handler.codec.icap

Examples of ch.mimo.netty.handler.codec.icap.DefaultIcapResponse


      IcapRequest request = (IcapRequest)message;
      System.out.println("");
      System.out.println("---------------------------- receiving " + request.getMethod() + " ----------------------------");
      System.out.print(message.toString());
      if(request.getMethod().equals(IcapMethod.OPTIONS)) {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
        response.addHeader("Options-TTL","3600");
        response.addHeader("Service-ID","Test Icap Server");
        response.addHeader("Allow","204");
        response.addHeader("Preview","1024");
        response.addHeader("Methods","REQMOD, RESPMOD");
       
      } else if(request.isPreviewMessage()) {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.NO_CONTENT);
      } else {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
        response.addHeader(IcapHeaders.Names.ISTAG,"Echo-Server-1.0");
        if(request.getMethod().equals(IcapMethod.REQMOD)) {
          response.setHttpRequest(request.getHttpRequest());
        }
        response.setHttpResponse(request.getHttpResponse());
View Full Code Here


    } else if(msg instanceof IcapChunkTrailer) {
      System.out.println(msg.toString());
      if(!continueWasSent) {
        continueWasSent = true;
        // sending 100 continue in order to receive the rest of the message
        IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.CONTINUE);
        ctx.getChannel().write(response);
      } else {
        // sending 204 No Content response
        IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.NO_CONTENT);
        ctx.getChannel().write(response);
      }
    } else if(msg instanceof IcapChunk) {
      System.out.println(msg);
    }
View Full Code Here

  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    IcapRequest request = (IcapRequest)e.getMessage();
   
    System.out.println(request.toString());
   
    IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
    IcapMessageElementEnum bodyType = request.getBodyType();
    if(bodyType == null) {
      bodyType = IcapMessageElementEnum.NULLBODY;
    }
   
    if(!request.getMethod().equals(IcapMethod.RESPMOD) & request.getHttpRequest() != null) {
      request.getHttpRequest().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpRequest(request.getHttpRequest());
    }
    if(request.getHttpResponse() != null) {
      request.getHttpResponse().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpResponse(request.getHttpResponse());
    }
    response.addHeader(IcapHeaders.Names.ISTAG,"SimpleServer-version-1.0");
   
    ChannelBuffer buffer = null;
    switch (bodyType) {
    case NULLBODY:
      // No body in request
View Full Code Here

  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    IcapRequest request = (IcapRequest)e.getMessage();
   
    System.out.println(request.toString());
   
    IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
    IcapMessageElementEnum bodyType = request.getBody();
   
    if(request.getHttpRequest() != null) {
      request.getHttpRequest().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpRequest(request.getHttpRequest());
    }
    if(request.getHttpResponse() != null) {
      request.getHttpResponse().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpResponse(request.getHttpResponse());
    }
    response.addHeader(IcapHeaders.Names.ISTAG,"SimpleServer-version-1.0");
   
    ChannelBuffer buffer = null;
    switch (bodyType) {
    case NULLBODY:
      // No body in request
View Full Code Here

      IcapRequest request = (IcapRequest)message;
      System.out.println("");
      System.out.println("---------------------------- receiving " + request.getMethod() + " ----------------------------");
      System.out.print(message.toString());
      if(request.getMethod().equals(IcapMethod.OPTIONS)) {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
        response.addHeader("Options-TTL","3600");
        response.addHeader("Service-ID","Test Icap Server");
        response.addHeader("Allow","204");
        response.addHeader("Preview","1024");
        response.addHeader("Methods","REQMOD, RESPMOD");
       
      } else if(request.isPreviewMessage()) {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.NO_CONTENT);
      } else {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
        response.addHeader(IcapHeaders.Names.ISTAG,"Echo-Server-1.0");
        if(request.getMethod().equals(IcapMethod.REQMOD)) {
          response.setHttpRequest(request.getHttpRequest());
        }
        response.setHttpResponse(request.getHttpResponse());
View Full Code Here

    } else if(msg instanceof IcapChunkTrailer) {
      System.out.println(msg.toString());
      if(!continueWasSent) {
        continueWasSent = true;
        // sending 100 continue in order to receive the rest of the message
        IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.CONTINUE);
        ctx.getChannel().write(response);
      } else {
        // sending 204 No Content response
        IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.NO_CONTENT);
        ctx.getChannel().write(response);
      }
    } else if(msg instanceof IcapChunk) {
      System.out.println(msg);
    }
View Full Code Here

  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    IcapRequest request = (IcapRequest)e.getMessage();
   
    System.out.println(request.toString());
   
    IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
    IcapMessageElementEnum bodyType = request.getBodyType();
    if(bodyType == null) {
      bodyType = IcapMessageElementEnum.NULLBODY;
    }
   
    if(!request.getMethod().equals(IcapMethod.RESPMOD) & request.getHttpRequest() != null) {
      request.getHttpRequest().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpRequest(request.getHttpRequest());
    }
    if(request.getHttpResponse() != null) {
      request.getHttpResponse().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpResponse(request.getHttpResponse());
    }
    response.addHeader(IcapHeaders.Names.ISTAG,"SimpleServer-version-1.0");
   
    ChannelBuffer buffer = null;
    switch (bodyType) {
    case NULLBODY:
      // No body in request
View Full Code Here

  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    IcapRequest request = (IcapRequest)e.getMessage();
   
    System.out.println(request.toString());
   
    IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
    IcapMessageElementEnum bodyType = request.getBodyType();
    if(bodyType == null) {
      bodyType = IcapMessageElementEnum.NULLBODY;
    }
   
    if(!request.getMethod().equals(IcapMethod.RESPMOD) & request.getHttpRequest() != null) {
      request.getHttpRequest().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpRequest(request.getHttpRequest());
    }
    if(request.getHttpResponse() != null) {
      request.getHttpResponse().addHeader(HttpHeaders.Names.VIA,"icap://my.icap.server");
      response.setHttpResponse(request.getHttpResponse());
    }
    response.addHeader(IcapHeaders.Names.ISTAG,"SimpleServer-version-1.0");
   
    ChannelBuffer buffer = null;
    switch (bodyType) {
    case NULLBODY:
      // No body in request
View Full Code Here

      IcapRequest request = (IcapRequest)message;
      System.out.println("");
      System.out.println("---------------------------- receiving " + request.getMethod() + " ----------------------------");
      System.out.print(message.toString());
      if(request.getMethod().equals(IcapMethod.OPTIONS)) {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
        response.addHeader("Options-TTL","3600");
        response.addHeader("Service-ID","Test Icap Server");
        response.addHeader("Allow","204");
        response.addHeader("Preview","1024");
        response.addHeader("Methods","REQMOD, RESPMOD");
       
      } else if(request.isPreviewMessage()) {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.NO_CONTENT);
      } else {
        response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.OK);
        response.addHeader(IcapHeaders.Names.ISTAG,"Echo-Server-1.0");
        if(request.getMethod().equals(IcapMethod.REQMOD)) {
          response.setHttpRequest(request.getHttpRequest());
        }
        response.setHttpResponse(request.getHttpResponse());
View Full Code Here

    } else if(msg instanceof IcapChunkTrailer) {
      System.out.println(msg.toString());
      if(!continueWasSent) {
        continueWasSent = true;
        // sending 100 continue in order to receive the rest of the message
        IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.CONTINUE);
        ctx.getChannel().write(response);
      } else {
        // sending 204 No Content response
        IcapResponse response = new DefaultIcapResponse(IcapVersion.ICAP_1_0,IcapResponseStatus.NO_CONTENT);
        ctx.getChannel().write(response);
      }
    } else if(msg instanceof IcapChunk) {
      System.out.println(msg);
    }
View Full Code Here

TOP

Related Classes of ch.mimo.netty.handler.codec.icap.DefaultIcapResponse

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.