Java Code Examples for javax.servlet.ServletException#getCause()
The following examples show how to use
javax.servlet.ServletException#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Proclet.java From HongsCORE with MIT License | 6 votes |
@Override public void service(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException { try { this._jspService(new Request(req), rsp); } catch (ServletException ex ) { ActionHelper ah = ActionDriver.getActualCore(req).get(ActionHelper.class); Throwable ax = ex.getCause( ); if (ax == null) { ax = ex ; } if (ax instanceof HongsCause) { ah.fault((HongsCause) ax); } else { ah.fault(new HongsException(500, ax)); } } }
Example 2
Source File: RepeatableReadAuthorizationFilter.java From qconfig with MIT License | 5 votes |
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { super.doFilter(request, response, chain); } catch (ServletException e) { if (e.getCause() instanceof MaxUploadSizeExceededException) { response.setContentType("application/json"); response.setCharacterEncoding("utf8"); response.getWriter().println("{\"message\":\"文件不能超过" + AdminConstants.MAX_FILE_SIZE_IN_K + "k\",\"data\":null,\"status\":1}"); } else { throw e; } } }
Example 3
Source File: Pagelet.java From HongsCORE with MIT License | 5 votes |
@Override public void /**/service(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException { try { this._jspService(req, rsp); } catch (ServletException ex ) { Throwable ax = ex.getCause( ); if (ax == null) { ax = ex ; } String er = ax.getLocalizedMessage(); int eo = ax instanceof HongsCause ? ( (HongsCause) ax).getState() : 0; if (eo <= 400 || eo > 600) { eo = HttpServletResponse.SC_INTERNAL_SERVER_ERROR ; } req.setAttribute("javax.servlet.error.status_code", eo); req.setAttribute("javax.servlet.error.message" , er); req.setAttribute("javax.servlet.error.exception" , ax); req.setAttribute("javax.servlet.error.exception_type", ax.getClass().getName()); rsp.sendError(eo, er); } }
Example 4
Source File: XmlRpcServlet.java From uyuni with GNU General Public License v2.0 | 4 votes |
/** * executed when a post request happens * * @param request the request object * @param response the response object * @throws ServletException if a read error occurs * @throws IOException if a read error occurs */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (log.isDebugEnabled()) { log.debug("Entered doPost"); } if (request.getHeader("SOAPAction") != null) { passControl(request, response); return; } response.setContentType("text/xml"); try { if (log.isDebugEnabled()) { log.debug("Passing control to XmlRpcServer.execute"); } server.execute(request.getInputStream(), response.getWriter(), request.getRemoteAddr(), request.getLocalName(), request.getProtocol()); /* * jesusr - 2007.09.14 * this is still the case * * mbowman - 2005.10.06 * Like we were raised in a barn, we are going to leave here without * flushing ;) * -- The current thinking is that Tocmat handles the outputStream * -- flushing and closing for us. This make sense since after this * -- method runs, the response still needs to go back up through * -- the filters and out. If things start breaking in the future, * -- this is a good place to start looking. */ } // As bad as this is, we have no choice, Marquee-xmlrpc throws // Throwable, so we have to catch it. catch (Throwable t) { // By the time we get here, it can't be a FaultException, so just // wrap it in a ServletException and toss. ServletException e = new ServletException("Throwable from XmlRpc", t); t.printStackTrace(); if (e.getCause() != t) { e.initCause(t); } throw e; } }
Example 5
Source File: XmlRpcServlet.java From spacewalk with GNU General Public License v2.0 | 4 votes |
/** * executed when a post request happens * * @param request the request object * @param response the response object * @throws ServletException if a read error occurs * @throws IOException if a read error occurs */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (log.isDebugEnabled()) { log.debug("Entered doPost"); } if (request.getHeader("SOAPAction") != null) { passControl(request, response); return; } response.setContentType("text/xml"); try { if (log.isDebugEnabled()) { log.debug("Passing control to XmlRpcServer.execute"); } server.execute(request.getInputStream(), response.getWriter(), request.getRemoteAddr(), request.getLocalName(), request.getProtocol()); /* * jesusr - 2007.09.14 * this is still the case * * mbowman - 2005.10.06 * Like we were raised in a barn, we are going to leave here without * flushing ;) * -- The current thinking is that Tocmat handles the outputStream * -- flushing and closing for us. This make sense since after this * -- method runs, the response still needs to go back up through * -- the filters and out. If things start breaking in the future, * -- this is a good place to start looking. */ } // As bad as this is, we have no choice, Marquee-xmlrpc throws // Throwable, so we have to catch it. catch (Throwable t) { // By the time we get here, it can't be a FaultException, so just // wrap it in a ServletException and toss. ServletException e = new ServletException("Throwable from XmlRpc", t); t.printStackTrace(); if (e.getCause() != t) { e.initCause(t); } throw e; } }