If you think the Android project getrest listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2012 Alexey Hanin//www.java2s.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package getrest.android.core;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
/**
* @author aha
* @since 2012-01-13
*/publicclass Response implements Parcelable, HasHeaders {
private Uri uri;
private Pack entity;
private Headers headers = new Headers();
private Status status;
public Uri getUri() {
return uri;
}
publicvoid setUri(final Uri uri) {
this.uri = uri;
}
public Pack getEntity() {
return entity;
}
publicvoid setEntity(final Pack entity) {
this.entity = entity;
}
publicint describeContents() {
return 0;
}
publicvoid writeToParcel(final Parcel parcel, finalint flags) {
parcel.writeParcelable(uri, 0);
parcel.writeParcelable(entity, 0);
HeadersHelper.writeToParcel(parcel, headers);
parcel.writeInt(status.getResponseCode());
}
publicstaticfinal Creator<Response> CREATOR = new Creator<Response>() {
public Response createFromParcel(final Parcel parcel) {
final Response response = new Response();
response.uri = parcel.readParcelable(Uri.class.getClassLoader());
response.entity = parcel.readParcelable(Pack.class.getClassLoader());
HeadersHelper.readFromParcel(parcel, response.headers);
response.status = Status.forResponseCode(parcel.readInt());
return response;
}
public Response[] newArray(finalint size) {
returnnew Response[size];
}
};
publicvoid setStatus(final Status status) {
this.status = status;
}
public Status getStatus() {
return status;
}
public Headers getHeaders() {
return headers;
}
publicvoid addHeader(final Header header) {
headers.add(header);
}
}