Package net.officefloor.web.resource.spi
Interface ResourceTransformerContext
-
public interface ResourceTransformerContextContext for theResourceTransformer.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.nio.file.PathcreateFile()Creates a new file.java.nio.charset.CharsetgetCharset()Obtains theCharsetfor the resource.java.lang.StringgetContentEncoding()Obtains theContent-Encodingof the resource.java.lang.StringgetContentType()Obtains theContent-Typeof the resource.java.lang.StringgetPath()Obtains the path identifying the resource.java.nio.file.PathgetResource()Obtains thePathto the resource being transformed.voidsetContentEncoding(HttpHeaderValue contentEncoding)Specifies theContent-Encodingfor the transformed resource.voidsetContentType(HttpHeaderValue contentType, java.nio.charset.Charset charset)Allows specifying a newContent-Typefor the transformed resource.voidsetTransformedResource(java.nio.file.Path resource)Specifies thePathto the transformed resource.
-
-
-
Method Detail
-
getPath
java.lang.String getPath()
Obtains the path identifying the resource.- Returns:
- Path identifying the resource.
-
getResource
java.nio.file.Path getResource()
Obtains thePathto the resource being transformed.- Returns:
Pathto the resource being transformed.
-
createFile
java.nio.file.Path createFile() throws java.io.IOExceptionCreates 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:
java.io.IOException- If fails to create the new file.
-
getContentType
java.lang.String getContentType()
Obtains theContent-Typeof the resource.- Returns:
Content-Typeof the resource.
-
getCharset
java.nio.charset.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
void setContentType(HttpHeaderValue contentType, java.nio.charset.Charset charset)
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
java.lang.String getContentEncoding()
Obtains theContent-Encodingof the resource.- Returns:
Content-Encodingof the resource. May benullif resource not yet encoded.
-
setContentEncoding
void setContentEncoding(HttpHeaderValue contentEncoding) throws java.io.IOException
Specifies theContent-Encodingfor the transformed resource.- Parameters:
contentEncoding-Content-Encodingfor the transformed resource.- Throws:
java.io.IOException- IfContent-Encodingalready specified by anotherResourceTransformer.- See Also:
getContentEncoding()
-
setTransformedResource
void setTransformedResource(java.nio.file.Path resource)
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.
-
-