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); }
public HttpStatus getStatus() { return response.getStatus(); }
public PrintWriter getWriter() { return response.getWriter(); }
public void setCharacterEncoding(String encoding) { response.setCharacterEncoding(encoding); }
public OutputStream getOutputStream() { return response.getOutputStream(); }
public int getContentLength() { return response.getContentLength(); }
public String getContentType() { return response.getContentType(); }
public String[] getHeaderNames() { return response.getHeaderNames(); }
public void setContentType(String type) { response.setContentType(type); }
public String[] getHeaders(String name) { return response.getHeaders(name); }
public void completed() { response.completed(); }
public void setStatus(HttpStatus status) { response.setStatus(status); }
public Locale getLocale() { return response.getLocale(); }
public void setLocale(Locale locale) { response.setLocale(locale); }
public boolean isCommitted() { return response.isCommitted(); }