org.clazzes.util.http
Class AcceptHelper

java.lang.Object
  extended by org.clazzes.util.http.AcceptHelper

public abstract class AcceptHelper
extends Object

Provide selections of items from Accept, Accept-Charset, Accept-Encoding or Accept-Language HTTP headers.


Constructor Summary
AcceptHelper()
           
 
Method Summary
static String selectAcceptItem(String acceptedItems, String[] supportedItems)
          Evaluate an Accept-* header and match it against a list of supported server-side items based on exact string matching.
static String selectAcceptItem(String acceptedItems, String[] supportedItems, AcceptMatcher matcher)
          Evaluate an Accept-* header and match it against a list of supported server-side items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptHelper

public AcceptHelper()
Method Detail

selectAcceptItem

public static String selectAcceptItem(String acceptedItems,
                                      String[] supportedItems)
Evaluate an Accept-* header and match it against a list of supported server-side items based on exact string matching.

Parameters:
acceptedItems - The value of an Accept-* header.
supportedItems - The list of server-side items. (locales, encodings,...)
Returns:
The sever-side item, which best matches the client's needs or null, if no requested item matches any of the server-side values.

selectAcceptItem

public static String selectAcceptItem(String acceptedItems,
                                      String[] supportedItems,
                                      AcceptMatcher matcher)
Evaluate an Accept-* header and match it against a list of supported server-side items.

Parameters:
acceptedItems - The value of an Accept-* header.
supportedItems - The list of server-side items. (locales, encodings,...)
matcher - A matcher for allowing fuzzy matches or null to use exact matching through String.equals(Object).
Returns:
The sever-side item, which best matches the client's needs or null, if no requested item matches any of the server-side values.


Copyright © 2013. All Rights Reserved.