2 * //******************************************************************
\r
4 * // Copyright 2015 Intel Corporation.
\r
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
8 * // Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * // you may not use this file except in compliance with the License.
\r
10 * // You may obtain a copy of the License at
\r
12 * // http://www.apache.org/licenses/LICENSE-2.0
\r
14 * // Unless required by applicable law or agreed to in writing, software
\r
15 * // distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * // See the License for the specific language governing permissions and
\r
18 * // limitations under the License.
\r
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
23 package org.iotivity.base;
\r
25 import java.util.EnumSet;
\r
26 import java.util.List;
\r
27 import java.util.Map;
\r
30 * OcResourceRequest provides APIs to extract details from a request
\r
32 public class OcResourceRequest {
\r
34 private OcResourceRequest(long nativeHandle) {
\r
35 this.mNativeHandle = nativeHandle;
\r
39 * Retrieves the type of request for the entity handler function to operate
\r
41 * @return request type. This could be 'GET'/'PUT'/'POST'/'DELETE'
\r
43 public RequestType getRequestType() {
\r
44 return RequestType.get(getRequestTypeNative());
\r
47 private native String getRequestTypeNative();
\r
50 * Retrieves the query parameters from the request
\r
52 * @return parameters in the request
\r
54 public native Map<String, String> getQueryParameters();
\r
57 * Retrieves the request handler flag set. This can be INIT flag and/or REQUEST flag and/or
\r
60 * INIT indicates that the vendor's entity handler should go and perform
\r
61 * initialization operations
\r
62 * REQUEST indicates that it is a request of certain type (GET/PUT/POST/DELETE) and entity
\r
63 * handler needs to perform corresponding operations
\r
64 * OBSERVE indicates that the request is of type Observe and entity handler needs to perform
\r
65 * corresponding operations
\r
67 * @return Set of handler flags
\r
69 public EnumSet<RequestHandlerFlag> getRequestHandlerFlagSet() {
\r
70 return RequestHandlerFlag.convertToEnumSet(getRequestHandlerFlagNative());
\r
73 private native int getRequestHandlerFlagNative();
\r
76 * Provides the entire resource attribute representation
\r
78 * @return OcRepresentation object containing the name value pairs representing
\r
79 * the resource's attributes
\r
81 public native OcRepresentation getResourceRepresentation();
\r
84 * Object provides observation information
\r
86 * @return observation information
\r
88 public native ObservationInfo getObservationInfo();
\r
91 * Specifies the resource uri
\r
93 * @param resourceUri resource uri
\r
95 public native void setResourceUri(String resourceUri);
\r
98 * Gets the resource URI
\r
100 * @return resource URI
\r
102 public native String getResourceUri();
\r
105 * This API retrieves a list of headerOptions which was sent from a client
\r
107 * @return List of header options
\r
109 public native List<OcHeaderOption> getHeaderOptions();
\r
112 * This API retrieves the request handle
\r
114 * @return request handle
\r
116 public native OcRequestHandle getRequestHandle();
\r
119 * This API retrieves the resource handle
\r
121 * @return resource handle
\r
123 public native OcResourceHandle getResourceHandle();
\r
126 protected void finalize() throws Throwable {
\r
132 private native void dispose();
\r
134 private long mNativeHandle;
\r