@SuppressWarnings("unchecked") public <AdapterType> AdapterType getAdapter(SlingHttpServletResponse adaptable, Class<AdapterType> type) { if (type == RecapProgressListener.class) { if ("text/html".equals(adaptable.getContentType())) { try { return (AdapterType) new HtmlProgressListener(adaptable.getWriter()); } catch (IOException e) { LOGGER.error("failed to adapt response to listener", e); } } else { try { return (AdapterType) new DefaultProgressListener(adaptable.getWriter()); } catch (IOException e) { LOGGER.error("failed to adapt response to listener", e); } } } return null; }
if (StringUtils.contains(slingResponse.getContentType(), "html")) {
if (StringUtils.contains(slingResponse.getContentType(), "html")) {
protected final boolean accepts(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { if (!StringUtils.endsWith(request.getRequestURI(), ".html") || !StringUtils.contains(response.getContentType(), "html")) { // Do not inject around non-HTML requests return false; } final ComponentContext componentContext = WCMUtils.getComponentContext(request); if (componentContext == null // ComponentContext is null || componentContext.getComponent() == null // Component is null || componentContext.isRoot()) { // Suppress on root context return false; } // Check to make sure the suppress key has not been added to the request if (this.isComponentErrorHandlingSuppressed(request)) { // Suppress key is detected, skip handling return false; } // Check to make sure the SlingRequest's resource isn't in the suppress list final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request; for (final String suppressedResourceType : suppressedResourceTypes) { if (slingRequest.getResource().isResourceType(suppressedResourceType)) { return false; } } return true; }
protected final boolean accepts(final SlingHttpServletRequest request, final SlingHttpServletResponse response) { !StringUtils.contains(response.getContentType(), "html")) {