com.sun.jersey.server.impl.uri.rules
Class HttpMethodRule

java.lang.Object
  extended by com.sun.jersey.server.impl.uri.rules.HttpMethodRule
All Implemented Interfaces:
UriRule

public final class HttpMethodRule
extends java.lang.Object
implements UriRule

The rule for accepting an HTTP method.

Author:
[email protected]

Field Summary
static java.lang.String CONTENT_TYPE_PROPERTY
           
 
Constructor Summary
HttpMethodRule(java.util.Map<java.lang.String,java.util.List<ResourceMethod>> methods, boolean isSubResource, DispatchingListener dispatchingListener)
           
HttpMethodRule(java.util.Map<java.lang.String,java.util.List<ResourceMethod>> methods, DispatchingListener dispatchingListener)
           
 
Method Summary
 boolean accept(java.lang.CharSequence path, java.lang.Object resource, UriRuleContext context)
          Accept the rule.
static java.util.List<MediaType> getSpecificAcceptableMediaTypes(java.util.List<MediaType> acceptableMediaType, java.util.List<? extends MediaType> priorityMediaTypes)
          Get a list of media types that are acceptable for the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE_PROPERTY

public static final java.lang.String CONTENT_TYPE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

HttpMethodRule

public HttpMethodRule(java.util.Map<java.lang.String,java.util.List<ResourceMethod>> methods,
                      DispatchingListener dispatchingListener)

HttpMethodRule

public HttpMethodRule(java.util.Map<java.lang.String,java.util.List<ResourceMethod>> methods,
                      boolean isSubResource,
                      DispatchingListener dispatchingListener)
Method Detail

accept

public boolean accept(java.lang.CharSequence path,
                      java.lang.Object resource,
                      UriRuleContext context)
Description copied from interface: UriRule
Accept the rule.

Specified by:
accept in interface UriRule
Parameters:
path - the URI path
resource - the current resource instance
context - the rule context
Returns:
if true then the rule was accepted, if false then the rule was not accepted.

getSpecificAcceptableMediaTypes

public static java.util.List<MediaType> getSpecificAcceptableMediaTypes(java.util.List<MediaType> acceptableMediaType,
                                                                        java.util.List<? extends MediaType> priorityMediaTypes)
Get a list of media types that are acceptable for the response.

Parameters:
acceptableMediaType - the list of acceptable media types.
priorityMediaTypes - the list of media types that take priority.
Returns:
a singleton list containing the most specific media type for first media type in priorityMediaTypes that is compatible with an acceptable media type, otherwise the list of all acceptable media type is returned.


Copyright © 2013 Oracle Corporation. All Rights Reserved.