Package com.aspectran.web.support.util
Class WebUtils
java.lang.Object
com.aspectran.web.support.util.WebUtils
Miscellaneous utilities for web applications.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringStandard Servlet 2.3+ spec request attribute for error page exception. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateRedirectPath(RedirectRule redirectRule, Activity activity) static jakarta.servlet.http.CookieRetrieve the first cookie with the given name.static jakarta.servlet.http.CookieRetrieve the first cookie with the given name.static StringgetRelativePath(String contextPath, String requestUri) static StringgetReverseContextPath(jakarta.servlet.http.HttpServletRequest request, String defaultContextPath) static booleanisAcceptContentTypes(Translet translet, MediaType... contentTypes) Returns whether the specified content types are present in the Accept header declared by user agents.
-
Field Details
-
ERROR_EXCEPTION_ATTRIBUTE
Standard Servlet 2.3+ spec request attribute for error page exception.To be exposed to JSPs that are marked as error pages, when forwarding to them directly rather than through the servlet container's error page resolution mechanism.
- See Also:
-
-
Constructor Details
-
WebUtils
public WebUtils()
-
-
Method Details
-
getCookie
@Nullable public static jakarta.servlet.http.Cookie getCookie(jakarta.servlet.http.HttpServletRequest request, String name) Retrieve the first cookie with the given name. Note that multiple cookies can have the same name but different paths or domains.- Parameters:
request- current servlet requestname- cookie name- Returns:
- the first cookie with the given name, or
nullif none is found
-
getCookie
Retrieve the first cookie with the given name. Note that multiple cookies can have the same name but different paths or domains.- Parameters:
translet- current transletname- cookie name- Returns:
- the first cookie with the given name, or
nullif none is found
-
isAcceptContentTypes
Returns whether the specified content types are present in the Accept header declared by user agents.- Parameters:
translet- current transletcontentTypes- content types to look for in the Accept header- Returns:
- true if present in the Accept header, false otherwise
-
getRelativePath
-
getReverseContextPath
-
createRedirectPath
@NonNull public static String createRedirectPath(RedirectRule redirectRule, Activity activity) throws IOException - Throws:
IOException
-