@Override public Resource createResource(String resourceName, String libraryName, String contentType) { Resource resource = super.createResource(resourceName, libraryName, contentType); if (resource != null && libraryName != null && libraryName.equalsIgnoreCase(Constants.LIBRARY)) { return new PrimeResource(resource); } else { return resource; } }
@Override public void handleResourceRequest(FacesContext context) throws IOException { Map<String, String> params = context.getExternalContext().getRequestParameterMap(); String handlerType = params.get(Constants.DYNAMIC_CONTENT_TYPE_PARAM); if (LangUtils.isValueBlank(handlerType)) { super.handleResourceRequest(context); } else { DynamicContentHandler handler = handlers.get(handlerType); if (handler == null) { LOGGER.warning("No dynamic resource handler registered for: " + handlerType + ". Do you miss a dependency?"); super.handleResourceRequest(context); } else { handler.handle(context); } } }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link ResourceHandler#createViewResource} on the wrapped * {@link ResourceHandler} object.</p> */ @Override public ViewResource createViewResource(FacesContext context, String resourceName) { return getWrapped().createViewResource(context, resourceName); }
@Override public boolean libraryExists(String libraryName) { if (LIBRARY_NAME.equals(libraryName)) { return true; } else { return super.libraryExists(libraryName); } }
@Override public boolean isResourceRequest(FacesContext context) { return super.isResourceRequest(context); }
/** * <p class="changed_added_2_3">The default behavior of this method * is to call {@link ResourceHandler#getViewResources(FacesContext, String, int, ResourceVisitOption...)} on the wrapped * {@link ResourceHandler} object.</p> * * @since 2.3 */ @Override public Stream<String> getViewResources(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options) { return getWrapped().getViewResources(facesContext, path, maxDepth, options); }
@Override public boolean libraryExists(String libraryName) { if (LIBRARY_NAME.equals(libraryName)) { return true; } else { return super.libraryExists(libraryName); } }
@Override public boolean isResourceRequest(FacesContext facesContext) { // Since this method could be called many times we save it //on request map so the first time is calculated it remains //alive until the end of the request Boolean value = (Boolean) facesContext.getAttributes().get(IS_RESOURCE_REQUEST); if (value != null && value) { //return the saved value return value; } else { String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); if (resourceBasePath != null && resourceBasePath.startsWith(getResourceHandlerSupport().getResourceIdentifier())) { facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.TRUE); return true; } else { value = super.isResourceRequest(facesContext); facesContext.getAttributes().put(IS_RESOURCE_REQUEST, value); return value; } } }
@Override public Resource createResource(String resourceName, String libraryName) { Resource resource = super.createResource(resourceName, libraryName); if (resource != null && libraryName != null && libraryName.equalsIgnoreCase(Constants.LIBRARY)) { return new PrimeResource(resource); } else { return resource; } }
/** * <p class="changed_added_2_3">The default behavior of this method * is to call {@link ResourceHandler#getViewResources(FacesContext, String, ResourceVisitOption...)} on the wrapped * {@link ResourceHandler} object.</p> * * @since 2.3 */ public Stream<String> getViewResources(FacesContext facesContext, String path, ResourceVisitOption... options) { return getWrapped().getViewResources(facesContext, path, options); }
@Override public void handleResourceRequest(FacesContext context) throws IOException { Map<String, String> params = context.getExternalContext().getRequestParameterMap(); String handlerType = params.get(Constants.DYNAMIC_CONTENT_TYPE_PARAM); if (ComponentUtils.isValueBlank(handlerType)) { super.handleResourceRequest(context); } else { DynamicContentHandler handler = handlers.get(handlerType); if (handler == null) { LOG.warning("No dynamic resource handler registered for: " + handlerType + ". Do you miss a dependency?"); super.handleResourceRequest(context); } else { handler.handle(context); } } }
super.libraryExists(libraryName);
@Override public Resource createResource(final String resourceName, final String libraryName) { if (Constants.LIBRARY.equalsIgnoreCase(libraryName)) { Resource resource = super.createResource(resourceName, libraryName); return resource != null ? new PrimeFacesExtensionsResource(resource) : null; } return super.createResource(resourceName, libraryName); }
/** * <p class="changed_added_2_0">The default behavior of this method * is to call {@link ResourceHandler#getRendererTypeForResourceName(String)} on the * wrapped {@link ResourceHandler} object.</p> */ @Override public String getRendererTypeForResourceName(String resourceName) { return getWrapped().getRendererTypeForResourceName(resourceName); }
super.handleResourceRequest(context); return;
public Resource createResource(String resourceName, String libraryName, String contentType) { if (codeResource != null && codeResource.localPath != null && codeResource.localPath.equals(resourceName)) { //serving up the mapping as a referenced JS resource return codeResource; } else if (cssResources != null && cssResources.containsKey(resourceName)) { //serve the modified CSS resources return cssResources.get(resourceName); } else { //let JSF serve the rest of resources return super.createResource(resourceName, libraryName, contentType); } }
/** * <p class="changed_added_2_0">The default behavior of this method * is to call {@link ResourceHandler#createResource(String)} on the * wrapped {@link ResourceHandler} object.</p> */ @Override public Resource createResource(String resourceName) { return getWrapped().createResource(resourceName); }
super.handleResourceRequest(context); return;
@Override public Resource createResource(String resourceName, String libraryName, String contentType) { if (Constants.LIBRARY.equalsIgnoreCase(libraryName)) { Resource resource = super.createResource(resourceName, libraryName, contentType); return resource != null ? new PrimeFacesExtensionsResource(resource) : null; } return super.createResource(resourceName, libraryName, contentType); } }
/** * <p class="changed_added_2_0">The default behavior of this method * is to call {@link ResourceHandler#isResourceRequest(javax.faces.context.FacesContext)} on the * wrapped {@link ResourceHandler} object.</p> */ @Override public boolean isResourceRequest(FacesContext context) { return getWrapped().isResourceRequest(context); }