Java Code Examples for com.sun.jersey.api.client.ClientResponse#getType()
The following examples show how to use
com.sun.jersey.api.client.ClientResponse#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Response.java From qaf with MIT License | 7 votes |
protected void init(ClientResponse clientResponse) { this.clientResponse = clientResponse; // messageBody = clientResponse.getEntity(type); setRawMessageBody(); headers = clientResponse.getHeaders(); status = clientResponse.getClientResponseStatus(); cookies = clientResponse.getCookies(); lastModified = clientResponse.getLastModified(); responseDate = clientResponse.getResponseDate(); language = clientResponse.getLanguage(); try { mediaType = clientResponse.getType(); } catch (Exception e) { System.err.println("Unable to parse media type. If want to access media type, you may try using 'Content-Type' from header."); e.printStackTrace(); } }
Example 2
Source File: RestIT.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void assertMediaType(ClientResponse response, MediaType expected) { MediaType actual = response.getType(); assertEquals(200, response.getStatus()); // use startsWith cause sometimes server also returns quality parameters (e.g. websphere/wink) assertTrue("Expected: " + expected + " Actual: " + actual, actual.toString().startsWith(expected.toString())); }