Ejemplo n.º 1
0
  void respondMoved(String location) {
    responseCode = HTTP_MOVED_PERM;
    responseMsg = "Moved Permanently";

    String strLoc = location;
    if (strLoc.startsWith("/apps")) strLoc = strLoc.substring(5);

    String strQuery = uri.getQueryString();
    if (strQuery != null && strQuery.length() > 0) strLoc += "?" + strQuery;

    resHeaders.addProperty("Location", strLoc);
    contentLength = 0;
  }
Ejemplo n.º 2
0
  protected boolean dispatch() throws IOException {
    UrlParser up = new UrlParser(uri.getPath());
    String apps = up.next();
    String application;
    if (apps.equalsIgnoreCase("apps")) application = up.next();
    else application = apps;

    String model = up.next();

    if (model.length() == 0) return false;

    if (checkRhoExtensions(application, model)) return true;

    Properties reqHash = new Properties();

    String actionid = up.next();
    String actionnext = up.next();
    if (actionid.length() > 0) {
      if (actionid.length() > 2
          && actionid.charAt(0) == '{'
          && actionid.charAt(actionid.length() - 1) == '}') {
        reqHash.setProperty("id", actionid);
        reqHash.setProperty("action", actionnext);
      } else {
        reqHash.setProperty("id", actionnext);
        reqHash.setProperty("action", actionid);
      }
    }
    reqHash.setProperty("application", application);
    reqHash.setProperty("model", model);

    reqHash.setProperty("request-method", this.method);
    reqHash.setProperty("request-uri", uri.getPath());
    reqHash.setProperty("request-query", uri.getQueryString());

    if (postData != null && postData.size() > 0) {
      log(postData.toString());
      reqHash.setProperty("request-body", postData.toString());
    }

    RubyValue res = RhoRuby.processRequest(reqHash, reqHeaders, resHeaders);
    processResponse(res);

    return true;
  }
Ejemplo n.º 3
0
 public String getQuery() {
   log("getQuery: " + uri.getQueryString());
   return uri.getQueryString();
 }