@Override public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<T> awsResponse = super.handle(response); T result = awsResponse.getResult(); if (result != null) { for (HeaderHandler<T> handler : headerHandlers) { handler.handle(result, response); } } return awsResponse; } }
@Override public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<T> awsResponse = super.handle(response); T result = awsResponse.getResult(); if (result != null) { for (HeaderHandler<T> handler : headerHandlers) { handler.handle(result, response); } } return awsResponse; } }
@Test public void testS3XmlResponseHandlerTest() throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream("content".getBytes(StringUtils.UTF8)); HttpResponse response = new HttpResponse.Builder().content(bais) .header("testKey", "testValue").build(); final List<Boolean> handleCalled = new ArrayList<Boolean>(); S3XmlResponseHandler<String> handler = new S3XmlResponseHandler<String>( new Unmarshaller<String, InputStream>() { @Override public String unmarshall(InputStream in) throws Exception { assertEquals("content", IOUtils.toString(in)); handleCalled.add(true); return null; } }); handler.handle(response); assertEquals(handleCalled.size(), 1); assertTrue(handleCalled.get(0)); }
@Override public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<T> awsResponse = super.handle(response); T result = awsResponse.getResult(); if (result != null) { for (HeaderHandler<T> handler : headerHandlers) { handler.handle(result, response); } } return awsResponse; } }
@Override public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<T> awsResponse = super.handle(response); T result = awsResponse.getResult(); if (result != null) { for (HeaderHandler<T> handler : headerHandlers) { handler.handle(result, response); } } return awsResponse; } }