Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created March 2, 2016 10:15
Show Gist options
  • Save codenameone/3c9ffaef41f523426552 to your computer and use it in GitHub Desktop.
Save codenameone/3c9ffaef41f523426552 to your computer and use it in GitHub Desktop.
Sample code for the ConnectionRequest readHeaders method from Codename One
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);
@codenameone
Copy link
Author

Sample usage of ConnectionRequest.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment