Ejemplo n.º 1
0
  /**
   * Returns the webApp controller for the current request. Side effect of filling in the
   * invocation's context path and context uri.
   *
   * @param invocation the request's invocation
   * @return the controller or null if none match the url.
   */
  protected WebAppController getWebAppController(Invocation invocation) {
    WebAppUriMap entry = findEntryByURI(invocation.getURI());

    if (entry == null) return null;

    String invocationURI = invocation.getURI();

    // server/1hb1
    // String contextPath = controller.getContextPath(invocationURI);
    String contextPath = entry.getContextPath();

    // invocation.setContextPath(invocationURI.substring(0, contextPath.length()));
    invocation.setContextPath(contextPath);

    String uri = invocationURI.substring(contextPath.length());
    invocation.setContextURI(uri);

    return entry.getController();
  }
Ejemplo n.º 2
0
  /** Finds the web-app matching the current entry. */
  public WebAppController findByURI(String uri) {
    WebAppUriMap entry = findEntryByURI(uri);

    if (entry != null) return entry.getController();
    else return null;
  }