Package net.sf.sahi.response

Examples of net.sf.sahi.response.HttpFileResponse


public class Cookies {
  public HttpResponse showAll(final HttpRequest request) {
    final String cookies = getCookies(request);
        Properties props = new Properties();
        props.setProperty("cookies", cookies);
        return new HttpModifiedResponse2(new HttpFileResponse(Utils.concatPaths(Configuration.getHtdocsRoot(), "spr/cookies.htm"), props, false, false)
            , request.isSSL(), "htm"
        );
  }
View Full Code Here


        domains = sb.toString().replace('_', '.');
      }
        Properties props = new Properties();
        props.setProperty("domains", domains);
        props.setProperty("commonDomain", Configuration.getCommonDomain());
        return new HttpFileResponse(Utils.concatPaths(Configuration.getHtdocsRoot(), "spr/manage/ssl/manager.htm"),
            props, true, true);
    }
View Full Code Here

    public HttpResponse success(final HttpRequest request) {
        Properties props = new Properties();
        props.setProperty("domain", request.getParameter("domain"));
       
        props.setProperty("commonDomain", Configuration.getCommonDomain());
        return new HttpFileResponse(Utils.concatPaths(Configuration.getHtdocsRoot(), "spr/manage/ssl/success.htm"),
            props, true, true);
    }
View Full Code Here

    session.setIsReadyForDriver(true);
    String startUrl = request.getParameter("startUrl");
    Properties properties = new Properties();
    if (startUrl == null) startUrl = "";
    properties.setProperty("startUrl", Utils.replaceLocalhostWithMachineName(startUrl));
      HttpFileResponse httpFileResponse = new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/initialized.htm", properties, false, true);
    HttpModifiedResponse2 response = new HttpModifiedResponse2(httpFileResponse, false, "htm");
//        response.addFilter(new ChunkedFilter());
    return response;
    }      
View Full Code Here

import net.sf.sahi.request.HttpRequest;

public class FileReader {

    public HttpResponse contents(final HttpRequest request) {
        return new HttpFileResponse(request.getParameter("fileName"));
    }
View Full Code Here

    }

    private HttpFileResponse proxyAlertResponse(final String msg) {
        Properties props = new Properties();
        props.setProperty("msg", msg);
        return new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/alert.htm", props, false, true);
    }
View Full Code Here

    }

    private HttpFileResponse proxyConfirmResponse(final String msg) {
        Properties props = new Properties();
        props.setProperty("msg", msg);
        return new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/confirm.htm", props, false, true);
    }
View Full Code Here

        } else if (uri.indexOf("/dyn/") != -1) {
            httpResponse = handleDyn(uri, requestFromBrowser, httpResponse, false);
        } else if (uri.indexOf("/scripts/") != -1) {
            String fileName = URLParser.scriptFileNamefromURI(
                    requestFromBrowser.uri(), "/scripts/");
            httpResponse = new HttpFileResponse(fileName, null, false, false);
        } else if (uri.indexOf("/spr/") != -1) {
            String fileName = URLParser.fileNamefromURI(requestFromBrowser.uri());
            httpResponse = new HttpFileResponse(fileName, null, true, true);
        } else if (uri.indexOf("/sprm/") != -1) {
            String fileName = URLParser.fileNamefromURI(requestFromBrowser.uri().replace("/sprm/", "/spr/"));
            httpResponse = new HttpModifiedResponse2(new HttpFileResponse(fileName, null, true, true), requestFromBrowser.isSSL(), requestFromBrowser.fileExtension());
        else if (uri.indexOf("/logs") != -1) {
            httpResponse = new NoCacheHttpResponse(LogViewer.getLogsList(Configuration.getPlayBackLogsRoot()));
        } else {
            httpResponse = new HttpFileResponse(Configuration.getHtdocsRoot() + "/spr/launch.htm");
        }
        return httpResponse;
    }
View Full Code Here

                    processLocally(uri, requestFromBrowser);
                } else {
                    if (isHostTheProxy(requestFromBrowser.host()) && requestFromBrowser.port() == Configuration.getPort()) {
                        processLocally(uri, requestFromBrowser);
                    } else if (uri.indexOf("favicon.ico") != -1) {
                        sendResponseToBrowser(new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/favicon.ico"));
                    } else {
                        processAsProxy(requestFromBrowser);
                    }
                }
            } else {
View Full Code Here

        Properties props = new Properties();
        props.put("responseCode", "500");
        props.put("time", "" + (new Date()));
        props.put("message", Utils.getStackTraceString(e, true));
       
        httpResponse = new HttpFileResponse(
            Configuration.getHtdocsRoot() + "spr/5xx.htm",
            props, false, true);
      }
        sendResponseToBrowser(httpResponse);
    }
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.