Archived:OBEX/Bluetooth - getReceivedHeaders() returns null (Known Issue)
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Tested with
Devices(s): Nokia E61, Nokia E66, Nokia N91, Nokia N93, Nokia N95, Nokia 6110 Navigator
Compatibility
Platform(s): S60 3rd Edition, S60 3rd Edition FP1
Article
Keywords: Operation.getReceivedHeaders()
Created: schoenke
(23 Dec 2008)
Last edited: hamishwillee
(28 Jun 2012)
Description
In S60 Editions prior to S60 3rd Edition FP2, calling getReceivedHeaders() after initiating an OBEX get operation returns null although the server side explicitly sends a header by calling the Operation.sendHeaders() method. This known issue has been verified by Nokia Developer.
How to reproduce
- Implement two MIDlets, a client and a server, for an OBEX test, by using the following code snippets:
- Client side:
-
// [...]
LocalDevice localDevice = LocalDevice.getLocalDevice();
DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
// Locate device
// [...]
// Search service
// [...]
// Connect to server
conn = (ClientSession) Connector.open(serverURL);
conn.connect(null);
HeaderSet reqHeader = conn.createHeaderSet();
reqHeader.setHeader(HeaderSet.TYPE, "myType");
Operation operation = conn.get(reqHeader);
HeaderSet rspHeader = operation.getReceivedHeaders();
if (rspHeader == null) {
// show notification if the returned HeaderSet value is null
}
// [...] - Server side:
-
// this method is part of a class that extends class ServerRequestHandler
public int onGet(Operation pOperation) {
try {
HeaderSet reqHeader = pOperation.getReceivedHeaders();
String type = (String) reqHeader.getHeader(HeaderSet.TYPE);
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
// fill 'baos' depending on the content of 'type'
HeaderSet rspHeader = createHeaderSet();
rspHeader.setHeader(HeaderSet.LENGTH, new Long(target.size()));
pOperation.sendHeaders(rspHeader);
OutputStream os = pOperation.openOutputStream();
os.write(baos.toByteArray());
os.close();
pOperation.close();
return ResponseCodes.OBEX_HTTP_OK;
}
catch (IOException e) {
return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
}
}
- After installing test MIDlets, launch the server and the client.
- For the affected devices, the value that getReceivedHeaders() returns to the client will be null.
Solution
This issue has been fixed starting from S60 3rd Edition, FP2.


(no comments yet)