The onSetPath()
method has two boolean arguments to pass these values from the client??™s
request to the server.
108 Chapter Five: OBEX
The onGet() and onPut() methods work differently. These methods
have only a single argument, an Operation object. The Operation
object provides access to the BODY header through the InputStream
and OutputStream. Unlike Operation objects returned by the client??™s
get() and put(), Operation objects received via the server??™s onGet()
and onPut() methods do not have any special ordering rules. (For
example, an Operation object received as an argument in onGet()
may read from the InputStream first or it may write to the Output-
Stream first.) The Operation getResponseCode() and abort()
methods throw an IOException if called on the server. If the server
receives an ABORT from the client, the Operation is closed, and all the
methods on the closed Operation throw an IOException.
In addition to BODY headers, GET and PUT operations can use
additional headers. These headers can be retrieved via the getReceived-
Headers() method. This method returns a HeaderSet object containing
all the latest headers received. Because GET and PUT operations may
require multiple request and reply packets within a single operation, the
same header may be sent multiple times. The getReceivedHeaders()
method returns the HeaderSet object containing only the latest headers
received.
Pages:
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153