uCosminexus Application Server, Web Service Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Glossary]](FIGURE/GLOSS.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
type(String type) method
Description
This method sets a MIME media type.
Syntax
public T type(String type)
Parameter
- type
- This is a MIME media type.
Return value
The method returns a builder (WebResource.Builder object).
Notes
- If null or an empty string is set in the type parameter, the IllegalArgumentException exception is thrown.
- The value returned by the toString() method of the MediaType object set up by specifying the type parameter in the parameter of the valueOf(String) static method of the MediaType class is set in the Content-Type HTTP header. The JAX-RS engine does not validate the values specified in the type parameter. 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 by the value of the type parameter:
- 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(MediaType type) 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
The operation when the MIME media type is not set with these methods and the type(String 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.