use of org.kohsuke.stapler.Stapler in project hudson-2.x by hudson.
the class AccessDeniedHandlerImpl method handle.
public void handle(ServletRequest request, ServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse rsp = (HttpServletResponse) response;
rsp.setStatus(HttpServletResponse.SC_FORBIDDEN);
req.setAttribute("exception", accessDeniedException);
Stapler stapler = new Stapler();
stapler.init(new ServletConfig() {
public String getServletName() {
return "Stapler";
}
public ServletContext getServletContext() {
return Hudson.getInstance().servletContext;
}
public String getInitParameter(String name) {
return null;
}
public Enumeration getInitParameterNames() {
return new Vector().elements();
}
});
stapler.invoke(req, rsp, Hudson.getInstance(), "/accessDenied");
}
Aggregations