List of usage examples for org.springframework.web.util WebUtils ERROR_EXCEPTION_TYPE_ATTRIBUTE
String ERROR_EXCEPTION_TYPE_ATTRIBUTE
To view the source code for org.springframework.web.util WebUtils ERROR_EXCEPTION_TYPE_ATTRIBUTE.
Click Source Link
From source file:org.carewebframework.ui.ExceptionController.java
/** * Populate the display with information from the current execution. * /*w w w .ja va 2 s. c o m*/ * @see org.zkoss.zk.ui.util.GenericAutowireComposer#doAfterCompose(org.zkoss.zk.ui.Component) */ @Override public void doAfterCompose(final Component comp) throws Exception { super.doAfterCompose(comp); Clients.clearBusy(); this.root = ZKUtil.findAncestor(comp, Window.class); final HttpServletRequest req = (HttpServletRequest) this.execution.getNativeRequest(); Class<?> errClass = (Class<?>) req.getAttribute(WebUtils.ERROR_EXCEPTION_TYPE_ATTRIBUTE); String errMsg = (String) req.getAttribute(WebUtils.ERROR_MESSAGE_ATTRIBUTE); Throwable err = (Throwable) req.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE); final String errReqURI = (String) req.getAttribute(WebUtils.ERROR_REQUEST_URI_ATTRIBUTE); final String errServletName = (String) req.getAttribute(WebUtils.ERROR_SERVLET_NAME_ATTRIBUTE); final Integer errStatusCode = (Integer) req.getAttribute(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE); String throwableContext = null; if (err != null) { if (err instanceof IThrowableContext) { throwableContext = ((IThrowableContext) err).getThrowableContext(); } //stack trace info if (err instanceof NestedCheckedException) { err = ((NestedCheckedException) err).getMostSpecificCause(); } else if (err instanceof NestedRuntimeException) { err = ((NestedRuntimeException) err).getMostSpecificCause(); } } if (err != null) { errClass = errClass == null ? err.getClass() : errClass; errMsg = StringUtils.trimToNull(errMsg) == null ? err.getMessage() : errMsg; } final StringBuffer buffer = new StringBuffer(); //generic exception info buffer.append("\nException class: ").append(errClass); buffer.append("\nMessage: ").append(errMsg); if (err instanceof ErrorCoded) { final String errorCode = ((ErrorCoded) err).getErrorCode(); buffer.append("\nErrorCode: ").append(errorCode); this.lblCode.setValue(errorCode); } buffer.append("\nStatusCode: ").append(errStatusCode); buffer.append("\nServletName: ").append(errServletName); buffer.append("\nReqURI: ").append(errReqURI); final SessionInfo sessionInfo = Application.getInstance().getSessionInfo(this.desktop); buffer.append(sessionInfo); buffer.append("\nThrowableContext: " + throwableContext); buffer.append("\nStackTrace: "); appendStackTrace(err); log.error(buffer, err); this.lblExceptionClass.setValue(String.valueOf(errClass)); this.lblMessage.setValue(errMsg); this.lblStatusCode.setValue(String.valueOf(errStatusCode)); if (SecurityUtil.isGrantedAny(Labels.getLabel("cwf.error.dialog.expanded"))) { Events.echoEvent(Events.ON_CLICK, this.btnDetail, null); } }