Package net.sf.sahi.response

Examples of net.sf.sahi.response.NoCacheHttpResponse


        request.session().setIsWindowOpen(false);
    }

    public HttpResponse getSahiScript(final HttpRequest request) {
        String code = request.getParameter("code");
        return new NoCacheHttpResponse(Utils.encode(SahiScript.modifyFunctionNames(code)));
    }
View Full Code Here


        String code = request.getParameter("code");
        return new NoCacheHttpResponse(Utils.encode(SahiScript.modifyFunctionNames(code)));
    }

    public HttpResponse scriptsList(final HttpRequest request) {
        return new NoCacheHttpResponse(ScriptUtil.getScriptsJs(getScriptPath(request.session())));
    }
View Full Code Here

    public HttpResponse scriptsList(final HttpRequest request) {
        return new NoCacheHttpResponse(ScriptUtil.getScriptsJs(getScriptPath(request.session())));
    }

    public HttpResponse scriptDirsList(final HttpRequest request) {
        return new NoCacheHttpResponse(ScriptUtil.getScriptRootsJs(request.session().getRecorder().getDir()));
    }
View Full Code Here

        return new NoCacheHttpResponse(ScriptUtil.getScriptRootsJs(request.session().getRecorder().getDir()));
    }
   
  public HttpResponse scriptDirsListJSON(final HttpRequest request) {
    String[] fileList = Configuration.getScriptRoots();
    return new NoCacheHttpResponse(Utils.toJSON(fileList));
  }
View Full Code Here

  }

  public HttpResponse scriptsListJSON(final HttpRequest request) {
    String dir = request.getParameter("dir");
    String[] fileList = ScriptUtil.getScriptFiles(dir);
    return new NoCacheHttpResponse(Utils.toJSON(fileList));
  }
View Full Code Here

   
    public HttpResponse getChangeLog(final HttpRequest request){
      String dataStr = new String(Utils.readFileAsString(Configuration.getChangeLogFilePath()));
      dataStr = dataStr.replace("\r\n", "\n").replace("\r", "\n").replace("\n", "<br/>");
      dataStr = dataStr.replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
    return new NoCacheHttpResponse(dataStr);
    }
View Full Code Here

        Class<?> clazz;
        try {
            clazz = ClassLoadHelper.getClass(commandClass);
            final Method method = clazz.getDeclaredMethod(commandMethod, new Class[]{HttpRequest.class});
            final Object returned = method.invoke(clazz.newInstance(), new Object[]{request});
            return returned == null ? new NoCacheHttpResponse() : (HttpResponse) returned;
        } catch (Exception e) {
          logger.warning("commandClass = >"+commandClass + "< commandMethod = >" + commandMethod + "<");
          logger.warning(Utils.getStackTraceString(e));
            return new NoCacheHttpResponse("SAHI_ERROR");
        }
    }
View Full Code Here

    public HttpResponse status(final HttpRequest request) {
        Session session = request.session();
        Status status = session.getStatus();
        if (status == null) status = Status.FAILURE;
        return new NoCacheHttpResponse(status.getName());
    }
View Full Code Here

    }

    public HttpResponse getRecordedSteps(HttpRequest request){
        Session session = request.session();
        String steps = session.getVariable("CONTROLLER_RecordedSteps");
        return new NoCacheHttpResponse(steps == null ? "" : steps);
    }
View Full Code Here

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

public class LocalRequestProcessor {
    public HttpResponse getLocalResponse(String uri, HttpRequest requestFromBrowser) throws Exception {
        HttpResponse httpResponse = new NoCacheHttpResponse("");
        if (uri.indexOf("/dyn/pro/") != -1) {
//          httpResponse = handleDyn(uri, requestFromBrowser, httpResponse, true);
          httpResponse = new SimpleHttpResponse("This feature is available only in Sahi Pro");
        } 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

TOP

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

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.