Package com.google.gerrit.util.http
Class RequestUtil
java.lang.Object
com.google.gerrit.util.http.RequestUtil
Utilities for manipulating HTTP request objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
acceptsGzipEncoding
(javax.servlet.http.HttpServletRequest request) static String
getEncodedPathInfo
(javax.servlet.http.HttpServletRequest req) Returns the same value asHttpServletRequest.getPathInfo()
, but without decoding URL-encoded characters.static Throwable
getErrorTraceAttribute
(javax.servlet.http.HttpServletRequest req) static String
getRestPathWithoutIds
(javax.servlet.http.HttpServletRequest req) Trims leading '/' and 'a/'.static void
setErrorTraceAttribute
(javax.servlet.http.HttpServletRequest req, Throwable t)
-
Method Details
-
setErrorTraceAttribute
-
getErrorTraceAttribute
-
getEncodedPathInfo
Returns the same value asHttpServletRequest.getPathInfo()
, but without decoding URL-encoded characters. -
getRestPathWithoutIds
Trims leading '/' and 'a/'. Removes the context path, but keeps the servlet path. Removes all IDs from the rest of the URI.The returned string is a good fit for cases where one wants the full context of the request without any identifiable data. For example: Logging or quota checks.
Examples:
- /a/accounts/self/detail => /accounts/detail
- /changes/123/revisions/current/detail => /changes/revisions/detail
- /changes/ => /changes
-
acceptsGzipEncoding
public static boolean acceptsGzipEncoding(javax.servlet.http.HttpServletRequest request)
-