public class RequestPath extends TreeMap<String,String>
Provides access to the matched path variables and path match remainder.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Method and Description |
---|---|
<T> T |
get(HttpPartParser parser,
HttpPartSchema schema,
String name,
Class<T> type)
Same as
get(String, Class) but allows you to override the part parser. |
<T> T |
get(HttpPartParser parser,
HttpPartSchema schema,
String name,
Type type,
Type... args)
Same as
get(String, Type, Type...) but allows you to override the part parser. |
<T> T |
get(String name,
Class<T> type)
Returns the specified path parameter value converted to a POJO using the
HttpPartParser registered with the resource. |
<T> T |
get(String name,
Type type,
Type... args)
Returns the specified query parameter value converted to a POJO using the
HttpPartParser registered with the resource. |
boolean |
getBoolean(String name)
Returns the specified path parameter converted to a boolean.
|
int |
getInt(String name)
Returns the specified path parameter converted to an integer.
|
String |
getRemainder()
Returns the decoded remainder of the URL following any path pattern matches.
|
String |
getRemainderUndecoded()
Same as
getRemainder() but doesn't decode characters. |
String |
getString(String name)
Returns the specified path parameter converted to a String.
|
void |
put(String name,
Object value)
Sets a request query parameter value.
|
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
equals, hashCode, isEmpty, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove
public void put(String name, Object value)
name
- The parameter name.value
- The parameter value.public String getString(String name) throws BadRequest, InternalServerError
name
- The path variable name.BadRequest
- Thrown if input could not be parsed.InternalServerError
- Thrown if any other exception occurs.public int getInt(String name) throws BadRequest, InternalServerError
name
- The path variable name.BadRequest
- Thrown if input could not be parsed.InternalServerError
- Thrown if any other exception occurs.public boolean getBoolean(String name) throws BadRequest, InternalServerError
name
- The path variable name.BadRequest
- Thrown if input could not be parsed.InternalServerError
- Thrown if any other exception occurs.public <T> T get(String name, Class<T> type) throws BadRequest, InternalServerError
HttpPartParser
registered with the resource.
T
- The class type to convert the attribute value to.name
- The attribute name.type
- The class type to convert the attribute value to.BadRequest
- Thrown if input could not be parsed.InternalServerError
- Thrown if any other exception occurs.public <T> T get(HttpPartParser parser, HttpPartSchema schema, String name, Class<T> type) throws BadRequest, InternalServerError
get(String, Class)
but allows you to override the part parser.T
- The class type to convert the attribute value to.parser
- The parser to use for parsing the string value.
schema
- The schema object that defines the format of the input.
HttpPartSchema.DEFAULT
.
OpenApiParser
).name
- The attribute name.type
- The class type to convert the attribute value to.BadRequest
- Thrown if input could not be parsed or fails schema validation.InternalServerError
- Thrown if any other exception occurs.public <T> T get(String name, Type type, Type... args) throws BadRequest, InternalServerError
HttpPartParser
registered with the resource.
Similar to get(String,Class)
but allows for complex collections of POJOs to be created.
Use this method if you want to parse into a parameterized
T
- The class type to convert the attribute value to.name
- The attribute name.type
- The type of object to create.
ClassMeta
, Class
, ParameterizedType
, GenericArrayType
args
- The type arguments of the class if it's a collection or map.
ClassMeta
, Class
, ParameterizedType
, GenericArrayType
BadRequest
- Thrown if input could not be parsed.InternalServerError
- Thrown if any other exception occurs.public <T> T get(HttpPartParser parser, HttpPartSchema schema, String name, Type type, Type... args) throws BadRequest, InternalServerError
get(String, Type, Type...)
but allows you to override the part parser.T
- The class type to convert the attribute value to.parser
- The parser to use for parsing the string value.
schema
- The schema object that defines the format of the input.
HttpPartSchema.DEFAULT
.
OpenApiParser
).name
- The attribute name.type
- The type of object to create.
ClassMeta
, Class
, ParameterizedType
, GenericArrayType
args
- The type arguments of the class if it's a collection or map.
ClassMeta
, Class
, ParameterizedType
, GenericArrayType
BadRequest
- Thrown if input could not be parsed or fails schema validation.InternalServerError
- Thrown if any other exception occurs.public String getRemainder()
The behavior of path remainder is shown below given the path pattern "/foo/*":
URL | Path Remainder |
---|---|
The remainder can also be retrieved by calling get(
.
public String getRemainderUndecoded()
getRemainder()
but doesn't decode characters.
The undecoded remainder can also be retrieved by calling get(
.
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.