Java Code Examples for javax.ws.rs.ext.MessageBodyReader#isReadable()

The following examples show how to use javax.ws.rs.ext.MessageBodyReader#isReadable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isReadable(ProviderInfo<MessageBodyReader<?>> pi,
                           Class<?> type,
                           Type genericType,
                           Annotation[] annotations,
                           MediaType mediaType,
                           Message m) {
    MessageBodyReader<?> ep = pi.getProvider();
    if (m.get(ACTIVE_JAXRS_PROVIDER_KEY) != ep) {
        injectContextValues(pi, m);
    }
    return ep.isReadable(type, genericType, annotations, mediaType);
}
 
Example 2
Source File: CachingMessageBodyReader.java    From cxf with Apache License 2.0 5 votes vote down vote up
private MessageBodyReader<T> getDelegatingReader(Class<?> type, Type gType, Annotation[] anns, MediaType mt) {
    for (MessageBodyReader<T> reader: delegatingReaders) {
        if (reader.isReadable(type, gType, anns, mt)) {
            return reader;
        }
    }
    return null;
}
 
Example 3
Source File: MediaTypeExtension.java    From openhab-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean isReadable(final Class<?> type, final Type genericType, final Annotation[] annotations,
        final MediaType mediaType) {
    final MessageBodyReader<T> reader = readers.get(mediaTypeWithoutParams(mediaType));
    return reader != null && reader.isReadable(type, genericType, annotations, mediaType);
}