1 package org.apache.beehive.controls.runtime.servlet; 2 19 20 import javax.servlet.http.HttpServletResponse ; 21 import javax.servlet.http.HttpServletResponseWrapper ; 22 import javax.servlet.ServletResponse ; 23 24 31 class HttpResponseService extends ServletResponseService 32 implements HttpServletResponse 33 { 34 39 private static class Wrapper extends HttpServletResponseWrapper 40 { 41 Wrapper(HttpResponseService responseService) 42 { 43 super(responseService); 44 _responseService = responseService; 45 } 46 47 53 public HttpServletResponse getResponse() 54 { 55 return _responseService.getHttpServletResponse(); 56 } 57 58 HttpResponseService _responseService; 59 } 60 61 62 HttpResponseService(ServletBeanContext beanContext) 63 { 64 super(beanContext); 65 } 66 67 final protected HttpServletResponse getHttpServletResponse() 68 { 69 ServletResponse servletRequest = getServletBeanContext().getServletResponse(); 70 if (! (servletRequest instanceof HttpServletResponse )) 71 throw new IllegalStateException ("Current request is not an HttpServletResponse"); 72 return (HttpServletResponse )servletRequest; 73 } 74 75 80 HttpServletResponse getHttpResponseWrapper() 81 { 82 return new Wrapper (this); 83 } 84 85 public void addCookie(javax.servlet.http.Cookie cookie) 86 { 87 getHttpServletResponse().addCookie(cookie); 88 } 89 90 public boolean containsHeader(java.lang.String name) 91 { 92 return getHttpServletResponse().containsHeader(name); 93 } 94 95 public java.lang.String encodeURL(java.lang.String url) 96 { 97 return getHttpServletResponse().encodeURL(url); 98 } 99 100 public java.lang.String encodeRedirectURL(java.lang.String url) 101 { 102 return getHttpServletResponse().encodeRedirectURL(url); 103 } 104 105 public java.lang.String encodeUrl(java.lang.String url) 106 { 107 return getHttpServletResponse().encodeUrl(url); 108 } 109 110 public java.lang.String encodeRedirectUrl(java.lang.String url) 111 { 112 return getHttpServletResponse().encodeRedirectUrl(url); 113 } 114 115 public void sendError(int sc, java.lang.String msg) throws java.io.IOException 116 { 117 getHttpServletResponse().sendError(sc, msg); 118 } 119 120 public void sendError(int sc) throws java.io.IOException 121 { 122 getHttpServletResponse().sendError(sc); 123 } 124 125 public void sendRedirect(java.lang.String location) throws java.io.IOException 126 { 127 getHttpServletResponse().sendRedirect(location); 128 } 129 130 public void setDateHeader(java.lang.String name, long date) 131 { 132 getHttpServletResponse().setDateHeader(name, date); 133 } 134 135 public void addDateHeader(java.lang.String name, long date) 136 { 137 getHttpServletResponse().addDateHeader(name, date); 138 } 139 140 public void setHeader(java.lang.String name, java.lang.String value) 141 { 142 getHttpServletResponse().setHeader(name, value); 143 } 144 145 public void addHeader(java.lang.String name, java.lang.String value) 146 { 147 getHttpServletResponse().addHeader(name, value); 148 } 149 150 public void setIntHeader(java.lang.String name, int value) 151 { 152 getHttpServletResponse().setIntHeader(name, value); 153 } 154 155 public void addIntHeader(java.lang.String name, int value) 156 { 157 getHttpServletResponse().addIntHeader(name, value); 158 } 159 160 public void setStatus(int sc) 161 { 162 getHttpServletResponse().setStatus(sc); 163 } 164 165 public void setStatus(int sc, java.lang.String sm) 166 { 167 getHttpServletResponse().setStatus(sc, sm); 168 } 169 } 170 | Popular Tags |