List of usage examples for org.apache.http.client ClientProtocolException getMessage
public String getMessage()
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public List<VM> getVms() { try {//from ww w .j av a2s. co m return this.api.getVMs().list(); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getMessage(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public VM getVmById(String vmid) { try {//from ww w . j a v a2 s. c o m return this.api.getVMs().get(UUID.fromString(vmid)); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getMessage(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public Action startVm(String vmid) { try {//from w w w . j a va 2 s . co m VM vm = this.api.getVMs().get(UUID.fromString(vmid)); return vm.start(new Action()); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getReason() + ": " + e.getDetail(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public Action stopVm(String vmid) { try {//from w w w .ja v a 2s. c o m VM vm = this.api.getVMs().get(UUID.fromString(vmid)); return vm.stop(new Action()); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getReason() + ": " + e.getDetail(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public Action ticketVm(String vmid) { try {// w w w .ja va2 s. co m VM vm = this.api.getVMs().get(UUID.fromString(vmid)); return vm.ticket(new Action()); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getReason() + ": " + e.getDetail(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }
From source file:com.normalexception.app.rx8club.task.SubmitTask.java
@Override protected Void doInBackground(Void... params) { try {/* w w w.j a va 2 s. com*/ String attId = ""; if (bitmaps.size() != 0) { publishProgress(sourceActivity.getString(R.string.asyncDialogUploadAttachment)); //attId = HtmlFormUtils.submitAttachment(token, bitmaps, post); publishProgress(sourceActivity.getString(R.string.asyncDialogUploadDone)); } publishProgress(sourceActivity.getString(R.string.asyncDialogSubmitting)); if (HtmlFormUtils.submitPost(doType, token, thread, post, attId, text)) Log.d(TAG, "Html Form Submitted"); else Log.d(TAG, "Form Submit Failed"); } catch (ClientProtocolException e) { Log.e(TAG, e.getMessage(), e); } catch (IOException e) { Log.e(TAG, e.getMessage(), e); } return null; }
From source file:com.liato.bankdroid.banking.banks.ICA.java
@Override public Urllib login() throws LoginException, BankException { try {// w ww.j a v a 2 s . c om LoginPackage lp = preLogin(); String response = urlopen.open(lp.getLoginTarget(), lp.getPostData()); Matcher matcher = reLoginError.matcher(response); if (matcher.find()) { throw new LoginException(Html.fromHtml(matcher.group(1)).toString().trim()); } } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { throw new BankException(e.getMessage()); } return urlopen; }
From source file:com.restfiddle.handler.http.GenericHandler.java
/** * This method will be used for API processing and the method below this will be deprecated. *//*w ww. ja v a2 s. c o m*/ public RfResponseDTO processHttpRequest(RfRequestDTO rfRequestDTO) { HttpUriRequest httpUriRequest = rfRequestBuilder.build(rfRequestDTO); CloseableHttpClient httpClient = rfHttpClientBuilder.build(rfRequestDTO, httpUriRequest); RfResponseDTO responseDTO = null; try { long startTime = System.currentTimeMillis(); CloseableHttpResponse httpResponse = httpClient.execute(httpUriRequest); long endTime = System.currentTimeMillis(); long duration = endTime - startTime; responseDTO = buildRfResponse(httpResponse, duration, rfRequestDTO); } catch (ClientProtocolException e) { logger.error(e.getMessage(), e); } catch (IOException e) { logger.error(e.getMessage(), e); } finally { try { if (httpClient != null) { httpClient.close(); } } catch (IOException e) { logger.error(e.getMessage(), e); } } return responseDTO; }
From source file:com.vsct.dt.strowgr.admin.repository.consul.ConsulReaderTest.java
@Test public void should_throw_exception_with_no_entity_when_status_out_of_range_200_299() { for (int status = 100; status < 600; status++) { if (status >= 200 && status < 300) continue; // skip // given//from w w w .j a v a2 s . com HttpResponse httpResponse = mock(HttpResponse.class); when(httpResponse.getStatusLine()) .thenReturn(new BasicStatusLine(new ProtocolVersion("http1.1", 1, 1), status, "")); // test try { new ConsulReader(null).parseHttpResponse(httpResponse, this::getHttpEntity); // check fail("can't reach this point for status " + status); } catch (ClientProtocolException e) { // check assertThat(e.getMessage()).contains(String.valueOf(status)); assertThat(e.getMessage()).contains("no content"); } } }
From source file:gov.nih.nci.caxchange.messaging.AdverseEventLoadTest.java
private void sendMessage() { try {//from w w w. j a v a2 s . c o m final HttpClient httpclient = new DefaultHttpClient(); final HttpPost httppost = new HttpPost(transcendCaxchangeServiceUrl); final StringEntity reqentity = new StringEntity(getCreateAdverseEventXMLStr()); httppost.setEntity(reqentity); httppost.setHeader(HttpHeaders.CONTENT_TYPE, "text/xml"); final HttpResponse response = httpclient.execute(httppost); final HttpEntity entity = response.getEntity(); if (entity != null) { final String output = EntityUtils.toString(entity); Assert.assertNotNull(output); Assert.assertEquals(true, output.contains("FAILURE")); } } catch (ClientProtocolException e) { Assert.fail(e.getMessage()); } catch (IllegalStateException e) { Assert.fail(e.getMessage()); } catch (IOException e) { Assert.fail(e.getMessage()); } }