Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.makeandbuild.rest;
 
 
 import  javax.ws.rs.core.Response;
 
public class AccessDeniedHandlerImpl implements AccessDeniedHandler{
        static Log log = LogFactory.getLog(AccessDeniedHandlerImpl.class);
        @Override
        public void handle(HttpServletRequest requestHttpServletResponse responseAccessDeniedException accessDeniedException)
                throws IOExceptionServletException {
            response.setStatus(Response.Status.FORBIDDEN.getStatusCode());
            JSONObject result = new JSONObject();
            try {
                result.put("message""not authorized");
                response.getWriter().print(result.toString());
            } catch (JSONException e) {
                .error("problem rendering error",e);
            }            
        }
New to GrepCode? Check out our FAQ X