uCosminexus Application Server, Web Service Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Glossary]](FIGURE/GLOSS.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
type(MediaType type) method
Description
This method sets a MIME media type.
Syntax
public WebResource.Builder type(MediaType type)
Parameter
- type
- This is a MIME media type.
Return value
The method returns a builder (WebResource.Builder object).
Notes
- The non-null value specified in the type parameter is set in the Content-Type HTTP header. A null value is ignored and is not set to the Content-Type HTTP header.
- The value returned by the toString() method of the MediaType object is set in the Content-Type HTTP header. The JAX-RS engine does not validate the values returned by the toString() method. Specify the value according to the standard specifications.
- If the Content-Type HTTP header is already set by using the following methods, the value is overwritten:
- ClientRequest.Builder class
entity(Object entity, MediaType type) method
entity(Object entity, String type) method
header(String name, Object value) method
type(MediaType type) method
type(String type) method
- WebResource class
entity(Object entity, MediaType type) method
entity(Object entity, String type) method
header(String name, Object value) method
type(String type) method
- WebResource.Builder class
entity(Object entity, MediaType type) method
entity(Object entity, String type) method
header(String name, Object value) method
type(MediaType type) method
type(String type) method
The operation when the MIME media type is not set with these methods and the type(MediaType type) method is the same as the operation when the Content-Type HTTP header is not set in the HttpURLConnection object before performing HTTP communication.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.