public void setData(Object data) {
   if (data == null) {
     response.setStatus(HttpStatus.NO_CONTENT);
   } else if (data instanceof String) {
     String content = (String) data;
     response.setContentType("text/plain");
     response.setCharacterEncoding("utf-8");
     response.setContentLength(content.getBytes().length);
   } else {
     try {
       service.serialize(data, this.request, this.response);
     } catch (HttpException e) {
       setStatus(e.getStatus(), e.getMessage());
     } catch (IOException e) {
       setStatus(HttpStatus.INTERNAL_SERVER_ERROR, "Serialization failed");
     }
   }
 }
    public void run() {
      try {
        Thread.sleep(2000);
      } catch (InterruptedException e) {
      }

      TestBean2 out = new TestBean2();
      out.setFirst(bean1.getFirst());
      out.setSecond(bean1.getSecond());
      out.setThird(bean1.getThird());
      out.setFourth(bean1.getFourth());
      out.setFifth(bean1.getFifth());
      out.setSixth(bean1.getSixth());
      out.setSeventh(bean1.getSeventh());
      out.setEight(bean1.getEight());
      out.setNinth(bean1.getNinth());

      response.setData(out);
      response.completed();
    }
 public void addHeader(String name, String value) {
   response.addHeader(name, value);
 }
 public String getHeader(String name) {
   return response.getHeader(name);
 }
 public void addCookie(HttpCookie cookie) {
   response.addCookie(cookie);
 }
 public HttpCookie[] getCookies() {
   return response.getCookies();
 }
 public void setStatus(HttpStatus status, String message) {
   response.setStatus(status, message);
 }
 public String getCharacterEncoding() {
   return response.getCharacterEncoding();
 }
 public void setContentLength(int len) {
   response.setContentLength(len);
 }
Beispiel #10
0
 public HttpStatus getStatus() {
   return response.getStatus();
 }
Beispiel #11
0
 public PrintWriter getWriter() {
   return response.getWriter();
 }
Beispiel #12
0
 public void setCharacterEncoding(String encoding) {
   response.setCharacterEncoding(encoding);
 }
Beispiel #13
0
 public OutputStream getOutputStream() {
   return response.getOutputStream();
 }
Beispiel #14
0
 public int getContentLength() {
   return response.getContentLength();
 }
Beispiel #15
0
 public String getContentType() {
   return response.getContentType();
 }
Beispiel #16
0
 public String[] getHeaderNames() {
   return response.getHeaderNames();
 }
Beispiel #17
0
 public void setContentType(String type) {
   response.setContentType(type);
 }
Beispiel #18
0
 public String[] getHeaders(String name) {
   return response.getHeaders(name);
 }
Beispiel #19
0
 public void completed() {
   response.completed();
 }
Beispiel #20
0
 public void setStatus(HttpStatus status) {
   response.setStatus(status);
 }
Beispiel #21
0
 public Locale getLocale() {
   return response.getLocale();
 }
Beispiel #22
0
 public void setLocale(Locale locale) {
   response.setLocale(locale);
 }
Beispiel #23
0
 public boolean isCommitted() {
   return response.isCommitted();
 }