@Override public void failed(Exception ex) { final String msg = String.format("Failed to create transaction for %s", post.getURI()); logger.error(msg, ex); eventReporter.reportEvent(Severity.WARNING, EVENT_CATEGORY, msg); }
@Override public HttpHost getTarget() { return URIUtils.extractHost(post.getURI()); }
@Test( expected = KettleException.class ) public void testSendXML() throws Exception { slaveServer.setHostname( "hostNameStub" ); slaveServer.setUsername( "userNAmeStub" ); HttpPost httpPostMock = mock( HttpPost.class ); URI uriMock = new URI( "fake" ); doReturn( uriMock ).when( httpPostMock ).getURI(); doReturn( httpPostMock ).when( slaveServer ).buildSendXMLMethod( any( byte[].class ), anyString() ); slaveServer.sendXML( "", "" ); fail( "Incorrect connection details had been used, but no exception was thrown" ); }
@Test( expected = KettleException.class ) public void testSendExport() throws Exception { slaveServer.setHostname( "hostNameStub" ); slaveServer.setUsername( "userNAmeStub" ); HttpPost httpPostMock = mock( HttpPost.class ); URI uriMock = new URI( "fake" ); doReturn( uriMock ).when( httpPostMock ).getURI(); doReturn( httpPostMock ).when( slaveServer ).buildSendExportMethod( anyString(), anyString(), any( InputStream.class ) ); File tempFile; tempFile = File.createTempFile( "PDI-", "tmp" ); tempFile.deleteOnExit(); slaveServer.sendExport( tempFile.getAbsolutePath(), "", "" ); fail( "Incorrect connection details had been used, but no exception was thrown" ); }
final HttpPost post = createPost(flowFilesPath); ((HttpCommunicationsSession)peer.getCommunicationsSession()).setDataTransferUrl(post.getURI().toString()); final URI requestUri = post.getURI(); final PipedOutputStream outputStream = new PipedOutputStream(); final PipedInputStream inputStream = new PipedInputStream(outputStream, DATA_PACKET_CHANNEL_READ_BUFFER_SIZE);
@Override public URI getUri() throws URISyntaxException { return new URI(httpPost.getURI().toString()); }
@Override public URI getUri() throws URISyntaxException { return new URI(httpPost.getURI().toString()); }
@Override public URI getUri() throws URISyntaxException { return new URI(httpPost.getURI().toString()); }
@Override public void failed(Exception e) { httpPost.reset(); LOG.error("Monitor web service invoke failed, url={}", httpPost.getURI(), e); }
@Override public void failed(Exception e) { httpPost.reset(); LOG.error("Monitor web service invoke failed, url={}", httpPost.getURI(), e); }
public CouchPostRequest(HttpPost request) { this.request = request; uri = new CouchURI(request.getURI()); }
@Override public void prune() throws IOException, UnexpectedResponseException { final HttpPost prune = new HttpPost( this.baseUri.toString().concat("/prune") ); try { this.client.execute( prune, new MatchStatus(prune.getURI(), HttpStatus.SC_OK) ); } finally { prune.releaseConnection(); } }
@Override public void kill() throws IOException, UnexpectedResponseException { final HttpPost kill = new HttpPost( this.baseUri.toString() + "/kill" ); try { this.client.execute( kill, new MatchStatus(kill.getURI(), HttpStatus.SC_NO_CONTENT) ); } finally { kill.releaseConnection(); } }
@Override public void prune() throws IOException, UnexpectedResponseException { final HttpPost prune = new HttpPost( this.baseUri.toString().concat("/prune") ); try { this.client.execute( prune, new MatchStatus(prune.getURI(), HttpStatus.SC_OK) ); } finally { prune.releaseConnection(); } }
@Override public void start() throws IOException { final HttpPost start = new HttpPost( this.baseUri.toString() + "/start" ); try { this.client.execute( start, new MatchStatus(start.getURI(), HttpStatus.SC_NO_CONTENT) ); } finally { start.releaseConnection(); } }
@Override public void rename(final String name) throws IOException, UnexpectedResponseException { final HttpPost rename = new HttpPost( this.baseUri.toString() + "/rename?name=" + name ); try { this.client.execute( rename, new MatchStatus(rename.getURI(), HttpStatus.SC_NO_CONTENT) ); } finally { rename.releaseConnection(); } }
HttpPost post = new HttpPost(); post.getAllHeaders(); post.getMethod(); // Post or get request post.getParams(); // Returns params post.getURI(); // Current Uri called
public static void fireDelegate(HttpPost request, MpnsNotification message, HttpResponse response, MpnsDelegate delegate) { if (delegate != null) { MpnsResponse r = Utilities.logicalResponseFor(response); URI uri = request.getURI(); if (r.isSuccessful()) { delegate.messageSent(uri.toString(), message, r); } else { delegate.messageFailed(uri.toString(), message, r); } } }