uCosminexus Application Server, Web Service Development Guide
From among the parameters of a resource method, a parameter that is not annotated by an annotation is called an entity parameter. The value of the entity parameter is an entity body.
The following example describes an entity parameter used in the resource method.
@POST
public String getRequestParameters(@MatrixParam("matrix") String matrix,
String entity) {
return "Matrix is:" + matrix + "\mEntity Body is: " + entity;
}
|
In this example, the resource method getRequestParameters() contains the parameter matrix annotated by the MatrixParam annotation and the un-annotated parameter entity (entity parameter). When an HTTP request with the entity body content of Entity Content is received, the value of the entity parameter entity is Entity Content.
The following table describes the combinations of the Java types and the MIME media types that can be used as entity parameters. Do not use the annotations of the JAXB specifications for a POJO. If you use the annotations, the actual operations might differ from the described operations.
Table 17-5 Combinations of Java types and MIME media types that can be used as entity parameters
| 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 | Y | Any (*/*) |
| 6 | javax.activation.DataSource | Y | Any (*/*) |
| 7 | javax.xml.transform.Source#3 | N | text/xml, application/xml, application/*+xml |
| 8 | javax.xml.bind.JAXBElement<String>#4 | N | text/xml, application/xml, application/*+xml |
| 9 | The JAXB class annotated by the XmlRootElement annotation and/or the XmlType annotation#4 | 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 | text/xml, application/xml, application/*+xml |
| 12 | java.util.List<T>#5 | N | text/xml, application/xml, application/*+xml |
| 13 | java.awt.image.RenderedImage | N | application/octet-stream, image/jpeg |
| 14 | com.cosminexus.jersey.core.provider.EntityHolder<T>#6 | D | The same MIME media type as the type specified in T. |
| 15 | POJO#7 | Y | application/json |
Further notes on the entity parameters are as follows:
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.