@Test public void testBuildODataPathInfo() throws ODataException { HttpServletRequest req = Mockito.mock(HttpServletRequest.class); Mockito.when(req.getRequestURI()).thenReturn("http: + "catalogSrv/odata.svc;v=1;mo/BookCollection?$top=10"); Mockito.when(req.getServletPath()).thenReturn("/odata"); Mockito.when(req.getContextPath()).thenReturn(""); PathInfo pathInfo = RestUtil.buildODataPathInfo(req, 2); Assert.assertEquals(1, pathInfo.getODataSegments().size()); Assert.assertEquals(2, pathInfo.getPrecedingSegments().size()); }
public static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit) throws ODataException { PathInfoImpl pathInfo = splitPath(req, pathSplit); pathInfo.setServiceRoot(buildBaseUri(req, pathInfo.getPrecedingSegments())); pathInfo.setRequestUri(buildRequestUri(req)); return pathInfo; }
RestUtil { public static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit) throws ODataException { PathInfoImpl pathInfo = splitPath(req, pathSplit); pathInfo.setServiceRoot(buildBaseUri(req, pathInfo.getPrecedingSegments())); pathInfo.setRequestUri(buildRequestUri(req)); return pathInfo; } }
RestUtil { public static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit) throws ODataException { PathInfoImpl pathInfo = splitPath(req, pathSplit); pathInfo.setServiceRoot(buildBaseUri(req, pathInfo.getPrecedingSegments())); pathInfo.setRequestUri(buildRequestUri(req)); return pathInfo; }  }
RestUtil { public static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit) throws ODataException { PathInfoImpl pathInfo = splitPath(req, pathSplit); pathInfo.setServiceRoot(buildBaseUri(req, pathInfo.getPrecedingSegments())); pathInfo.setRequestUri(buildRequestUri(req)); return pathInfo; }  static ContentType extractRequestContentType(final String contentType); static Map<String, String> extractQueryParameters(final String queryString); static Map<String, List<String>> extractAllQueryParameters(final String queryString, String formEncoding); static List<Locale> extractAcceptableLanguage(final String acceptableLanguageHeader); static List<String> extractAcceptHeaders(final String acceptHeader); @SuppressWarnings("unchecked") static Map<String, List<String>> extractHeaders(final HttpServletRequest req); static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit); }
RestUtil { public static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit) throws ODataException { PathInfoImpl pathInfo = splitPath(req, pathSplit); pathInfo.setServiceRoot(buildBaseUri(req, pathInfo.getPrecedingSegments())); pathInfo.setRequestUri(buildRequestUri(req)); return pathInfo; }  static ContentType extractRequestContentType(final String contentType); static Map<String, String> extractQueryParameters(final String queryString); static Map<String, List<String>> extractAllQueryParameters(final String queryString, String formEncoding); static List<Locale> extractAcceptableLanguage(final String acceptableLanguageHeader); static List<String> extractAcceptHeaders(final String acceptHeader); @SuppressWarnings("unchecked") static Map<String, List<String>> extractHeaders(final HttpServletRequest req); static PathInfo buildODataPathInfo(final HttpServletRequest req, final int pathSplit);  }