Package net.officefloor.web.resource.spi
Interface ResourceTransformerContext
public interface ResourceTransformerContext
Context for the
ResourceTransformer.- Author:
- Daniel Sagenschneider
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new file.Obtains theCharsetfor the resource.Obtains theContent-Encodingof the resource.Obtains theContent-Typeof the resource.getPath()Obtains the path identifying the resource.Obtains thePathto the resource being transformed.voidsetContentEncoding(HttpHeaderValue contentEncoding) Specifies theContent-Encodingfor the transformed resource.voidsetContentType(HttpHeaderValue contentType, Charset charset) Allows specifying a newContent-Typefor the transformed resource.voidsetTransformedResource(Path resource) Specifies thePathto the transformed resource.
-
Method Details
-
getPath
String getPath()Obtains the path identifying the resource.- Returns:
- Path identifying the resource.
-
getResource
Path getResource()Obtains thePathto the resource being transformed.- Returns:
Pathto the resource being transformed.
-
createFile
Creates a new file.
All files required for transform should be created via this method. This is to ensure the files are managed.
- Returns:
Pathto the new file.- Throws:
IOException- If fails to create the new file.
-
getContentType
String getContentType()Obtains theContent-Typeof the resource.- Returns:
Content-Typeof the resource.
-
getCharset
Charset getCharset()Obtains the
Charsetfor the resource.Typically this is the
Charsetof the backingResourceSystem. However, it may be changed by a previousResourceTransformer.- Returns:
Charsetfor the resource.
-
setContentType
Allows specifying a newContent-Typefor the transformed resource.- Parameters:
contentType-Content-Typefor the transformed resource. This needs to include theCharsetparameter if required.charset-Charsetfor theHttpFile. May benullto use/reset to the defaultCharsetof theResourceSystem.
-
getContentEncoding
String getContentEncoding()Obtains theContent-Encodingof the resource.- Returns:
Content-Encodingof the resource. May benullif resource not yet encoded.
-
setContentEncoding
Specifies theContent-Encodingfor the transformed resource.- Parameters:
contentEncoding-Content-Encodingfor the transformed resource.- Throws:
IOException- IfContent-Encodingalready specified by anotherResourceTransformer.- See Also:
-
setTransformedResource
Specifies the
Pathto the transformed resource.This is optional to invoke. Should a transform not be applied, then this should not be invoked.
- Parameters:
resource-Pathto the transformed resource.
-