Created
March 2, 2016 10:15
-
-
Save codenameone/3c9ffaef41f523426552 to your computer and use it in GitHub Desktop.
Sample code for the ConnectionRequest readHeaders method from Codename One
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConnectionRequest request = new ConnectionRequest(url, false) { | |
protected void readHeaders(Object connection) throws IOException { | |
String[] headerNames = getHeaderFieldNames(connection); | |
for(String headerName : headerNames) { | |
String headerValue = getHeader(headerName); | |
//.... | |
} | |
} | |
protected void readResponse(InputStream input) { | |
// just read from the response input stream | |
} | |
}; | |
NetworkManager.getInstance().addToQueue(request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of ConnectionRequest.
From the Codename One project