Skip to content

Commit

Permalink
fix for status response from service to client
Browse files Browse the repository at this point in the history
  • Loading branch information
germanattanasio committed Feb 12, 2015
1 parent c9ec014 commit 01d5cc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/com/ibm/cloudoe/samples/DemoServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.fluent.Executor;
import org.apache.http.client.fluent.Request;
Expand Down Expand Up @@ -91,9 +92,11 @@ protected void doPost(final HttpServletRequest req, final HttpServletResponse re

Executor executor = Executor.newInstance().auth(username, password);
Response response = executor.execute(newReq);
HttpResponse httpResponse = response.returnResponse();
resp.setStatus(httpResponse.getStatusLine().getStatusCode());

ServletOutputStream servletOutputStream = resp.getOutputStream();
response.returnResponse().getEntity()
.writeTo(servletOutputStream);
httpResponse.getEntity().writeTo(servletOutputStream);
servletOutputStream.flush();
servletOutputStream.close();
} catch (Exception e) {
Expand Down

0 comments on commit 01d5cc2

Please sign in to comment.