Enum Class RequestPathSourcingStrategy
java.lang.Object
java.lang.Enum<RequestPathSourcingStrategy>
io.github.grumpystuff.grumpyrest.servlet.RequestPathSourcingStrategy
- All Implemented Interfaces:
Serializable,Comparable<RequestPathSourcingStrategy>,Constable
This object defines how to obtain the request path from the servlet request. It is needed because different
servlet containers treat the path differently, and it can make a difference whether a servlet or a servlet filter
is used.
The resulting path will have no leading or trailing slash. The empty path gets returned as an empty string.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe request path only consists of the path info.The request path is built by concatenating the context path, servlet path and path info.The request path is built by concatenating the servlet path and path info. -
Method Summary
Modifier and TypeMethodDescriptionabstract StringgetPath(jakarta.servlet.http.HttpServletRequest request) Determines the request path from a servlet request object.static RequestPathSourcingStrategyReturns the enum constant of this class with the specified name.static RequestPathSourcingStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STARTING_WITH_CONTEXT_PATH
The request path is built by concatenating the context path, servlet path and path info. -
STARTING_WITH_SERVLET_PATH
The request path is built by concatenating the servlet path and path info. -
PATH_INFO_ONLY
The request path only consists of the path info.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getPath
Determines the request path from a servlet request object.- Parameters:
request- the servlet request object- Returns:
- the path
-