×
Namespaces

Variants
Actions
Revision as of 08:56, 28 June 2012 by hamishwillee (Talk | contribs)

Archived:OBEX/Bluetooth - getReceivedHeaders() returns null (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: 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
Symbian
S60 3rd Edition FP1
S60 3rd Edition (initial release)
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

  1. 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;
    }
    }
  2. After installing test MIDlets, launch the server and the client.
  3. 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.

39 page views in the last 30 days.
×