## org.w3c.jigsaw.frames
Class JpegComFrame

    java.lang.Object
      |
      +--org.w3c.tools.resources.AttributeHolder
            |
            +--org.w3c.tools.resources.Resource
                  |
                  +--org.w3c.tools.resources.FramedResource
                        |
                        +--org.w3c.tools.resources.ResourceFrame
                              |
                              +--org.w3c.tools.resources.ProtocolFrame
                                    |
                                    +--org.w3c.jigsaw.frames.HTTPFrame
                                          |
                                          +--org.w3c.jigsaw.frames.JpegComFrame

public class JpegComFrame
extends HTTPFrame

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

Field Summary
`protected static int` `ATTR_COM_TYPE` Attribute index - The comment content type
`protected HttpEntityTag` `cometag` The comment entity tag
`protected java.lang.String` `comment` The comment.
`static boolean` `debug`
`protected static java.lang.String[]` `vary` 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
`JpegComFrame()`

Method Summary
`void` `attributeChanged(AttributeChangedEvent evt)` Listen its resource.
`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` `createCommentReply(Request request)`
`Reply` `createCommentReply(Request request, int status)`
`HttpEntityTag` `getComETag()` Get the comment Etag
`MimeType` `getCommentType()` get the content type of the comment embedded in the picture
`protected Reply` `getFileResource(Request request)` Get for FileResource
`protected HttpAccept` `getMatchingAccept(HttpAccept[] accepts, MimeType mime)`
`protected java.lang.String` `getMetadata()` Extract the comment from the jpeg image.
`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, 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`

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, unsafeGetIdentifier, 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, 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

### ATTR_COM_TYPE

    protected static int ATTR_COM_TYPE

  Attribute index - The comment content type

### vary

    protected static java.lang.String[] vary

  the static String of the Vary ehader to be added

### cometag

    protected HttpEntityTag cometag

  The comment entity tag

### comment

    protected java.lang.String comment

  The comment.

Constructor Detail

### JpegComFrame

    public JpegComFrame()

Method Detail

### getCommentType

    public MimeType getCommentType()

  get the content type of the comment embedded in the picture
  Returns:
    a MimeType, or null if undefined

### getMetadata

    protected java.lang.String getMetadata()

  Extract the comment from the jpeg image.
  Returns:
    the comment

### getComETag

    public HttpEntityTag getComETag()

  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

### attributeChanged

    public void attributeChanged(AttributeChangedEvent evt)

  Listen its resource.
  Overrides:
    attributeChanged in class HTTPFrame
  Tags copied from interface: AttributeChangedListener
  Parameters:
    `evt` - The AttributeChangeEvent describing the change.

### createCommentReply

    public Reply createCommentReply(Request request,
                                    int status)

### createCommentReply

    public Reply createCommentReply(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</cond> 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</cond> 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</cond> 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.

### 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
  See Also:
    `HTTPFrame.putFileResource`