Class PathVariable

java.lang.Object
com.invirgance.convirgance.web.parameter.PathVariable
All Implemented Interfaces:
Parameter

@Wiring public class PathVariable extends Object implements Parameter
Extracts a variable from the URL path. This parameter can only extract a single parameter, so multiple parameters will need to be configured to extract multiple values. Parameter names are identified in the path with curly braces. e.g. /path/{id} defines a variable called id that can be extracted from the path.

A * can be used whenever a dynamic path component needs to be defined but not extracted by this parameter. e.g. /path/%2A/subpath/{id} defines a dynamic path component between path and subpath.
Author:
jbanes
  • Constructor Details

    • PathVariable

      public PathVariable()
  • Method Details

    • getPath

      public String getPath()
      The path pattern that has been set
      Returns:
      the parameterized path
    • setPath

      public void setPath(String path)
      Set the path pattern
      Parameters:
      path - the parameterized path
    • getName

      public String getName()
      Description copied from interface: Parameter
      Gets the name of this parameter.
      Specified by:
      getName in interface Parameter
      Returns:
      The parameter name
    • getValue

      public Object getValue(HttpRequest request)
      Description copied from interface: Parameter
      Extracts a value from the HTTP request.
      Specified by:
      getValue in interface Parameter
      Parameters:
      request - The HTTP request to extract values from
      Returns:
      The extracted value