Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.jigsaw.frames
Class NegotiatedFrame

    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.NegotiatedFrame

public class NegotiatedFrame
extends HTTPFrame

Content negotiation.

Field Summary
`protected static int` | `ATTR_PARANOID_VARIANT_CHECK` Attribute index - Should the variants to be strictly checked? the variants should NEVER contain negotiated resources!
`protected static int` | `ATTR_PUT_POLICY` Attribute index - Should the PUT needs to be strictly checked?
`protected static int` | `ATTR_VARIANTS` Attribute index - The set of names of variants.
`static java.lang.String` | `DEFAULT_NEGOTIATED_ICON` Our default Icon
`static java.lang.String` | `NEGOTIATED_ICON_P` Our Icon property.
`protected static java.lang.String` | `STATE_NEG` our state
`protected HttpTokenList` | `vary` The Vary header field for this resource

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
`NegotiatedFrame()`

Method Summary
`protected java.lang.String[]` | `checkVariants(java.lang.String[] variants)`
`java.lang.String` | `getIcon()` Get this resource's icon.
`boolean` | `getParanoidVariantCheck()` get the variant checking policy
`boolean` | `getPutPolicy()` get the "strictness" of the PUT checking
`java.lang.String[]` | `getVariantNames()` Get the variant names.
`ResourceReference[]` | `getVariantResources()` Get the variant resources.
`boolean` | `lookup(LookupState ls, LookupResult lr)` Lookup the target resource.
`protected ResourceReference` | `negotiate(Request request)` Negotiate among the various variants for the Resource.
`protected boolean` | `negotiateCharsetQuality(java.util.Vector states, Request request)` Negotiate on charsets.
`protected boolean` | `negotiateContentEncoding(java.util.Vector states, Request request)` Negotiate among content encodings.
`protected boolean` | `negotiateContentType(java.util.Vector states, Request request)` Negotiate among content types.
`protected boolean` | `negotiateLanguageQuality(java.util.Vector states, Request request)` Negotiate among language qualities.
`protected ResourceReference` | `negotiatePut(Request request)` "negotiate" for a PUT, the negotiation of a PUT should be different as we just want to match the desciption of the entity and the available variants
`ReplyInterface` | `perform(RequestInterface req)` Perform an HTTP request.
`protected void` | `printNegotiationState(java.lang.String header, java.util.Vector states)` Print the current negotiation state.
`void` | `registerResource(FramedResource resource)` Register this frame to the given resource.
`void` | `setPutPolicy(boolean strict)`
`void` | `setPutPolicy(java.lang.Boolean strict)`
`void` | `setValue(int idx, java.lang.Object value)` Catch setValue, to maintain cached header values correctness.
`void` | `setVariants(java.lang.String[] variants)`

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, getFileResource, getHelpURL, getHelpURL, getIconDirectory, getIndex, getIndexes, getMaxAge, getMD5Flag, getOtherResource, getPutableFlag, getQuality, getRelocateFlag, getStyleSheetURL, getTitle, getURL, handleRangeRequest, head, headDirectoryResource, headFileResource, headOtherResource, initialize, link, lookupDirectory, lookupFile, lookupOther, lookupResource, options, performFrames, pickleValues, post, put, putFileResource, putOtherResource, registerOtherResource, trace, unlink, updateCachedHeaders`

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

### NEGOTIATED_ICON_P

    public static java.lang.String NEGOTIATED_ICON_P

  Our Icon property.

### DEFAULT_NEGOTIATED_ICON

    public static java.lang.String DEFAULT_NEGOTIATED_ICON

  Our default Icon

### STATE_NEG

    protected static java.lang.String STATE_NEG

  our state

### vary

    protected HttpTokenList vary

  The Vary header field for this resource

### ATTR_VARIANTS

    protected static int ATTR_VARIANTS

  Attribute index - The set of names of variants.

### ATTR_PUT_POLICY

    protected static int ATTR_PUT_POLICY

  Attribute index - Should the PUT needs to be strictly checked?

### ATTR_PARANOID_VARIANT_CHECK

    protected static int ATTR_PARANOID_VARIANT_CHECK

  Attribute index - Should the variants to be strictly checked? the variants should NEVER contain negotiated resources!

Constructor Detail

### NegotiatedFrame

    public NegotiatedFrame()

Method Detail

### setValue

    public void setValue(int idx,
                         java.lang.Object value)

  Description copied from class: HTTPFrame
  Catch setValue, to maintain cached header values correctness.
  Overrides:
    setValue in class HTTPFrame
  Tags copied from class: HTTPFrame
  Parameters:
    `idx` - The index of the attribute to be set.
    `value` - The new value for the attribute.

### getIcon

    public java.lang.String getIcon()

  Description copied from class: HTTPFrame
  Get this resource's icon.
  Overrides:
    getIcon in class HTTPFrame

### getVariantNames

    public java.lang.String[] getVariantNames()

  Get the variant names.

### checkVariants

    protected java.lang.String[] checkVariants(java.lang.String[] variants)

### setVariants

    public void setVariants(java.lang.String[] variants)

### getPutPolicy

    public boolean getPutPolicy()

  get the "strictness" of the PUT checking

### setPutPolicy

    public void setPutPolicy(java.lang.Boolean strict)

### setPutPolicy

    public void setPutPolicy(boolean strict)

### getParanoidVariantCheck

    public boolean getParanoidVariantCheck()

  get the variant checking policy

### getVariantResources

    public ResourceReference[] getVariantResources()
                                            throws ProtocolException

  Get the variant resources. This is somehow broken, it shouldn't allocate the array of variants on each call. However, don't forget that the list of variants can be dynamically edited, this means that if we are to keep a cache of it (as would be the case if we kept the array of variants as instance var) we should also take care of editing of attributes (possible, but I just don't have enough lifes).
  Returns:
    An array of ResourceReference, or null.
  Throws:
    ProtocolException - If one of the variants doesn't exist.

### printNegotiationState

    protected void printNegotiationState(java.lang.String header,
                                         java.util.Vector states)

  Print the current negotiation state.
  Parameters:
    `header` - The header to print first.
    `states` - The current negotiation states.

### negotiateContentEncoding

    protected boolean negotiateContentEncoding(java.util.Vector states,
                                               Request request)
                                        throws ProtocolException

  Negotiate among content encodings.

  BUG: This will work only for single encoded variants.

  Parameters:
    `states` - The current negotiation states.
    `request` - The request to handle.
  Returns:
    a boolean.
  Throws:
    ProtocolException - If one of the variants doesn't exist.

### negotiateCharsetQuality

    protected boolean negotiateCharsetQuality(java.util.Vector states,
                                              Request request)

  Negotiate on charsets. The algorithm is described in RFC2616 (Obsoletes RFC2068)
  Parameters:
    `states` - The current states of negotiation.
    `request` - The request to handle.

### negotiateLanguageQuality

    protected boolean negotiateLanguageQuality(java.util.Vector states,
                                               Request request)
                                        throws ProtocolException

  Negotiate among language qualities.

  BUG: This will only work for variants that have one language tag.

  Parameters:
    `states` - The current states of negotiation.
    `request` - The request to handle.
  Returns:
    a boolean.
  Throws:
    ProtocolException - If one of the variants doesn't exist.

### negotiateContentType

    protected boolean negotiateContentType(java.util.Vector states,
                                           Request request)
                                    throws ProtocolException

  Negotiate among content types.
  Parameters:
    `states` - The current states of negotiation.
    `request` - The request to handle.
  Returns:
    a boolean.
  Throws:
    ProtocolException - If one of the variants doesn't exist.

### negotiate

    protected ResourceReference negotiate(Request request)
                                   throws ProtocolException

  Negotiate among the various variants for the Resource. We made our best efforts to be as compliant as possible to the HTTP/1.0 content negotiation algorithm.
  Parameters:
    `request` - the incomming request.
  Returns:
    a RefourceReference instance.
  Throws:
    ProtocolException - If one of the variants doesn't exist.

### negotiatePut

    protected ResourceReference negotiatePut(Request request)
                                      throws ProtocolException,
                                             ResourceException

  "negotiate" for a PUT, the negotiation of a PUT should be different as we just want to match the desciption of the entity and the available variants
  Parameters:
    `request,` - the request to handle
  Returns:
    a ResourceReference instance
  Throws:
    ProtocolException - If negotiating among the resource variants failed.
    ResourceException - If the resource got a fatal error.

### registerResource

    public void registerResource(FramedResource resource)

  Description copied from class: HTTPFrame
  Register this frame to the given resource.
  Overrides:
    registerResource in class HTTPFrame
  Tags copied from class: HTTPFrame
  Parameters:
    `resource` - The resource associated with this frame.

### lookup

    public boolean lookup(LookupState ls,
                          LookupResult lr)
                   throws ProtocolException

  Lookup the target resource.
  Overrides:
    lookup in class HTTPFrame
  Parameters:
    `ls` - The current lookup state
    `lr` - The result
  Returns:
    true if lookup is done.
  Throws:
    ProtocolException - If an error relative to the protocol occurs

### perform

    public ReplyInterface perform(RequestInterface req)
                           throws ProtocolException,
                                  ResourceException

  Perform an HTTP request. Negotiate among the variants, the best variant according to the request fields, and make this elected variant serve the request.
  Overrides:
    perform in class HTTPFrame
  Parameters:
    `request` - The request to handle.
  Throws:
    ProtocolException - If negotiating among the resource variants failed.
    ResourceException - If the resource got a fatal error.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD