|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.support.AbstractMediaHandler magoffin.matt.ma2.image.BaseImageMediaHandler magoffin.matt.ma2.image.jmagick.BaseJMagickMediaHandler magoffin.matt.ma2.image.jmagick.JpegMediaHandler
public class JpegMediaHandler
JPEG media handler using JMagick.
The configurable properties of this class are:
jpeg2000UserAgentRegExp
property.
If not configured then all re-sized images will be served as JPEG2000
(assuming the useJpeg200
property is configured as
true). The regular expression matching will use the
Matcher.find()
method for evauluation.
Field Summary |
---|
Fields inherited from class magoffin.matt.ma2.image.jmagick.BaseJMagickMediaHandler |
---|
DEFAULT_OUTPUT_DEPTH |
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 | |
---|---|
|
JpegMediaHandler()
Default constructor. |
protected |
JpegMediaHandler(java.lang.String mimeType)
Construct with a different MIME type. |
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. |
java.util.List<java.util.regex.Pattern> |
getJpeg2000UserAgentPatterns()
|
protected java.lang.String |
getResponseMime(MediaItem item,
MediaRequest request,
org.springframework.core.io.Resource itemResource)
Get the MIME type to set in the response. |
void |
handleDelegateMediaRequest(org.springframework.core.io.Resource mediaResource,
java.lang.String mimeType,
MediaItem item,
MediaRequest request,
MediaResponse response)
Handle a delegate media request. |
boolean |
isUseJpeg2000()
|
void |
setJpeg2000UserAgentPatterns(java.util.List<java.util.regex.Pattern> jpeg2000UserAgentPatterns)
|
void |
setJpeg2000UserAgentRegExp(java.lang.String[] regExps)
Set the JPEG2000 user agent regular expression matches as a String array. |
void |
setUseJpeg2000(boolean useJpeg2000)
|
Methods inherited from class magoffin.matt.ma2.image.jmagick.BaseJMagickMediaHandler |
---|
createNewMediaItem, defaultHandleRequest, defaultHandleResource, getEffect, getJmagickMediaEffectMap, getOutputDepth, handleMediaRequest, setJmagickMediaEffectMap, setOutputDepth, setupBaseItemProperties |
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 |
---|
public JpegMediaHandler()
protected JpegMediaHandler(java.lang.String mimeType)
mimeType
- the MIME typeMethod Detail |
---|
public java.lang.String getFileExtension(MediaItem item, MediaRequest request)
AbstractMediaHandler
This method simply returns AbstractMediaHandler.getPreferredFileExtension()
.
Extending class may override this for request-specific handling.
getFileExtension
in interface MediaHandler
getFileExtension
in class AbstractMediaHandler
item
- the media item to processrequest
- the request
public void handleDelegateMediaRequest(org.springframework.core.io.Resource mediaResource, java.lang.String mimeType, MediaItem item, MediaRequest request, MediaResponse response)
MediaHandlerDelegate
The mediaResource
is not the original MediaItem
resource, rather it is the media resource extracted from
the MediaItem, e.g. the metadata resource.
handleDelegateMediaRequest
in interface MediaHandlerDelegate
mediaResource
- the media data to processmimeType
- the MIME type of the media data in mediaResource
item
- the MediaItem being processedrequest
- the requestresponse
- the responseprotected java.lang.String getResponseMime(MediaItem item, MediaRequest request, org.springframework.core.io.Resource itemResource)
BaseJMagickMediaHandler
This implementation merely calls AbstractMediaHandler.getMime()
but extending classes
may need to override this.
getResponseMime
in class BaseJMagickMediaHandler
item
- the MediaItem being processedrequest
- the requestitemResource
- the item resource being processed
public java.lang.String getDelegateFileExtension(org.springframework.core.io.Resource mediaResource, java.lang.String mimeType, MediaItem item, MediaRequest request)
MediaHandlerDelegate
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.
getDelegateFileExtension
in interface MediaHandlerDelegate
mediaResource
- the media data to processmimeType
- the MIME type of the media data in mediaResource
item
- the MediaItem being processedrequest
- the request
public void setJpeg2000UserAgentRegExp(java.lang.String[] regExps)
This will compile each string into a Pattern
and place that onto
the getJpeg2000UserAgentPatterns()
list. This is mostly for the
benefit of configuring the patterns. The regular expressions are compiled
with the Pattern.CASE_INSENSITIVE
flag.
regExps
- the regular expression patterns to usepublic java.util.List<java.util.regex.Pattern> getJpeg2000UserAgentPatterns()
public void setJpeg2000UserAgentPatterns(java.util.List<java.util.regex.Pattern> jpeg2000UserAgentPatterns)
jpeg2000UserAgentPatterns
- the jpeg2000UserAgentPatterns to setpublic boolean isUseJpeg2000()
public void setUseJpeg2000(boolean useJpeg2000)
useJpeg2000
- the useJpeg2000 to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |