return requestUri;
}
private static PathInfoImpl splitPath(final HttpServletRequest servletRequest, final int pathSplit)
throws ODataException {
PathInfoImpl pathInfo = new PathInfoImpl();
List<String> precedingPathSegments;
List<String> pathSegments;
String pathInfoString = extractPathInfo(servletRequest);
while (pathInfoString.startsWith("/")) {
pathInfoString = pathInfoString.substring(1);
}
List<String> segments = Arrays.asList(pathInfoString.split("/", -1));
if (pathSplit == 0) {
precedingPathSegments = Collections.emptyList();
pathSegments = segments;
} else {
if (segments.size() < pathSplit) {
throw new ODataBadRequestException(ODataBadRequestException.URLTOOSHORT);
}
precedingPathSegments = segments.subList(0, pathSplit);
final int pathSegmentCount = segments.size();
pathSegments = segments.subList(pathSplit, pathSegmentCount);
}
// Percent-decode only the preceding path segments.
// The OData path segments are decoded during URI parsing.
pathInfo.setPrecedingPathSegment(convertPathSegmentList(precedingPathSegments));
List<PathSegment> odataSegments = new ArrayList<PathSegment>();
for (final String segment : pathSegments) {
int index = segment.indexOf(";");
if (index < 0) {
odataSegments.add(new ODataPathSegmentImpl(segment, null));
} else {
String path = segment.substring(0, index);
Map<String, List<String>> parameterMap = extractMatrixParameter(segment, index);
throw new ODataNotFoundException(ODataNotFoundException.MATRIX.addContent(parameterMap.keySet(), path));
}
}
pathInfo.setODataPathSegment(odataSegments);
return pathInfo;
}