Package net.sf.sahi.response

Examples of net.sf.sahi.response.SimpleHttpResponse


 
  public HttpResponse read(final HttpRequest request) {
    final String name = request.getParameter("name");
    String cookieValue = readCookie(name, request);
    cookieValue = cookieValue == null ? "null" : Utils.makeString(cookieValue);
    return new SimpleHttpResponse(cookieValue);
  }
View Full Code Here


    final String name = request.getParameter("name");
    final String value = request.getParameter("value");
    final String path = request.getParameter("path");
    final String domain = request.getParameter("domain");
    final String expires = request.getParameter("expires");
    final SimpleHttpResponse response = new SimpleHttpResponse("");

    String cookieStr = name+"=" + value + "; ";
    if (expires != null) cookieStr += "expires=" + expires + "; ";
    if (path != null) cookieStr += "path="+ path +"; ";
    if (domain != null) cookieStr += "domain="+domain+";";
    response.addHeader("Set-Cookie", cookieStr);
       
    return response;
  }
View Full Code Here

  public HttpResponse delete(final HttpRequest request) {
    final String name = request.getParameter("name");
    String path = request.getParameter("path");
    if (path == null) path = "/";
    final String domain = request.host();
    final SimpleHttpResponse response = new SimpleHttpResponse("");
    if (readCookie(name, request) != null) {
      response.addHeader("Set-Cookie", name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=" + path + ";");
      response.addHeader("Set-Cookie", name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=" + path + "; domain="+domain+";");
      response.addHeader("Set-Cookie", name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=" + path + "; domain=."+domain+";");
      response.addHeader("Set-Cookie", name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=" + path + "; domain="+domain+"; secure");
      response.addHeader("Set-Cookie", name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=" + path + "; domain=."+domain+"; secure");
    }
        return response;
  }
View Full Code Here

      StringBuffer sb = new StringBuffer();
      sb.append("osname_$sahi$_:"+System.getProperty("os.name")+"_$sahi$_;");
      sb.append("osversion_$sahi$_:"+System.getProperty("os.version")+"_$sahi$_;");
      sb.append("osarch_$sahi$_:"+System.getProperty("os.arch")+"_$sahi$_;");
      sb.append("istasklistavailable_$sahi$_:"+Diagnostics.TASKLIST_STATUS);
      return new SimpleHttpResponse(sb.toString());
    }
View Full Code Here

    public HttpResponse getJavaInfo(final HttpRequest request){
      StringBuffer sb = new StringBuffer();
      sb.append("javadir_$sahi$_:"+System.getProperty("java.home")+"_$sahi$_;");
      sb.append("javaversion_$sahi$_:"+System.getProperty("java.version")+"_$sahi$_;");
      sb.append("iskeytoolavailable_$sahi$_:"+Configuration.isKeytoolFound());
      return new SimpleHttpResponse(sb.toString());
    }
View Full Code Here

      dataStr = dataStr.replace("\t", "    ");
    return new NoCacheHttpResponse(dataStr);
    }
   
    public HttpResponse getSahiVersion(final HttpRequest request){
      return new SimpleHttpResponse(Configuration.getVersion());
    }
View Full Code Here

    recordedSteps.record(step);
    }

    public SimpleHttpResponse getSteps(final HttpRequest request) {
      RecordedSteps recordedSteps = recorders.get(request.session().id());
      if (recordedSteps == null) return new SimpleHttpResponse("");
      return new SimpleHttpResponse(recordedSteps.getNewStepsAsString());
    }
View Full Code Here

      return new SimpleHttpResponse(recordedSteps.getNewStepsAsString());
    }
   
    public SimpleHttpResponse getAllSteps(final HttpRequest request) {
      RecordedSteps recordedSteps = recorders.get(request.session().id());
      if (recordedSteps == null) return new SimpleHttpResponse("");
      return new SimpleHttpResponse(recordedSteps.getAllStepsAsString());
    }
View Full Code Here

    public HttpResponse getLastDownloadedFileName(final HttpRequest request) {
        String fileName = request.session().getVariable("download_lastFile");
        if (fileName == null) {
            fileName = "-1";
        }
        return new SimpleHttpResponse(fileName);
    }
View Full Code Here

    final SahiTestSuite suite = session.getSuite();
    String initJS = request.getParameter("initJS");
    System.out.println("Setting initJS" + initJS);
    suite.setInitJS(initJS);
    Status status = suite.executeTestForSingleSession(request.getParameter("testName"), request.getParameter("startURL"));
    return new SimpleHttpResponse(status.getName());
  }
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.