Package net.sf.sahi.response

Examples of net.sf.sahi.response.HttpFileResponse


      if (uri.indexOf("/dyn/stopserver") != -1) {
        sendResponseToBrowser(new NoCacheHttpResponse(200, "OK", "Killing Server"));
        System.exit(1);
      }
      String fileName = fileNamefromURI(uri);
      sendResponseToBrowser(new HttpFileResponse(fileName, null, false, false));
    } catch (FileIsDirectoryException dirEx) {
      try {
        if ("/".equals(uri)) uri = "/demo";
        if (uri.endsWith("/")) uri = uri.substring(0, uri.length() - 1);
        sendResponseToBrowser(new NoCacheHttpResponse(200, "OK", "<script>location.href='"+uri+"/index.htm'</script>"));
View Full Code Here


    public void add(final HttpRequest request) {
        request.session().mockResponder().add(request.getParameter("pattern"), request.getParameter("class"));
    }

    public HttpResponse mockImage(final HttpRequest request) throws IOException {
        return new HttpFileResponse(Utils.concatPaths(Configuration.getHtdocsRoot(), "spr/mock.gif"), null, true, true);
    }
View Full Code Here

    }

    public HttpResponse simple(final HttpRequest request) throws IOException {
        Properties props = new Properties();
        props.put("url", request.url());
        HttpResponse mockResponse = new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/simpleMock.htm", props, false, false);
        HttpResponse response = new HttpModifiedResponse2(mockResponse, request.isSSL(), request.fileExtension());
//    response.addFilter(new ChunkedFilter());
    return response;
    }
View Full Code Here

        } catch(Exception e) {
          logger.info(Utils.getStackTraceString(e));
        }
        props.put("message", message);
      }
      response = getWrappedResponse(new HttpFileResponse(Configuration.getHtdocsRoot() + "/spr/401.htm", props, false, false));
      response.headers().addHeaders("Set-Cookie", cookieHeaders);
    }
    return response;
  }
View Full Code Here

  private HttpResponse getFileDownloadedResponse(String fileName) {
    Properties props = new Properties();
    props.put("fileName", "" + fileName);
   
    return new HttpFileResponse(
        Configuration.getHtdocsRoot() + "spr/downloaded.htm",
        props, false, true);
  }
View Full Code Here

      logger.info("Caught: " + Utils.getStackTraceString(e));
      message = "";
    }
    props.put("message", message);
   
    return new HttpFileResponse(
        Configuration.getHtdocsRoot() + "spr/5xx.htm",
        props, false, true);
  }
View Full Code Here

    private HttpResponse getCannotConnectResponse(Exception e) {
    try {
      Properties props = new Properties();
      props.put("message", "" + e.getMessage());
      props.put("exception", "" + Utils.getStackTraceString(e, true));
      final HttpFileResponse httpFileResponse = new HttpFileResponse(
          Configuration.getHtdocsRoot() + "spr/cannotConnect.htm",
          props, false, true);
      return httpFileResponse;
    } catch (Exception e1) {
      logger.warning("Could not send getCannotConnectResponse");
View Full Code Here

import net.sf.sahi.response.SimpleHttpResponse;
import net.sf.sahi.util.Utils;

public class ConfigureUI {
  public HttpResponse execute(HttpRequest request) {
    return new HttpFileResponse(Configuration.getHtdocsRoot() + "/spr/manage/configureUI.htm");
  }
View Full Code Here

    private HttpResponse proxyAutoResponse(final String startUrl, final String sessionId) {
        Properties props = new Properties();
        props.setProperty("startUrl", startUrl);
        props.setProperty("sessionId", sessionId);
        return new NoCacheHttpResponse(new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/auto.htm", props, false, true));
    }
View Full Code Here

* limitations under the License.
*/
public class ImageMock {

    public HttpResponse execute(final HttpRequest request) {
        return new HttpFileResponse(Utils.concatPaths(Configuration.getHtdocsRoot(), "spr/mock.gif"), null, true, true);
    }
View Full Code Here

TOP

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

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.