use of javax.ws.rs.core.PathSegment in project tomee by apache.
the class WebClient method back.
/**
* Goes back
* @param fast if true then goes back to baseURI otherwise to a previous path segment
* @return updated WebClient
*/
public WebClient back(boolean fast) {
getState().setTemplates(null);
if (fast) {
getCurrentBuilder().replacePath(getBaseURI().getPath());
} else {
URI uri = getCurrentURI();
if (uri == getBaseURI()) {
return this;
}
List<PathSegment> segments = JAXRSUtils.getPathSegments(uri.getPath(), false);
getCurrentBuilder().replacePath(null);
for (int i = 0; i < segments.size() - 1; i++) {
getCurrentBuilder().path(HttpUtils.fromPathSegment(segments.get(i)));
}
}
return this;
}
use of javax.ws.rs.core.PathSegment in project tomee by apache.
the class JAXRSUtils method processMatrixParam.
private static Object processMatrixParam(Message m, String key, Class<?> pClass, Type genericType, Annotation[] paramAnns, String defaultValue, boolean decode) {
List<PathSegment> segments = JAXRSUtils.getPathSegments((String) m.get(Message.REQUEST_URI), decode);
if (!segments.isEmpty()) {
MultivaluedMap<String, String> params = new MetadataMap<>();
for (PathSegment ps : segments) {
MultivaluedMap<String, String> matrix = ps.getMatrixParameters();
for (Map.Entry<String, List<String>> entry : matrix.entrySet()) {
for (String value : entry.getValue()) {
params.add(entry.getKey(), value);
}
}
}
if ("".equals(key)) {
return InjectionUtils.handleBean(pClass, paramAnns, params, ParameterType.MATRIX, m, false);
}
List<String> values = params.get(key);
return InjectionUtils.createParameterObject(values, pClass, genericType, paramAnns, defaultValue, false, ParameterType.MATRIX, m);
}
return null;
}
Aggregations