コード例 #1
0
  /**
   * Creates an new request for the app server from an HTTP request.
   *
   * @param request HTTP request to create
   * @param uri the URI requested
   * @return the request
   */
  public AppRequest createRequest(HttpRequest request, String host, String uri) {
    _numRequests++;

    if (AppRequest.isAdmin(request)) return new AppRequest(_adminContext, request, host, uri);

    return new AppRequest(this, request, host, uri);
  }
コード例 #2
0
  public static AppContext findThreadLocal() {

    AppContext context = _tl.get();
    if (context != null) return context;

    AppRequest req = AppRequest.getThreadLocal();
    if (req != null) return req._context;

    Scope s = Scope.getThreadLocal();
    if (s != null) {
      Object foo = s.get("__instance__");
      if (foo instanceof AppContext) return (AppContext) foo;
    }

    return null;
  }
コード例 #3
0
 /** @unexpose */
 public static String getVersionForLibrary(Scope s, String name) {
   AppRequest ar = AppRequest.getThreadLocal();
   return getVersionForLibrary(s, name, ar == null ? null : ar.getContext());
 }