com.sun.jersey.server.impl.uri.rules
Class HttpMethodRule
java.lang.Object
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:
- Paul.Sandoz@Sun.Com
Method Summary |
boolean |
accept(java.lang.CharSequence path,
java.lang.Object resource,
UriRuleContext context)
Accept the rule. |
static java.util.List<javax.ws.rs.core.MediaType> |
getSpecificAcceptableMediaTypes(java.util.List<javax.ws.rs.core.MediaType> acceptableMediaType,
java.util.List<? extends javax.ws.rs.core.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 |
HttpMethodRule
public HttpMethodRule(java.util.Map<java.lang.String,java.util.List<ResourceMethod>> methods)
HttpMethodRule
public HttpMethodRule(java.util.Map<java.lang.String,java.util.List<ResourceMethod>> methods,
boolean isSubResource)
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 pathresource
- the current resource instancecontext
- 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<javax.ws.rs.core.MediaType> getSpecificAcceptableMediaTypes(java.util.List<javax.ws.rs.core.MediaType> acceptableMediaType,
java.util.List<? extends javax.ws.rs.core.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 © 2011 Sun Microsystems, Inc. All Rights Reserved.