org.w3c.jigsaw.frames
Class JpegXMPFrame

java.lang.Object
  extended by org.w3c.tools.resources.AttributeHolder
      extended by org.w3c.tools.resources.Resource
          extended by org.w3c.tools.resources.FramedResource
              extended by org.w3c.tools.resources.ResourceFrame
                  extended by org.w3c.tools.resources.ProtocolFrame
                      extended by org.w3c.jigsaw.frames.HTTPFrame
                          extended by org.w3c.jigsaw.frames.JpegXMPFrame
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, AttributeChangedListener, FrameEventListener

public class JpegXMPFrame
extends HTTPFrame

This class will read the XMP marker from a jpeg file and return it depending on the Accept: header


Field Summary
static boolean debug
           
protected static java.lang.String[] vary
          the static String of the Vary ehader to be added
protected  HttpEntityTag xmpetag
          The comment entity tag
protected  java.lang.String xmpinfo
          The XMP.
protected static MimeType xmptype
          the static String of the Vary ehader to be added
 
Fields inherited from class org.w3c.jigsaw.frames.HTTPFrame
acceptRanges, allowed, ATTR_ALLOW_DEL, ATTR_BROWSABLE, ATTR_CHARSET, ATTR_CONTENT_ENCODING, ATTR_CONTENT_LANGUAGE, ATTR_CONTENT_LENGTH, ATTR_CONTENT_TYPE, ATTR_ICON, ATTR_ICONDIR, ATTR_INDEX, ATTR_INDEXES, ATTR_MAXAGE, ATTR_MD5, ATTR_PUTABLE, ATTR_QUALITY, ATTR_RELOCATE, ATTR_STYLE_LINK, ATTR_TITLE, browsetype, COND_FAILED, COND_OK, COND_WEAK, dresource, fresource, listing, listing_stamp, STATE_CONTENT_LOCATION
 
Fields inherited from class org.w3c.tools.resources.ResourceFrame
filterClass, frameListener, resource
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, values
 
Constructor Summary
JpegXMPFrame()
           
 
Method Summary
 int checkIfMatch(Request request, HttpEntityTag etag)
          Check the If-Match condition of that request.
 int checkIfNoneMatch(Request request, HttpEntityTag etag)
          Check the If-None-Match condition of that request.
 int checkValidators(Request request, HttpEntityTag etag)
          check the validators namely LMT/Etags according to rfc2616 rules
 Reply createXMPReply(Request request)
           
 Reply createXMPReply(Request request, int status)
           
protected  Reply getFileResource(Request request)
          Get for FileResource
protected  HttpAccept getMatchingAccept(HttpAccept[] accepts, MimeType mime)
           
protected  java.lang.String getMetadata()
          Extract the XMP from the jpeg image.
 HttpEntityTag getXMPETag()
          Get the comment Etag
protected  Reply headFileResource(Request request)
          Perform a HEAD request for the associated FileResource.
protected  boolean negotiate(Request request)
          Negotiate.
protected  Reply putFileResource(Request request)
          Allow PUT based only on ETags, otherwise PUT is done on the image itself
protected  void updateCachedHeaders()
          Update the cached headers value.
 
Methods inherited from class org.w3c.jigsaw.frames.HTTPFrame
addStyleSheet, attributeChanged, browse, checkExpect, checkIfMatch, checkIfModifiedSince, checkIfNoneMatch, checkIfUnmodifiedSince, checkRequest, checkValidators, computeContainerListing, computeETag, computeTrashDir, computeTrashFile, createDefaultReply, createFileReply, delete, deleteDirectoryResource, deleteFileResource, deleteMe, deleteOtherResource, extended, get, getAllow, getAllowDeleteFlag, getBrowsableFlag, getBrowseType, getCharset, getContentEncoding, getContentLanguage, getContentLength, getContentType, getDirectoryListing, getDirectoryResource, getDirectoryResource, getETag, getFileResource, getHelpURL, getHelpURL, getIcon, getIconDirectory, getIndex, getIndexes, getMaxAge, getMD5Flag, getOtherResource, getPutableFlag, getQuality, getRelocateFlag, getStyleSheetURL, getTitle, getURL, handleRangeRequest, head, headDirectoryResource, headOtherResource, initialize, link, lookup, lookupDirectory, lookupFile, lookupOther, lookupResource, options, perform, performFrames, pickleValues, post, put, putOtherResource, registerOtherResource, registerResource, setValue, trace, unlink, unsafeGetQuality
 
Methods inherited from class org.w3c.tools.resources.ResourceFrame
addFrameEventListener, eventDisabled, fireFrameEvent, frameModified, getFilters, getFilters, getFrameReference, getResource, getResourceReference, getSpaceEntry, getURLPath, lookupFilters, lookupFrames, postFrameEvent, processEvent, removeFrameEventListener, unregisterResource, updateDefaultChildAttributes
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, initialize, markModified, notifyUnload, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, isInitialized, isUnloaded, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

vary

protected static java.lang.String[] vary
the static String of the Vary ehader to be added


xmptype

protected static MimeType xmptype
the static String of the Vary ehader to be added


xmpetag

protected HttpEntityTag xmpetag
The comment entity tag


xmpinfo

protected java.lang.String xmpinfo
The XMP.

Constructor Detail

JpegXMPFrame

public JpegXMPFrame()
Method Detail

getMetadata

protected java.lang.String getMetadata()
Extract the XMP from the jpeg image.

Returns:
the xmp info

getXMPETag

public HttpEntityTag getXMPETag()
Get the comment Etag

Returns:
an instance of HttpEntityTag, or null if not defined.

updateCachedHeaders

protected void updateCachedHeaders()
Update the cached headers value. Each resource maintains a set of cached values for headers, this allows for a nice sped-up in headers marshalling, which - as the complexity of the protocol increases - becomes a bottleneck.

Overrides:
updateCachedHeaders in class HTTPFrame

createXMPReply

public Reply createXMPReply(Request request,
                            int status)

createXMPReply

public Reply createXMPReply(Request request)

checkIfMatch

public int checkIfMatch(Request request,
                        HttpEntityTag etag)
Check the If-Match condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).

checkIfNoneMatch

public int checkIfNoneMatch(Request request,
                            HttpEntityTag etag)
Check the If-None-Match condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).

checkValidators

public int checkValidators(Request request,
                           HttpEntityTag etag)
check the validators namely LMT/Etags according to rfc2616 rules

Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).

negotiate

protected boolean negotiate(Request request)
                     throws ProtocolException
Negotiate.

Parameters:
request - the incomming request.
Returns:
true if the client wants the comment, false if the client wants the image.
Throws:
ProtocolException

getMatchingAccept

protected HttpAccept getMatchingAccept(HttpAccept[] accepts,
                                       MimeType mime)

headFileResource

protected Reply headFileResource(Request request)
                          throws ProtocolException,
                                 ResourceException
Perform a HEAD request for the associated FileResource.

Overrides:
headFileResource in class HTTPFrame
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

getFileResource

protected Reply getFileResource(Request request)
                         throws ProtocolException,
                                ResourceException
Get for FileResource

Overrides:
getFileResource in class HTTPFrame
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

putFileResource

protected Reply putFileResource(Request request)
                         throws ProtocolException,
                                ResourceException
Allow PUT based only on ETags, otherwise PUT is done on the image itself

Overrides:
putFileResource in class HTTPFrame
Parameters:
request - The incomming request.
Throws:
ProtocolException - if a protocol error occurs
ResourceException - If the resource got a fatal error.
See Also:
HTTPFrame.putFileResource