com.google.sitebricks.http.negotiate
Interface ContentNegotiator

All Known Implementing Classes:
RegexNegotiator, WildcardNegotiator

public interface ContentNegotiator

The strategy for deciding if a Java request handler method, annotated with content negotiation metadata should fire against the given http request. The default strategy compares the value of the annotation to the value(s) of the header exactly.


Method Summary
 boolean shouldCall(Map<String,String> negotiations, Request request)
          Tests whether a given http request (and its headers) should pass against the given map of content negotiation rules.
 

Method Detail

shouldCall

boolean shouldCall(Map<String,String> negotiations,
                   Request request)
Tests whether a given http request (and its headers) should pass against the given map of content negotiation rules.

Parameters:
negotiations - A Map of header names to match expressions (the value part of an annotation). For example, an annotation @Accept("text/html") would produce a map entry of ["Accept" -> "text/html"], assuming that the annotation is mapped via the SitebricksModule.negotiate(java.lang.String) method to the "Accept" http header.
request - The current http request to match against.
Returns:
True if the negotiation succeeded on this method.


Copyright © 2014. All rights reserved.