Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class MediaTypes
- Object
- MediaTypes
Media-type matching for a route’s consumes and produces, called by the
generated router before it binds anything.
Type names are compared without case folding through toLowerCase, which is
locale sensitive; parameters (; charset=utf-8) are ignored, and either side
may use a * wildcard for the type or the subtype.
Internal to generated code.
Methods
public static boolean consumable(String contentType, String accepted) | Whether a request whose Content-Type is contentType may reach a route that consumes accepted, a comma separated list. |
public static boolean acceptable(String accept, String offered) | Whether a request whose Accept header is accept takes any of offered, a comma separated list; when it does not, the route answers 406. |
Inherited methods
Method details
consumable
public static boolean consumable(String contentType, String accepted)Whether a request whose
Content-Type is contentType may reach a route
that consumes accepted, a comma separated list. A request with no
Content-Type is not consumable: it is answered 415, as Spring answers it.acceptable
public static boolean acceptable(String accept, String offered)Whether a request whose
Accept header is accept takes any of
offered, a comma separated list; when it does not, the route answers 406.
No Accept header accepts anything, and a range with q=0 accepts nothing.