private boolean checkResourceMarker(String resourceName) { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); URL resourceMarkerUrl = contextClassLoader.getResource("META-INF/" + resourceName + ".resource.properties"); boolean result = (resourceMarkerUrl != null); if (LOGGER.isDebugEnabled()) { if (result) { LOGGER.debug(MessageFormat.format("Marker file for {0} resource found in classpath", resourceName)); } else { LOGGER.debug(MessageFormat.format("Marker file for {0} resource does not exist", resourceName)); } } return result; }
private boolean handleRequestByResourceServlet(HttpServletRequest request) { String resourcePath = getResourcePathFromRequest(request); if (resourcePath == null) { LOGGER.debug("ResourceServlet detected request which is not JSF resource request: " + request.getPathInfo()); return false; } // when resource path found in the request path, then we can handle the request return true; }
private synchronized File createOutputFile(String path) throws IOException { File outFile = new File(resourceContentsDir, path); outFile.getParentFile().mkdirs(); if (outFile.exists()) { if (outFile.lastModified() > currentTime) { log.debug(MessageFormat.format("File {0} already exists and will be overwritten", outFile.getPath())); } outFile.delete(); } if (!outFile.createNewFile()) { log.warn(MessageFormat.format("Could not create {0} file", outFile.getPath())); } return outFile; }
public ResourceHandlerImpl(ResourceHandler defaultHandler) { this.defaultHandler = defaultHandler; this.resourceFactory = new ResourceFactoryImpl(defaultHandler); if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageFormat.format("Instance of {0} resource handler created", getClass().getName())); } }
private static void sendNotModified(FacesContext context) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("User agent has actual resource copy - sending 304 status code"); } // TODO send cacheable resource headers (ETag + LastModified)? context.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_MODIFIED); }
private void addResourceDependencies(List<ResourceDependency> resourceDependencies) { Collection<ResourceDependency> filteredResourceDependencies = Collections2.filter(resourceDependencies, RESOURCE_DEPENDENCY_NOT_BODY); Collection<ResourceKey> resourceKeys = Collections2.transform(filteredResourceDependencies, RESOURCE_DEPENDENCY_TO_KEY); resourceKeys = new ResourceLibraryExpander().expandResourceLibraries(resourceKeys); log.debug(resourceKeys.toString()); ordering.addPartialOrdering(resourceKeys); }
private boolean shouldSkipResourceRenderingForSkin(String skin) { if ("plain".equals(skin)) { // detect whether the mime-type of the given resource path denotes image File resourceFileName = new File(resourceKey.getResourceName()); String mimeType = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType(resourceFileName); if (mimeType.startsWith("image/")) { log.debug(String.format("Skipped rendering of %s as it is image that isn't required by skin %s", resourceKey, skin)); return true; } } return false; } }
public void run() { try { Session session = sessionQueue.take(); if (session instanceof DestroyableSession) { ((DestroyableSession) session).destroy(); } sessionMap.remove(session.getId()); executorService.submit(this); } catch (InterruptedException e) { LOGGER.debug(e.getMessage(), e); } } }
protected boolean isThisHandlerResourceRequest(FacesContext context) { Boolean resourceRequest = BooleanRequestStateVariable.ResourceRequest.get(context); if (resourceRequest == null) { String resourcePath = getResourcePathFromRequest(context); // TODO handle exclusions resourceRequest = (resourcePath != null) && (resourcePath.length() > 0); BooleanRequestStateVariable.ResourceRequest.set(context, resourceRequest); if (LOGGER.isDebugEnabled() && resourceRequest) { LOGGER.debug(MessageFormat.format("Resource request detected: {0}", resourcePath)); } } return resourceRequest; }
private void logException(CSSParseException e) { String formattedMessage = MessageFormat.format("Problem parsing ''{0}'' resource: {1}", getResourceLocator(), e.getMessage()); if (LOGGER.isDebugEnabled()) { LOGGER.debug(formattedMessage, e); } else { LOGGER.warn(formattedMessage); } }
@Override public void encodeChildren(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeBegin"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.CHILDREN_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeChildren(writer, context, component); } }
@Override public void encodeChildren(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeBegin"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.CHILDREN_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeChildren(writer, context, component); } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeEnd"); if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeEnd(writer, context, component); } if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.FINISH_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeEnd"); if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeEnd(writer, context, component); } if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.FINISH_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } }
@Override public final void encodeChildren(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeBegin"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.CHILDREN_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeChildren(writer, context, component); } }
@Override public final void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeEnd"); if (component.isRendered() && !isAlreadyRendered(component)) { ResponseWriter writer = context.getResponseWriter(); doEncodeEnd(writer, context, component); } if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.FINISH_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } }
@Override public final void encodeBegin(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeBegin"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.START_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } preEncodeBegin(context, component); if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeBegin(writer, context, component); } }
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeBegin"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.START_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } preEncodeBegin(context, component); if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeBegin(writer, context, component); } }
@Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { // Test for correct parameters. checkForCorrectParams(context, component, "encodeBegin"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.getMessage(Messages.START_ENCODING_COMPONENT_INFO, component.getClientId(context), component .getClass().getName())); } preEncodeBegin(context, component); if (component.isRendered()) { ResponseWriter writer = context.getResponseWriter(); doEncodeBegin(writer, context, component); } }
public void writeResource(String skinName, Resource resource) throws IOException { final String requestPath = resource.getRequestPath(); final String requestPathWithSkin = skinName == null ? requestPath : ResourceSkinUtils.evaluateSkinInPath(requestPath, skinName); ResourceProcessor matchingProcessor = getMatchingResourceProcessor(requestPath); File outFile = createOutputFile(requestPathWithSkin); log.debug("Opening output stream for " + outFile); matchingProcessor.process(requestPathWithSkin, new ResourceInputStreamSupplier(resource).openStream(), Files.asByteSink(outFile).openStream(), true); processedResources.put(ResourceUtil.getResourceQualifier(resource), requestPath); }