Java Code Examples for com.sun.jersey.api.client.ClientResponse#toString()
The following examples show how to use
com.sun.jersey.api.client.ClientResponse#toString() .
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: OracleStorageService.java From front50 with Apache License 2.0 | 6 votes |
@Override public void ensureBucketExists() { WebResource wr = client.resource( UriBuilder.fromPath(endpoint + "/n/{arg1}/b/{arg2}") .build(region, namespace, bucketName)); wr.accept(MediaType.APPLICATION_JSON_TYPE); ClientResponse rsp = wr.head(); if (rsp.getStatus() == 404) { CreateBucketDetails createBucketDetails = CreateBucketDetails.builder().name(bucketName).compartmentId(compartmentId).build(); wr = client.resource(UriBuilder.fromPath(endpoint + "/n/{arg1}/b/").build(region, namespace)); wr.accept(MediaType.APPLICATION_JSON_TYPE); try { byte[] bytes = objectMapper.writeValueAsBytes(createBucketDetails); wr.post(new String(bytes, StandardCharsets.UTF_8)); } catch (IOException e) { throw new RuntimeException(e); } } else if (rsp.getStatus() != 200) { throw new RuntimeException(rsp.toString()); } }
Example 2
Source File: JiraExporter.java From rtc2jira with GNU General Public License v2.0 | 5 votes |
@Override public void initialize(Settings settings, StorageEngine store) throws Exception { this.settings = settings; this.store = store; setRestAccess(new JiraRestAccess(settings.getJiraUrl(), settings.getJiraUser(), settings.getJiraPassword())); ClientResponse response = getRestAccess().get("/myself"); // ClientResponse response = getRestAccess().get("/issue/WOR-137"); if (response.getStatus() != Status.OK.getStatusCode()) { throw new RuntimeException("Unable to connect to jira repository: " + response.toString()); } this.projectOptional = getProject(); mappingRegistry = new MappingRegistry(); this.workItemTypeMapping = new WorkItemTypeMapping(); }