use of org.broadleafcommerce.common.exception.SiteNotFoundException in project BroadleafCommerce by BroadleafCommerce.
the class BroadleafRequestFilter method doFilterInternalUnlessIgnored.
@Override
protected void doFilterInternalUnlessIgnored(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
if (!shouldProcessURL(request, request.getRequestURI())) {
if (LOG.isTraceEnabled()) {
LOG.trace(String.format("%s not processing URL %s", getClass().getName(), request.getRequestURI()));
}
filterChain.doFilter(request, response);
return;
}
if (LOG.isTraceEnabled()) {
String requestURIWithoutContext;
if (request.getContextPath() != null) {
requestURIWithoutContext = request.getRequestURI().substring(request.getContextPath().length());
} else {
requestURIWithoutContext = request.getRequestURI();
}
// Remove JSESSION-ID or other modifiers
int pos = requestURIWithoutContext.indexOf(";");
if (pos >= 0) {
requestURIWithoutContext = requestURIWithoutContext.substring(0, pos);
}
LOG.trace("Process URL Filter Begin " + requestURIWithoutContext);
}
if (request.getAttribute(REQUEST_DTO_PARAM_NAME) == null) {
request.setAttribute(REQUEST_DTO_PARAM_NAME, new RequestDTOImpl(request));
}
try {
requestProcessor.process(new ServletWebRequest(request, response));
filterChain.doFilter(request, response);
} catch (HaltFilterChainException e) {
return;
} catch (SiteNotFoundException e) {
LOG.warn("Could not resolve a site for the given request, returning not found");
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
} finally {
requestProcessor.postProcess(new ServletWebRequest(request, response));
}
}
Aggregations