git-svn-id: https://stereo.googlecode.com/svn/trunk@440 c67ee986-0855-0410-825f-15918...
[stereo.git] / DACPlib / src / api / Response.java
blob2bd2dbb5afa7d78410cf013c570d7f007ddf49df
1 package api;
3 import interfaces.Constants;
5 public class Response implements Node {
7 public static final int OK = 200;
8 public static final int CREATED = 201;
9 public static final int NO_CONTENT = 204;
10 public static final int NOT_FOUND = 404;
12 private final Constants type;
13 private final int status;
15 public Response(Constants type, int status) {
16 this.type = type;
17 this.status = status;
20 public Constants type() {
21 return type;
24 public int status() {
25 return status;
28 public String statusText() {
29 switch (status) {
30 case OK: return "200 OK";
31 case CREATED: return "201 CREATED";
32 case NO_CONTENT: return "204 NO CONTENT";
33 case NOT_FOUND: return "404 NOT FOUND";
34 default: return "";
38 public void write(Writer writer) {
39 writer.appendInteger(Constants.dmap_status, status);