Package net.sf.sahi.response

Examples of net.sf.sahi.response.SimpleHttpResponse


            HttpResponse responseFromHost = null;
            try {
                responseFromHost = remoteRequestProcessor.processHttp(requestFromBrowser);
            } catch (Exception e) {
                e.printStackTrace();
                responseFromHost = new SimpleHttpResponse("");
            }
            if (responseFromHost == null) {
                responseFromHost = new SimpleHttpResponse("");
            }
//          System.out.println("Fetching >> :" + new String(requestFromBrowser.url()));
            sendResponseToBrowser(responseFromHost);
        }
    }
View Full Code Here


    public HttpResponse execute(final HttpRequest request) throws InterruptedException {
        String command = request.getParameter(RequestConstants.COMMAND);
        boolean isSynchronous = Boolean.toString(true).equals(request.getParameter(RequestConstants.SYNC));
        String exitStatus = executeSystemCommand(command, isSynchronous);
        return new SimpleHttpResponse(exitStatus);
    }
View Full Code Here

          props, false, true);
      return httpFileResponse;
    } catch (Exception e1) {
      logger.warning("Could not send getCannotConnectResponse");
      logger.warning(Utils.getStackTraceString(e1));
      return new SimpleHttpResponse("");
    }
    }
View Full Code Here

    Session session = request.session();
    session.setVariable("CONTROLLER_MessageForController", request.getParameter("message"));
  }
  public HttpResponse getMessageForController(HttpRequest request){
    Session session = request.session();
    return new SimpleHttpResponse(session.getVariable("CONTROLLER_MessageForController"));
  }
View Full Code Here

    Session session = request.session();
    String windowName = request.getParameter("windowName");
    String key = "CONTROLLER_MessageForBrowser" + "_" + windowName;
    String message = session.getVariable(key);
    session.setVariable(key, null);
    return new SimpleHttpResponse("" + message);
  }
View Full Code Here

    return new HttpFileResponse(Configuration.getHtdocsRoot() + "/spr/manage/configureUI.htm");
  }
 
  public HttpResponse readFile(HttpRequest request) {
    final String fileName = request.getParameter("fileName");
    return new SimpleHttpResponse(Utils.readFile(Configuration.getAbsoluteUserPath(fileName)));
  }
View Full Code Here

  }
  public HttpResponse view(HttpRequest request) {
    final String fileName = request.getParameter("fileName");
    final boolean useBase = "true".equals(request.getParameter("useBase"));
    final String path = useBase ?  Configuration.getAbsolutePath(fileName) : Configuration.getAbsoluteUserPath(fileName);
    return new SimpleHttpResponse(new String(Utils.readFileAsString(path)).replace("\r\n", "\n").replace("\n", "<br/>"));
  }
View Full Code Here

        scriptRunner.execute();
    }

    public HttpResponse isPlaying(final HttpRequest request){
        Session session = request.session();
        return new SimpleHttpResponse(session.isPlaying() ? "1" : "0");
//        ScriptRunner scriptRunner = session.getScriptRunner();
//      return new SimpleHttpResponse(scriptRunner != null && scriptRunner.getStatus() == Status.RUNNING ? "1" : "0");
    }
View Full Code Here

//      return new SimpleHttpResponse(scriptRunner != null && scriptRunner.getStatus() == Status.RUNNING ? "1" : "0");
    }
    public HttpResponse getCurrentStep(final HttpRequest request){
        Session session = request.session();
        ScriptRunner scriptRunner = session.getScriptRunner();
        if (scriptRunner == null) return new SimpleHttpResponse("{'type':'WAIT'}");
        String derivedName = request.getParameter("derivedName");
        String windowName = request.getParameter("windowName");
        String windowTitle = request.getParameter("windowTitle");
        String domain = request.getParameter("domain");
        String wasOpened = request.getParameter("wasOpened");
        //System.out.println("scriptRunner="+scriptRunner);
        return new SimpleHttpResponse(scriptRunner.getStepJSON(derivedName, windowName, windowTitle, domain, wasOpened));
    }
View Full Code Here

//        }
    }

    public HttpResponse check204(final HttpRequest request) {
        Session session = request.session();
        return new SimpleHttpResponse(""+session.is204());
    }
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.