My software has a rest call which returns a byte[], it is fairly simple
as:
Response.ok(data).type("application/octet-stream").build();
This was working fine, until we upgraded from java 6 to java 7. Now I get
an internal error. Getting some detailed logging information I see the
below in the log.
It suggests that wink does not have a writer that can work out what to do
with a byte[]. Does anyone know if something changed between java 6 and 7
which might mean I have to explicitly tell wink how to write a byte array?
I would assume there is some way to register this manually, but I can't
find it for wink...
org.apache.wink.common.internal.registry.ProvidersRegistry.getMessageBodyWriter
, 'Getting MessageBodyWriter for class type class [B, genericType class
[B, annotations [@javax.ws.rs.GET(),
@javax.ws.rs.Path(value={dataStoreName}/{msgId})], and media type
application/octet-stream'
org.apache.wink.common.internal.registry.ProvidersRegistry$MediaTypeMap.getProvidersByMediaType
, 'Getting providers by media type by calling
getProvidersByMediaType(application/octet-stream, class [B)'
org.apache.wink.common.internal.registry.ProvidersRegistry$MediaTypeMap.getProvidersByMediaType
, 'Get media type to providers cache for media type
application/octet-stream resulted in []'
org.apache.wink.common.internal.registry.ProvidersRegistry.getMessageBodyWriter
, 'Found possible MessageBodyWriter ObjectFactories []'
org.apache.wink.common.internal.registry.ProvidersRegistry.getMessageBodyWriter
, 'No MessageBodyWriter returned true for isWriteable( class [B, class [B,
[@javax.ws.rs.GET(), @javax.ws.rs.Path(value={dataStoreName}/{msgId})],
application/octet-stream )'
org.apache.wink.server.internal.handlers.FlushResultHandler.handleResponse
, 'Could not find a writer for [B and application/octet-stream. Try to
find JAF DataSourceProvider'
com.sun.activation.registries.LogSupport.log , 'MailcapCommandMap:
createDataContentHandler for application/octet-stream'
org.apache.wink.server.internal.handlers.FlushResultHandler.handleResponse
, 'The system could not find a javax.ws.rs.ext.MessageBodyWriter or a
DataSourceProvider class for the [B type and application/octet-stream
mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the
JAX-RS application for the type and media type specified.'
...
RawType: interface javax.ws.rs.ext.MessageBodyReader
Data Map:
...
MediaType key = */*
ObjectFactory Set value = {
}
...
MediaType key = application/octet-stream
ObjectFactory Set value = {
}
...
RawType: interface javax.ws.rs.ext.MessageBodyWriter
Data Map:
...
MediaType key = */*
ObjectFactory Set value = {
}
...
MediaType key = application/octet-stream
ObjectFactory Set value = {
}
...
RawType: interface javax.ws.rs.ext.ContextResolver
Data Map: {empty}'
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU