@Override public InputStream getInputStream() throws IOException { Charset charset = ResourceUtils.getCharsetFromContentType(getContentType()); FacesContextWrapperImpl wrappedContext = FacesContextWrapperImpl.wrap(charset); try { encode(wrappedContext); return wrappedContext.getWrittenDataAsStream(); } finally { FacesContextWrapperImpl.unwrap(); } }
@Override public String getRequestPath() { // detect unsupported types early checkSupportedFormat(getWrapped().getImageType()); return super.getRequestPath(); }
public static void main(String[] args) throws SAXException, ParserConfigurationException, IOException { // Create Handler Handler handler = new Handler(); // Create the parser CreateParser parser = new CreateParser(handler); // Parse the XML file, handler generates the output String filename = args[0]; parser.parse(filename); }
@ResourceParameter(defaultValue = Skin.HEADER_BACKGROUND_COLOR) public void setBottomColorParam(String bottomColorSkinParameter) { this.bottomColorParam = bottomColorSkinParameter; } }
public MappedResourceData apply(Entry<String, String> from) { String resourceLocation = from.getValue(); Map<String, String> params = ResourceUtils.parseResourceParameters(resourceLocation); String resourceQualifier = extractParametersFromResourceName(resourceLocation); return new MappedResourceData(ResourceKey.create(resourceQualifier), params); } };
protected Resource createResource(Java2DUserResource resource) { boolean cacheable = isCacheableSet(resource.getClass()); boolean versioned = isVersionedSet(resource.getClass()); if (resource instanceof Java2DAnimatedUserResource) { Java2DAnimatedUserResource java2DAnimatedUserResource = (Java2DAnimatedUserResource) resource; return new Java2DAnimatedUserResourceWrapperImpl(java2DAnimatedUserResource, cacheable, versioned); } else { return new Java2DUserResourceWrapperImpl(resource, cacheable, versioned); } }
public Resource createResource(String resourceName, String libraryName, String contentType) { ResourceKey resourceKey = new ResourceKey(resourceName, libraryName); Resource resource = createMappedResource(resourceKey); if (resource != null) { return resource; } else { return createDynamicResource(resourceKey, true); } }
protected boolean isMatchesLastModified(FacesContext context, String modifiedCondition) { Date lastModified = getLastModified(context); if (lastModified == null) { return false; } return isUserCopyActual(lastModified, ResourceUtils.parseHttpDate(modifiedCondition)); }
public String getContentType() { return getWrapped().getImageType().getMimeType(); }
public String encodeResourceRequestPath(FacesContext context, String libraryName, String resourceName, Object resourceData, String resourceVersion) { String encodedDataString = null; if (resourceData != null) { encodedDataString = ResourceUtils.encodeBytesData((byte[]) resourceData); } return ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER + encodeResource(libraryName, resourceName, encodedDataString, resourceVersion); }
protected boolean isMatchesEntityTag(FacesContext context, String matchHeaderValue) { String resourceEntityTag = getEntityTag(context); if (resourceEntityTag == null) { return false; } return ResourceUtils.matchTag(resourceEntityTag, matchHeaderValue); }
@Override protected Map<String, String> getWrappedResourceResponseHeaders() { return getWrapped().getResponseHeaders(); }
@Override protected Map<String, String> getWrappedResourceResponseHeaders() { return getWrapped().getResponseHeaders(); }
public void encode(FacesContext context) throws IOException { getWrapped().encode(context); } }
@Override protected int getContentLength(FacesContext context) { return getWrapped().getContentLength(); }
@Override protected Date getLastModified(FacesContext context) { return getWrapped().getLastModified(); }
@Override public String getContentType() { return getWrapped().getContentType(); }
@Override protected Date getLastModified(FacesContext context) { return getWrapped().getLastModified(); }
@ResourceParameter(defaultValue = Skin.SELECT_CONTROL_COLOR) public void setColorParam(String colorParam) { this.colorParam = colorParam; } }
private void parse(InputStream inputStream, OutputStream outputStream) throws SAXException, ParserConfigurationException, IOException { Handler handler = new Handler(outputStream); CreateParser parser = new CreateParser(handler); parser.parse(inputStream); } }