|
Oracle Fusion Middleware Java API Reference for Oracle WebLogic Server 12c (12.1.2) Part Number E27170-02 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AsyncResponseCallback
Callback to be notified when there is response ready to be read. The response can be read using HttpURLConnection methods like getInputStream().
Note that handleResponse() can also be called in exception conditions and the user will encounter the exception while using HttpURLConnection methods to get the response code, read the response bytes etc.
public void handleResponse(HttpURLConnection connection) { DataInputStream in = null; try { in = new DataInputStream(connection.getInputStream()); if (connection.getResponseCode() != 200) { throw new IOException("Unexpected error on the server didn't " + "receive response code 200"); } byte[] b = new byte[connection.getContentLength()]; DataIO.readFully(in, b); } catch (IOException ioe) { // handle exception } finally { // IMPORTANT TO CLOSE TO RELEASE CHUNKS in.close(); }
Method Summary | |
---|---|
void |
handleResponse(HttpURLConnection connection)
This method is called when the response is available to be read from the HttpURLConnection. |
Method Detail |
---|
void handleResponse(HttpURLConnection connection)
connection
- URLConnection associated with request/response
|
Copyright 1996, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Oracle Fusion Middleware Java API Reference for Oracle WebLogic Server 12c (12.1.2) Part Number E27170-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |