@Test public void normalizeRemovesLeadingAndTrailingSlashFromConfiguration() throws Exception { when(this.xwikiCfg.getProperty("xwiki.webapppath")).thenReturn("/xwiki/"); assertEquals("/xwiki/bin/one/two", this.mocker.getComponentUnderTest().normalize(this.testURL).serialize()); }
@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);  }