uCosminexus Application Server, Web Service Development Guide
The following table lists the combination of Java types and MIME media types that can be used in the return values.
Table 25-7 Combination of Java types and MIME media types that can be used in the return value of an entity body
| No. | Java Type | charset#1 | MIME Media Type |
|---|---|---|---|
| 1 | byte[] | N | Any (*/*) |
| 2 | java.lang.String | Y | Any (*/*) |
| 3 | java.io.InputStream | N | Any (*/*) |
| 4 | java.io.Reader | Y | Any (*/*) |
| 5 | java.io.File#2 | N | Any (*/*) |
| 6 | javax.activation.DataSource | N | Any (*/*) |
| 7 | javax.xml.transform.Source#3 | N | Any (*/*) |
| 8 | javax.xml.bind.JAXBElement<String>#4, #5 | N | text/xml, application/xml, application/*+xml |
| 9 | JAXB class annotated with the XmlRootElement annotation and/or the XmlType annotation#5 | N | text/xml, application/xml, application/*+xml |
| 10 | javax.ws.rs.core.MultivaluedMap<String,String> | Y | application/x-www-form-urlencoded |
| 11 | org.w3c.dom.Document | N | Any (*/*) |
| 12 | java.awt.image.RenderedImage | N | application/octet-stream, image/jpeg |
| 13 | com.cosminexus.jersey.api.client.GenericType<T>#6 | D | MIME media type similar to the type specified in T. |
| 14 | com.cosminexus.jersey.api.client.GenericType<T>#7 | D | MIME media type similar to the type specified in T. |
| 15 | POJO #8 | Y | application/json |
If the specified Java type is an unsupported type, an error occurs (KDJJ10031-E and KDJJ18888-E) and the ClientHandlerException exception is thrown.
If the return value is the following Java type and the MIME media type is a type that cannot be used by the entity body of an HTTP response, an error occurs (KDJJ10031-E or KDJJ18888-E) and the ClientHandlerException exception is thrown.
If the IOException exception is thrown during conversion from the HTTP response entity body, an error occurs (KDJJ18888-E) and the ClientHandlerException exception is thrown.
If an exception other than the IOException exception is thrown during conversion from the HTTP response entity body, the corresponding exception is thrown. To check the log, use the J2EE server log files instead of the JAX-RS functionality log files.
With the entity parameter java.awt.image.RenderedImage, if the Content-Type HTTP header is image/*, an error occurs (KDJJ18888-E) and the ClientHandlerException exception that wraps the java.io.IOException exception is thrown.
With the entity parameter com.cosminexus.jersey.api.client.GenericType<T>, if an HTTP response contains an entity body, and if T is of the type described in No.1 in the table, an error occurs (KDJJ10031-E and KDJJ18888-E) and the ClientHandlerException exception is thrown.
With the entity parameter com.cosminexus.jersey.core.provider.EntityHolder<T>, if an HTTP response contains an entity body, an error (KDJJ10003-E) occurs and the javax.ws.rs.WebApplicationException exception is thrown in one of the following cases:
If the client APIs operate on the J2EE server, the entity body contains maximum 10,000 form parameters by default. If the entity parameter type is javax.ws.rs.core.MultivaluedMap<String, String>, or com.cosminexus.jersey.core.provider.GenericType<EntityHolder<javax.ws.rs.core.MultivaluedMap<String, String>>> and if the number of response parameters exceed the specified value, the RuntimeException exception is thrown. Change the value in the webserver.connector.limit.max_parameter_count property of the user property file for J2EE servers (usrconf.properties) as and when required. To check the log, use the J2EE server log files instead of the JAX-RS functionality log files.
If the Content-Type HTTP header does not exist in the HTTP response, the MIME media type is considered to be the application/octet-stream.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.