Something along the following lines if you can configure in a filter.
But to a previous posters point. How do you get a filter configured when @WebService is a
Session Bean, nice <web-app> example in user guide is for POJO. I guess use HTTP
request/response context properties in SOAPHandler? Haven't looked to see if they are
popuated yet.
But anyway kind of problemattic with a lot of servlet filter resources already written for
authentication, etc.
public class AdobeStatusFilter implements Filter {
| Logger log = Logger.getLogger(AdobeStatusFilter.class);
| private FilterConfig filterConfig = null;
|
| public void init(FilterConfig filterConfig) throws ServletException {
| this.filterConfig = filterConfig;
| }
|
| public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
throws IOException, ServletException {
| AdobeResponseWrapper wrapper = new AdobeResponseWrapper((HttpServletResponse)
resp);
| HttpServletResponse response = (HttpServletResponse)resp;
| chain.doFilter(req, wrapper);
| }
|
| public void destroy() {
| this.filterConfig = null;
| }
|
| }
public class AdobeResponseWrapper extends HttpServletResponseWrapper {
|
| private int statusCode;
| public AdobeResponseWrapper(HttpServletResponse response) {
| super(response);
| }
| public int getStatus() {
| return statusCode;
| }
| public void sendError(int errorCode) throws IOException {
| this.statusCode = adjust(errorCode);
| super.sendError(this.statusCode);
| }
| public void sendError(int errorCode, String errorMessage) throws IOException {
| this.statusCode = adjust(errorCode);
| super.sendError(this.statusCode, errorMessage);
| }
| public void setStatus(int statusCode) {
| this.statusCode = adjust(statusCode);
| super.setStatus(this.statusCode);
| }
| public void setStatus(int statusCode, String message) {
| this.statusCode = adjust(statusCode);
| super.setStatus(this.statusCode, message);
| }
|
| private int adjust(int errorCode) {
| return errorCode == HttpServletResponse.SC_INTERNAL_SERVER_ERROR ?
| HttpServletResponse.SC_OK : errorCode;
| }
|
|
| }
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057524#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...