Class DefaultImageSessionContext
java.lang.Object
org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext
org.apache.xmlgraphics.image.loader.impl.DefaultImageSessionContext
- All Implemented Interfaces:
ImageSessionContext
Very simple implementation of the ImageSessionContext interface. It works for absolute URLs
and local filenames only. Consider writing your own implementation of the ImageSessionContext
if you need more sophisticated functionality.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext
AbstractImageSessionContext.FallbackResolver, AbstractImageSessionContext.RestrictedFallbackResolver, AbstractImageSessionContext.UnrestrictedFallbackResolver
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultImageSessionContext
(ImageContext context, File baseDir) Main constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the base directory for resolving relative filenames.Returns the session-independent context object which provides configuration information.float
Returns the resolution (in dpi) of the source device used when painting images.float
Returns the resolution (in dpi) of the target device used when painting images.protected Source
resolveURI
(String uri) Attempts to resolve the given URI.Methods inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext
createImageInputStream, getSource, isReusable, needSource, newSource, returnSource, toFile
-
Constructor Details
-
DefaultImageSessionContext
Main constructor.- Parameters:
context
- the parent image contextbaseDir
- the base directory for resolving relative filenames
-
-
Method Details
-
getParentContext
Returns the session-independent context object which provides configuration information.- Returns:
- the associated ImageContext instance
-
getBaseDir
Returns the base directory for resolving relative filenames.- Returns:
- the base directory
-
resolveURI
Attempts to resolve the given URI.- Specified by:
resolveURI
in classAbstractImageSessionContext
- Parameters:
uri
- URI to access- Returns:
- A
Source
object, or null if the URI cannot be resolved.
-
getTargetResolution
public float getTargetResolution()Returns the resolution (in dpi) of the target device used when painting images.- Returns:
- the target resolution (in dpi)
-
getSourceResolution
public float getSourceResolution()Description copied from interface:ImageSessionContext
Returns the resolution (in dpi) of the source device used when painting images.- Returns:
- the source resolution (in dpi)
-