@Test void normalizeWithNoKnownContextPathThrowsException() { Throwable expected = assertThrows(RuntimeException.class, () -> this.normalizer.normalize(this.testURL)); assertEquals("Failed to normalize the URL [/one/two] since the application's Servlet context couldn't be " + "computed.", expected.getMessage()); }
@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); } String servletPath = getActionServletMapping(); if (StringUtils.isNotEmpty(servletPath)) { segments.add(servletPath); } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }
ContextAndActionURLNormalizer implements URLNormalizer<ExtendedURL>, 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); } String servletPath = getActionServletMapping(); if (StringUtils.isNotEmpty(servletPath)) { segments.add(servletPath); } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); } }
ContextAndActionURLNormalizer implements URLNormalizer<ExtendedURL>, 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); } String servletPath = getActionServletMapping(); if (StringUtils.isNotEmpty(servletPath)) { segments.add(servletPath); } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }  }
ContextAndActionURLNormalizer implements URLNormalizer<ExtendedURL>, 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); } String servletPath = getActionServletMapping(); if (StringUtils.isNotEmpty(servletPath)) { segments.add(servletPath); } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }  @Override void initialize(); @Override ExtendedURL normalize(ExtendedURL partialURL); }
ContextAndActionURLNormalizer implements URLNormalizer<ExtendedURL>, 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); } String servletPath = getActionServletMapping(); if (StringUtils.isNotEmpty(servletPath)) { segments.add(servletPath); } segments.addAll(partialURL.getSegments()); return new ExtendedURL(segments, partialURL.getParameters()); }  @Override void initialize(); @Override ExtendedURL normalize(ExtendedURL partialURL);  }