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