@Test public void normalizePreservesParameters() throws Exception { when(this.xwikiCfg.getProperty("xwiki.webapppath")).thenReturn("xwiki"); Map<String, List<String>> params = new HashMap<>(); params.put("age", Arrays.asList("32")); params.put("colors", Arrays.asList("red", "blue")); ExtendedURL extendedURL = new ExtendedURL(Arrays.asList("one", "two"), params); assertSame(params, this.mocker.getComponentUnderTest().normalize(extendedURL).getParameters()); }
@Override public ExtendedURL normalize(ExtendedURL partialURL) { String contextPath = StringUtils.strip(getContextPath(), URL_SEGMENT_DELIMITER); if (contextPath == null) { throw new RuntimeException(String.format("Failed to normalize the URL [%s] since the " + "application's Servlet context couldn't be computed.", partialURL)); } List<String> segments = new ArrayList<>(); if (StringUtils.isNotEmpty(contextPath)) { segments.add(contextPath); } List<String> servletPath = getActionAndWikiServletMapping(); for (String segment : servletPath) { if (StringUtils.isNotEmpty(segment)) { segments.add(segment); } } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }
ContextAndActionURLNormalizer extends org.xwiki.url.internal.container.ContextAndActionURLNormalizer implements Initializable { @Override public ExtendedURL normalize(ExtendedURL partialURL) { String contextPath = StringUtils.strip(getContextPath(), URL_SEGMENT_DELIMITER); if (contextPath == null) { throw new RuntimeException(String.format("Failed to normalize the URL [%s] since the " + "application's Servlet context couldn't be computed.", partialURL)); } List<String> segments = new ArrayList<>(); if (StringUtils.isNotEmpty(contextPath)) { segments.add(contextPath); } List<String> servletPath = getActionAndWikiServletMapping(); for (String segment : servletPath) { if (StringUtils.isNotEmpty(segment)) { segments.add(segment); } } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); } }
ContextAndActionURLNormalizer extends org.xwiki.url.internal.container.ContextAndActionURLNormalizer implements Initializable { @Override public ExtendedURL normalize(ExtendedURL partialURL) { String contextPath = StringUtils.strip(getContextPath(), URL_SEGMENT_DELIMITER); if (contextPath == null) { throw new RuntimeException(String.format("Failed to normalize the URL [%s] since the " + "application's Servlet context couldn't be computed.", partialURL)); } List<String> segments = new ArrayList<>(); if (StringUtils.isNotEmpty(contextPath)) { segments.add(contextPath); } List<String> servletPath = getActionAndWikiServletMapping(); for (String segment : servletPath) { if (StringUtils.isNotEmpty(segment)) { segments.add(segment); } } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }  }
ContextAndActionURLNormalizer extends org.xwiki.url.internal.container.ContextAndActionURLNormalizer implements Initializable { @Override public ExtendedURL normalize(ExtendedURL partialURL) { String contextPath = StringUtils.strip(getContextPath(), URL_SEGMENT_DELIMITER); if (contextPath == null) { throw new RuntimeException(String.format("Failed to normalize the URL [%s] since the " + "application's Servlet context couldn't be computed.", partialURL)); } List<String> segments = new ArrayList<>(); if (StringUtils.isNotEmpty(contextPath)) { segments.add(contextPath); } List<String> servletPath = getActionAndWikiServletMapping(); for (String segment : servletPath) { if (StringUtils.isNotEmpty(segment)) { segments.add(segment); } } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }  @Override void initialize(); @Override ExtendedURL normalize(ExtendedURL partialURL); }
ContextAndActionURLNormalizer extends org.xwiki.url.internal.container.ContextAndActionURLNormalizer implements Initializable { @Override public ExtendedURL normalize(ExtendedURL partialURL) { String contextPath = StringUtils.strip(getContextPath(), URL_SEGMENT_DELIMITER); if (contextPath == null) { throw new RuntimeException(String.format("Failed to normalize the URL [%s] since the " + "application's Servlet context couldn't be computed.", partialURL)); } List<String> segments = new ArrayList<>(); if (StringUtils.isNotEmpty(contextPath)) { segments.add(contextPath); } List<String> servletPath = getActionAndWikiServletMapping(); for (String segment : servletPath) { if (StringUtils.isNotEmpty(segment)) { segments.add(segment); } } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }  @Override void initialize(); @Override ExtendedURL normalize(ExtendedURL partialURL);  }