Package jetbrains.buildServer.web.util
Class PathInfoProcessor
- java.lang.Object
-
- jetbrains.buildServer.web.util.PathInfoProcessor
-
public class PathInfoProcessor extends java.lang.Object
This class splits path info string which has format /name1/value1/name2/value2/rest and returns values corresponding to names. NEW: now supports paths like name1/va/lue1/name2/value2/rest For invocation PathInfoProcessor(req, 'name1', 'name2') getString(name1) == va getPath(name1) == va/lue1 getString(name2) == getPath(name2) == value2 getRestPath() == rest I.e. you can ask for value by given parameter namegetString(String)
. Parameter names are passed via constructorPathInfoProcessor(javax.servlet.http.HttpServletRequest, java.lang.String...)
. All the string starting from unknown parameter name goes to rest pathgetRestPath()
.- Author:
- Kir
-
-
Constructor Summary
Constructors Constructor Description PathInfoProcessor(javax.servlet.http.HttpServletRequest request, java.lang.String... parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getPath(java.lang.String param)
get path value by parameter name, may include several parts separated by /java.lang.String
getRestPath()
return rest path in path info, i.e.java.lang.String
getString(java.lang.String param)
get value by parameter name, won't include subsequent parts
-
-
-
Constructor Detail
-
PathInfoProcessor
public PathInfoProcessor(javax.servlet.http.HttpServletRequest request, java.lang.String... parameters)
- Parameters:
request
- request object to as PathInfo from viaHttpServletRequest.getPathInfo()
parameters
- possible names of parameters (param1 and param2 for expected string /param1/value1/param2/value2/restPath)
-
-
Method Detail
-
getString
@Nullable public java.lang.String getString(java.lang.String param)
get value by parameter name, won't include subsequent parts- Parameters:
param
- name of parameter- Returns:
- value, like value1
-
getPath
@Nullable public java.lang.String getPath(java.lang.String param)
get path value by parameter name, may include several parts separated by /- Parameters:
param
- name of parameter- Returns:
- value, like part/of/value1
-
getRestPath
@NotNull public java.lang.String getRestPath()
return rest path in path info, i.e. path without known parameters- Returns:
- see above
-
-