Package net.sf.sahi.response

Examples of net.sf.sahi.response.StreamingHttpResponse


  private HttpResponse getResponse(InputStream inputStreamFromHost, HttpURLConnection connection) throws IOException {
    final String contentType = connection.getContentType();
    if (useStreaming || (contentType != null && (contentType.contains("video")))){
      logger.info("Using streaming response for contentType: " + contentType);
      return new StreamingHttpResponse(inputStreamFromHost, connection);
    }
    return new HttpResponse(inputStreamFromHost, connection);
  }
View Full Code Here


    }
    return new HttpResponse(inputStreamFromHost, connection);
  }

    private HttpResponse getWrappedResponse(HttpResponse response){
      if (useStreaming) return new StreamingHttpResponse(response);
      return response;
    }
View Full Code Here

      return response;
    }
   
  private HttpResponse addFilters(HttpRequest requestFromBrowser, boolean modify, HttpResponse response, int responseCode) {
    if (response instanceof StreamingHttpResponse) {
      StreamingHttpResponse streamingResponse = (StreamingHttpResponse) response;
//      if (modify && !requestFromBrowser.isExcluded() && !requestFromBrowser.session().isAjaxRedirect(requestFromBrowser.url())) {
//        if (logger.isLoggable(Level.FINER)){
//          logger.finer("Modifying response with HttpModifiedResponse");
//        }
//        streamingResponse = new HttpModifiedResponse(streamingResponse, requestFromBrowser.isSSL(), requestFromBrowser
//            .fileExtension(), responseCode);
//      }
//      streamingResponse.addFilter(new TrafficLoggerFilter(TrafficLogger.getLoggerForThread()));
      streamingResponse.addFilter(new ChunkedFilter());
      return streamingResponse;
    } else {
      final Session session = requestFromBrowser.session();
      if (modify && !requestFromBrowser.isExcluded() && !session.isAjaxRedirect(requestFromBrowser.url())) {
        return new HttpModifiedResponse2(response, requestFromBrowser.isSSL(), requestFromBrowser.fileExtension(), responseCode);
View Full Code Here

  }

   
  public HttpResponse mockMe(HttpRequest request){
    HttpResponse response = new SimpleHttpResponse("<div>Hi there</div>");
    StreamingHttpResponse response2 = new HttpModifiedResponse(response, request.isSSL(), request.fileExtension());
    response2.addFilter(new ChunkedFilter());
    return response2;
 
View Full Code Here

TOP

Related Classes of net.sf.sahi.response.StreamingHttpResponse

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.