2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
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.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.common.rest.api;
23 public class RestResponse {
25 private String response;
27 private String statusDescription;
29 private int httpStatusCode = 0;
31 public RestResponse(String response, String statusDescription, int httpStatusCode) {
33 this.response = response;
34 this.statusDescription = statusDescription;
35 this.httpStatusCode = httpStatusCode;
39 * @return the response
41 public String getResponse() {
49 public void setResponse(String response) {
50 this.response = response;
54 * @return the httpStatusCode
56 public int getHttpStatusCode() {
57 return httpStatusCode;
61 * @param httpStatusCode
62 * the httpStatusCode to set
64 public void setHttpStatusCode(int httpStatusCode) {
65 this.httpStatusCode = httpStatusCode;
69 * @return the statusDescription
71 public String getStatusDescription() {
72 return statusDescription;
76 * @param statusDescription
77 * the statusDescription to set
79 public void setStatusDescription(String statusDescription) {
80 this.statusDescription = statusDescription;
86 * @see java.lang.Object#toString()
88 * ERROR: Error from Rest Server:Status: 400 Message: Bad Request Body:
89 * Invalid cell: Cell with cell name dmgrCell22 does not exist!
92 public String toString() {
94 StringBuilder stringBuilder = new StringBuilder();
96 stringBuilder.append("Status: ");
97 stringBuilder.append(httpStatusCode);
98 stringBuilder.append("\n");
99 stringBuilder.append("Message: ");
100 stringBuilder.append(statusDescription);
101 stringBuilder.append("\n");
102 stringBuilder.append("Body: ");
103 stringBuilder.append(response);
105 return stringBuilder.toString();