Enum Class RequestPathSourcingStrategy

java.lang.Object
java.lang.Enum<RequestPathSourcingStrategy>
io.github.grumpystuff.grumpyrest.servlet.RequestPathSourcingStrategy
All Implemented Interfaces:
Serializable, Comparable<RequestPathSourcingStrategy>, Constable

public enum RequestPathSourcingStrategy extends Enum<RequestPathSourcingStrategy>
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.

  • Enum Constant Details

    • STARTING_WITH_CONTEXT_PATH

      public static final RequestPathSourcingStrategy STARTING_WITH_CONTEXT_PATH
      The request path is built by concatenating the context path, servlet path and path info.
    • STARTING_WITH_SERVLET_PATH

      public static final RequestPathSourcingStrategy STARTING_WITH_SERVLET_PATH
      The request path is built by concatenating the servlet path and path info.
    • PATH_INFO_ONLY

      public static final RequestPathSourcingStrategy PATH_INFO_ONLY
      The request path only consists of the path info.
  • Method Details

    • values

      public static RequestPathSourcingStrategy[] 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

      public static RequestPathSourcingStrategy valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getPath

      public abstract String getPath(jakarta.servlet.http.HttpServletRequest request)
      Determines the request path from a servlet request object.
      Parameters:
      request - the servlet request object
      Returns:
      the path