public static String getResourceRequestPath(FacesContext context, String resourceName) { Resource resource = context.getApplication().getResourceHandler().createResource(resourceName, "primefaces"); return resource.getRequestPath(); }
String resourcePath = resource.getRequestPath();
Resource resource = context.getApplication().getResourceHandler().createResource( "dynamiccontent.properties", "primefaces", streamedContent.getContentType()); String resourcePath = resource.getRequestPath();
protected void encodeValidationResources(FacesContext context, boolean beanValidationEnabled) throws IOException { ResponseWriter writer = context.getResponseWriter(); Resource resource = context.getApplication().getResourceHandler().createResource("validation/validation.js", "primefaces"); if (resource != null) { writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.writeAttribute("src", resource.getRequestPath(), null); writer.endElement("script"); } if (beanValidationEnabled) { resource = context.getApplication().getResourceHandler().createResource("validation/beanvalidation.js", "primefaces"); if (resource != null) { writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.writeAttribute("src", resource.getRequestPath(), null); writer.endElement("script"); } } } }
protected String getImageSrc(FacesContext context, GraphicImage image) throws Exception { String name = image.getName(); if (name != null) { String libName = image.getLibrary(); ResourceHandler handler = context.getApplication().getResourceHandler(); Resource res = handler.createResource(name, libName); if (res == null) { return "RES_NOT_FOUND"; } else { String requestPath = res.getRequestPath(); return context.getExternalContext().encodeResourceURL(requestPath); } } else { return DynamicContentSrcBuilder.build(context, image.getValue(), image, image.isCache(), DynamicContentType.STREAMED_CONTENT, image.isStream()); } } }
protected void encodeCSS(FacesContext context, String library, String resource) throws IOException { ResponseWriter writer = context.getResponseWriter(); Resource cssResource = context.getApplication().getResourceHandler().createResource(resource, library); if (cssResource == null) { throw new FacesException("Error loading css, cannot find \"" + resource + "\" resource of \"" + library + "\" library"); } else { writer.startElement("link", null); writer.writeAttribute("type", "text/css", null); writer.writeAttribute("rel", "stylesheet", null); writer.writeAttribute("href", cssResource.getRequestPath(), null); writer.endElement("link"); } }
private void encodeScript(FacesContext context, Editor editor) throws IOException { String clientId = editor.getClientId(context); WidgetBuilder wb = getWidgetBuilder(context); wb.init("Editor", editor.resolveWidgetVar(), clientId) .attr("disabled", editor.isDisabled(), false) .attr("invalid", editor.isValid(), true) .attr("controls", editor.getControls(), null) .attr("width", editor.getWidth(), Integer.MIN_VALUE) .attr("height", editor.getHeight(), Integer.MIN_VALUE) .attr("maxlength", editor.getMaxlength(), Integer.MAX_VALUE) .callback("change", "function(e)", editor.getOnchange()); if (AgentUtils.isIE(context)) { Resource resource = context.getApplication().getResourceHandler().createResource("editor/editor-ie.css", "primefaces"); wb.attr("docCSSFile", resource.getRequestPath()); } if (editor.getMaxlength() != Integer.MAX_VALUE) { LOGGER.info("Maxlength option is deprecated and will be removed in a future version."); } wb.finish(); }
/** * <p class="changed_added_2_0">Call through to {@link * #getRequestPath} and return the result.</p> * * @return Call through to {@link #getRequestPath} and return the * result. */ public String toString() { return getRequestPath(); }
/** * <p class="changed_added_2_0">Call through to {@link * #getRequestPath} and return the result.</p> * * @return Call through to {@link #getRequestPath} and return the * result. */ @Override public String toString() { return getRequestPath(); }
@Override public String toString() { return getRequestPath(); }
/** * <p class="changed_added_2_0"> * Call through to {@link #getRequestPath} and return the result. * </p> * * @return Call through to {@link #getRequestPath} and return the result. */ @Override public String toString() { return getRequestPath(); }
/** * <p class="changed_added_2_0">The default behavior of this method * is to call {@link Resource#getRequestPath} on the wrapped {@link * ResourceHandler} object.</p> */ @Override public String getRequestPath() { return getWrapped().getRequestPath(); }
@Override public String getRequestPath() { return getWrapped().getRequestPath(); }
/** * <p class="changed_added_2_0">The default behavior of this method * is to call {@link Resource#getRequestPath} on the wrapped {@link * ResourceHandler} object.</p> */ @Override public String getRequestPath() { return getWrapped().getRequestPath(); }
/** * <p class="changed_added_2_0">The default behavior of this method * is to call {@link Resource#getRequestPath} on the wrapped {@link * ResourceHandler} object.</p> */ @Override public String getRequestPath() { return getWrapped().getRequestPath(); }
public static String getResourcePath(FacesContext context, String library, String resourceName) { String path = null; if (resourceName != null) { ResourceHandler resourceHandler = context.getApplication().getResourceHandler(); Resource resource = (library != null) ? resourceHandler.createResource(resourceName, library) : resourceHandler .createResource(resourceName); if (resource != null) { path = resource.getRequestPath(); } } return path; }
/** * If the given resource is not <code>null</code>, then decorate it as an unmapped resource. */ @Override public Resource decorateResource(Resource resource) { if (resource == null) { return resource; } String path = resource.getRequestPath(); return isResourceRequest(path) ? new RemappedResource(resource, unmapRequestPath(path)) : resource; }
/** * If the given resource is not <code>null</code>, then decorate it as an unmapped resource. */ @Override public Resource decorateResource(Resource resource) { if (resource == null) { return resource; } String path = resource.getRequestPath(); return isResourceRequest(path) ? new RemappedResource(resource, unmapRequestPath(path)) : resource; }
private void renderJS(FacesContext context, String name, String library) throws IOException { ResponseWriter writer = context.getResponseWriter(); Resource resource = context.getApplication().getResourceHandler().createResource(name, library); if (resource != null) { writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.writeAttribute("src", resource.getRequestPath(), null); writer.endElement("script"); } }
private void renderCSS(FacesContext context, String name, String library) throws IOException { ResponseWriter writer = context.getResponseWriter(); Resource resource = context.getApplication().getResourceHandler().createResource(name, library); if (resource != null) { writer.startElement("link", null); writer.writeAttribute("type", "text/css", null); writer.writeAttribute("rel", "stylesheet", null); writer.writeAttribute("href", resource.getRequestPath(), null); writer.endElement("link"); } } }