Package net.sf.sahi.response

Examples of net.sf.sahi.response.SimpleHttpResponse


        Session session = request.session();
        SahiScript script = getScript(session);
        if (script != null) {
            return new Script().view(script.getFilePath());
        } else {
            return new SimpleHttpResponse(
                    "No Script has been set for playback.");
        }
    }
View Full Code Here


    public HttpResponse currentBrowserScript(final HttpRequest request) {
        Session session = request.session();
        HttpResponse httpResponse;
        if (session.getScriptRunner() != null && getScript(session) != null) {
            httpResponse = new SimpleHttpResponse(LogViewer.highlight(getScript(session).getBrowserJS(), -1));
        } else {
            httpResponse = new SimpleHttpResponse(
                    "No Script has been set for playback.");
        }
        return httpResponse;
    }
View Full Code Here

    public HttpResponse currentParsedScript(final HttpRequest request) {
        Session session = request.session();
        HttpResponse httpResponse;
        if (getScript(session) != null) {
            httpResponse = new SimpleHttpResponse("<pre>" + getScript(session).modifiedScript().replaceAll("\\\\r",
                    "").replaceAll("\\\\n", "<br>") + "</pre>");
        } else {
            httpResponse = new SimpleHttpResponse(
                    "No Script has been set for playback.");
        }
        return httpResponse;
    }
View Full Code Here

      scriptRunner.setBrowserRetries(Integer.parseInt(request.getParameter("retries")));
    }

    public HttpResponse getRetries(final HttpRequest request) {
      ScriptRunner scriptRunner = request.session().getScriptRunner();
      return new SimpleHttpResponse(scriptRunner != null ? "" + scriptRunner.getBrowserRetries() : "-1");
    }
View Full Code Here

      return new SimpleHttpResponse(scriptRunner != null ? "" + scriptRunner.getBrowserRetries() : "-1");
    }

    public HttpResponse hasErrors(final HttpRequest request) {
      ScriptRunner scriptRunner = request.session().getScriptRunner();
      return new SimpleHttpResponse("" + scriptRunner.hasErrors());
    }
View Full Code Here

import net.sf.sahi.util.Utils;

public class SessionState {

    public HttpResponse ping(final HttpRequest request) {
      return new SimpleHttpResponse(request.session().getInfoJSON());
    }
View Full Code Here

      return new SimpleHttpResponse(request.session().getInfoJSON());
    }
   
    public HttpResponse isPlaying(final HttpRequest request){
      Session session = request.session();
        return new SimpleHttpResponse(session.isPlaying() ? "1" : "0");     
    }  
View Full Code Here

    return new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/domainfix.js", props, false, true);
    }
   
    public HttpResponse isRecording(final HttpRequest request){
      Session session = request.session();
        return new SimpleHttpResponse(session.isRecording() ? "1" : "0");     
    }
View Full Code Here

    public HttpResponse getBrowserScript(final HttpRequest request) {
        HttpResponse httpResponse;
        String scriptPath = request.getParameter("href");
        SahiScript script = new ScriptFactory().getScript(scriptPath);
    if (script != null) {
            httpResponse = new SimpleHttpResponse(LogViewer.highlight(script.getBrowserJSWithLineNumbers(), getLineNumber(request)));
        } else {
            httpResponse = new SimpleHttpResponse(
                    "No Script has been set for playback.");
        }
        return httpResponse;
    }
View Full Code Here

          }catch(FileNotFoundRuntimeException e){
            content = "File ["+href+"] not found";
          }
        }
        content = content.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
        final SimpleHttpResponse response = new SimpleHttpResponse("");
        String highlighted = LogViewer.highlight(content, lineNumber);
        highlighted = ("<h4>" + href.replace("\\\\", "\\") + "</h4>").concat(highlighted);
    try {
      response.setData(highlighted.getBytes("UTF8"));
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
      response.setData(highlighted.getBytes());
    }
        response.resetRawHeaders();
        return response;
    }
View Full Code Here

TOP

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

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.