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 Object
implements UriRule

The rule for accepting an HTTP method.

Author:
Paul.Sandoz@Sun.Com

Field Summary
static String CONTENT_TYPE_PROPERTY
           
 
Constructor Summary
HttpMethodRule(Map<String,List<ResourceMethod>> methods)
           
HttpMethodRule(Map<String,List<ResourceMethod>> methods, boolean isSubResource)
           
 
Method Summary
 boolean accept(CharSequence path, Object resource, UriRuleContext context)
          Accept the rule.
static List<MediaType> getSpecificAcceptableMediaTypes(List<MediaType> acceptableMediaType, 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 String CONTENT_TYPE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

HttpMethodRule

public HttpMethodRule(Map<String,List<ResourceMethod>> methods)

HttpMethodRule

public HttpMethodRule(Map<String,List<ResourceMethod>> methods,
                      boolean isSubResource)
Method Detail

accept

public boolean accept(CharSequence path,
                      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 List<MediaType> getSpecificAcceptableMediaTypes(List<MediaType> acceptableMediaType,
                                                              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 acceptable media type as returned by #getAcceptableMediaTypes() .


Copyright © 2013 Oracle Corporation. All Rights Reserved.