magoffin.matt.ma2.image.iio
Class PngMediaHandler

java.lang.Object
  extended by magoffin.matt.ma2.support.AbstractMediaHandler
      extended by magoffin.matt.ma2.image.BaseImageMediaHandler
          extended by magoffin.matt.ma2.image.awt.BaseAwtImageMediaHandler
              extended by magoffin.matt.ma2.image.iio.BaseImageIOMediaHandler
                  extended by magoffin.matt.ma2.image.iio.JpegMediaHandler
                      extended by magoffin.matt.ma2.image.iio.PngMediaHandler
All Implemented Interfaces:
MediaHandler, MediaHandlerDelegate

public class PngMediaHandler
extends JpegMediaHandler

PNG media handler using ImageIO.

This handler returns JPEG images unless the original image is requested, in which case the original PNG image is returned.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
Matt Magoffin (spamsqr@msqr.us)

Field Summary
 
Fields inherited from class magoffin.matt.ma2.image.iio.JpegMediaHandler
FORMAT_NAME_IIO_JPEG_1_0
 
Fields inherited from class magoffin.matt.ma2.image.BaseImageMediaHandler
DEFAULT_ORIENTATION_180_VALUE, DEFAULT_ORIENTATION_90_CLOCKWISE_VALUE, DEFAULT_ORIENTATION_90_COUNTER_CLOCKWISE_VALUE, DEFAULT_ORIENTATION_METADATA_KEY, ROTATE_180, ROTATE_90_CCW, ROTATE_90_CW
 
Fields inherited from class magoffin.matt.ma2.support.AbstractMediaHandler
log, METADATA_PARAMETER_KEY
 
Constructor Summary
PngMediaHandler()
          Constructor.
 
Method Summary
 java.lang.String getDelegateFileExtension(org.springframework.core.io.Resource mediaResource, java.lang.String mimeType, MediaItem item, MediaRequest request)
          Get the preferred file extension for this handler.
 java.lang.String getFileExtension(MediaItem item, MediaRequest request)
          Get the file extension.
 
Methods inherited from class magoffin.matt.ma2.image.iio.JpegMediaHandler
createNewMediaItem, handleDelegateMediaRequest, handleMediaRequest
 
Methods inherited from class magoffin.matt.ma2.image.iio.BaseImageIOMediaHandler
defaultHandleDelegateRequest, defaultHandleRequest, getBufferedImage, getImageMediaHelper, setImageMediaHelper, setupBaseItemProperties
 
Methods inherited from class magoffin.matt.ma2.image.awt.BaseAwtImageMediaHandler
getAwtMediaEffectMap, getEffect, setAwtMediaEffectMap
 
Methods inherited from class magoffin.matt.ma2.image.BaseImageMediaHandler
getOrientation180Value, getOrientation90ClockwiseValue, getOrientation90CounterClockwiseValue, getOrientationMetadataKey, handleMetadata, needToRotate, setOrientation180Value, setOrientation90ClockwiseValue, setOrientation90CounterClockwiseValue, setOrientationMetadataKey
 
Methods inherited from class magoffin.matt.ma2.support.AbstractMediaHandler
applyEffects, createMetadataList, defaultHandleRequestOriginal, getDomainObjectFactory, getMediaBiz, getMediaMetadataInstance, getMime, getNoWatermarkSizes, getPreferredFileExtension, getRequestEffects, getSmetaPropertyMap, getUserBiz, needToAlter, setDomainObjectFactory, setMediaBiz, setMime, setNoWatermarkSizes, setPreferredFileExtension, setSmetaPropertyMap, setUserBiz
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PngMediaHandler

public PngMediaHandler()
Constructor.

Method Detail

getFileExtension

public java.lang.String getFileExtension(MediaItem item,
                                         MediaRequest request)
Description copied from class: AbstractMediaHandler
Get the file extension.

This method simply returns AbstractMediaHandler.getPreferredFileExtension(). Extending class may override this for request-specific handling.

Specified by:
getFileExtension in interface MediaHandler
Overrides:
getFileExtension in class AbstractMediaHandler
Parameters:
item - the media item to process
request - the request
Returns:
a file extension, without the period

getDelegateFileExtension

public java.lang.String getDelegateFileExtension(org.springframework.core.io.Resource mediaResource,
                                                 java.lang.String mimeType,
                                                 MediaItem item,
                                                 MediaRequest request)
Description copied from interface: MediaHandlerDelegate
Get the preferred file extension for this handler.

The mediaResource is not the original MediaItem resource, rather it is the media resource extracted from the MediaItem, e.g. the metadata resource.

Some handlers might return a different file extension for a given request then the default file extension for their type (for example a PNG image handler that returns JPEG images when resizing the images.

Specified by:
getDelegateFileExtension in interface MediaHandlerDelegate
Overrides:
getDelegateFileExtension in class JpegMediaHandler
Parameters:
mediaResource - the media data to process
mimeType - the MIME type of the media data in mediaResource
item - the MediaItem being processed
request - the request
Returns:
a file extension, without the period