I have a resource methid as follows which needs ti return an arbitrary
content. I know the actual media type in the server for the arbitrary
content. I implemented the method as follows:
@Path("/repositoryItems/{id}")
@GET
public Response getRepositoryItem(@PathParam("id") String id) throws
JAXBException, IOException {
String mimeType = "application/octet-stream";
DataHandler ri = ...
resp = ri.getInputStream());
return
Response.status(200).type(mimeType).entity(resp).build();//"OK"
}
Now when I test with an id that returns an XML documents (media type =
"text/xml") the response looks like binary data:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml
Content-Length: 9392
Date: Mon, 15 Dec 2008 18:53:55 GMT
PD94bWwg.....
I hax expected something like:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml
Content-Length: 9392
Date: Mon, 15 Dec 2008 18:53:55 GMT
<someXmlTag>
</someXmlTag>
What am I doing wrong? Thanks.
--
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com