Examples of StreamingHttpResponse


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

Examples of net.sf.sahi.response.StreamingHttpResponse

    }
    return new HttpResponse(inputStreamFromHost, connection);
  }

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

Examples of net.sf.sahi.response.StreamingHttpResponse

      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

Examples of net.sf.sahi.response.StreamingHttpResponse

  }

   
  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
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.