org.apache.jena.atlas.web
Class AcceptList

java.lang.Object
  extended by org.apache.jena.atlas.web.AcceptList

public class AcceptList
extends Object


Constructor Summary
AcceptList(List<MediaRange> mediaRanges)
          Create a list of accept items from the give strings.
AcceptList(MediaRange... acceptItems)
          Create a list of accept items from the give MediaTypes.
AcceptList(String headerString)
          Parse an HTTP Accept (or etc) header string.
 
Method Summary
static AcceptList create(MediaType... acceptItems)
          Create a list of accept items from the give MediaTypes.
static AcceptList create(String... acceptStrings)
          Create a list of accept items from strings.
 MediaRange first()
           
static MediaType match(AcceptList proposalList, AcceptList offerList)
          Find the best thing in offer list 8sever side) matching the proposal (client, Accept header).
 MediaRange match(MediaType offer)
          Find and return a match for a specific MediaType.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AcceptList

public AcceptList(List<MediaRange> mediaRanges)
Create a list of accept items from the give strings.

Parameters:
mediaRanges -

AcceptList

public AcceptList(MediaRange... acceptItems)
Create a list of accept items from the give MediaTypes.

Parameters:
acceptItems -

AcceptList

public AcceptList(String headerString)
Parse an HTTP Accept (or etc) header string.

Parameters:
headerString -
Method Detail

create

public static AcceptList create(MediaType... acceptItems)
Create a list of accept items from the give MediaTypes.

Parameters:
acceptItems -

create

public static AcceptList create(String... acceptStrings)
Create a list of accept items from strings.

Parameters:
acceptStrings -

match

public MediaRange match(MediaType offer)
Find and return a match for a specific MediaType. Returns the Accept header entry best matched or null.


match

public static MediaType match(AcceptList proposalList,
                              AcceptList offerList)
Find the best thing in offer list 8sever side) matching the proposal (client, Accept header). "best" means highest q value, with left most being better for same q.

Parameters:
proposalList - Client list of possibilities
offerList - Server list of possibilities
Returns:
MediaType

first

public MediaRange first()

toString

public String toString()
Overrides:
toString in class Object


Licenced under the Apache License, Version 2.0