An SDMRequest object wraps all the information which is needed by the connectivity library to be able to perform the requests. The connectivity library interacts with the request object to query the necessary information about the headers, the post data, and so on.
ISDMRequest void setRequestUrl(final String aUrl) String getRequestUrl() void setRequestMethod(final int aRequestMethod) int getRequestMethod() byte[] getData() void setPriority(final int aPriority) int getPriority() boolean useCookies() void setListener(final ISDMNetListener aListener) ISDMNetListener getListener() boolean hasPostData() void postData(OutputStream os) void setHeaders(final Hashtable aHashtable) Hashtable getHeaders() void appendHeaders(final Hashtable aHashtable) void appendHeader(final String aHeaderName, final String aHeaderValue) void setEtag(String eTag, int eTagHeader) void enableStreaming(boolean tobestreamed) boolean isStreamingEnabled() InputStream getDataStream() void setDataStream(InputStream iStream)
The enableStreaming API is used by the application to enable streaming for downloading large amount of data from server to device.
The SetDataStream API is used by the application to enable streaming for uploading large amount of data from device to server.
ISDMNetListener void onSuccess(ISDMRequest aRequest, IHttpResponse aResponse) void onError(ISDMRequest aRequest, ISDMResponse aResponse, ISDMRequestStateElement aRequestStateElement)
ISDMRequestStateElement int getErrorCode() void setErrorCode(final int code) int getHttpStatusCode() void setHttpStatusCode(final int httpStatus) Exception getException() void setException(final Exception aException) String getRedirectLocation() IHttpResponse getResponse()
Example for successful response received by application from EIS public void onSuccess(ISDMRequest aRequest, SDMHttpResponse aResponse) { System.out.println("Http response status code:" + aResponse.getStatusCode()); System.out.println("Cookie string:" + aResponse.getCookie()); byte[] content = aResponse.getContent(); String response = new String(content); System.out.println("Received content:" + response); //get the headers Hashtable headers = aResponse.getHeaders(); }
Example for data streaming request made by application final ISDMRequest request = new SDMBaseRequest(); Hashtable headers = new Hashtable(); headers.put("Content-Type", "application/atom+xml"); request.setHeaders(headers); request.setPriority(ISDMRequest.PRIORITY_HIGH); request.setRequestMethod(ISDMRequest.REQUEST_METHOD_GET); request.setRequestUrl(url); request.setListener(listener); request.enableStreaming(true); requestManager.makeRequest(request); }