1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 package org.iotivity.service.server;
23 import org.iotivity.service.RcsResourceAttributes;
26 * This class provides methods to create the response for a get request.
28 * @see RcsResourceObject
31 public class RcsGetResponse extends RcsResponse {
34 * Creates a default RCcsGetResponse. The response will have
35 * {@link #DEFAULT_ERROR_CODE} for the errorCode. The attributes of
36 * {@link RcsResourceObject} will be set as the result attributes.
39 public static RcsGetResponse defaultAction() {
40 return new RcsGetResponse();
44 * Creates a RcsGetResponse with error code passed. The
45 * attributes of the {@link RcsResourceObject} will be set as the result
49 * error code to be set in response
52 public static RcsGetResponse create(int errorCode) {
53 return new RcsGetResponse(errorCode);
58 * Creates a RcsGetResponse with custom attributes and
59 * {@link #DEFAULT_ERROR_CODE} for the errorCode. This sends the passed
60 * attributes as the result attributes instead of the one the
61 * {@link RcsResourceObject} holds.
64 * attributes to be sent as the result
67 public static RcsGetResponse create(RcsResourceAttributes attributes) {
68 return new RcsGetResponse(attributes);
72 * Creates a RcsGetResponse with error code passed. This sends
73 * the passed attributes as the result attributes instead of one the
74 * {@link RcsResourceObject} holds.
77 * attributes to be sent as the result
79 * error code for response
82 public static RcsGetResponse create(RcsResourceAttributes attributes,
84 return new RcsGetResponse(attributes, errorCode);
87 private RcsGetResponse() {
91 private RcsGetResponse(int errorCode) {
95 private RcsGetResponse(RcsResourceAttributes attrs) {
99 private RcsGetResponse(RcsResourceAttributes attrs, int errorCode) {
100 super(attrs, errorCode);