<%@page import="org.apache.commons.lang3.StringUtils"%>
<%@page import="com.eactive.eai.common.util.MessageUtil"%>
<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8" isErrorPage="true"%>
<%
Integer statusCode = (Integer) request.getAttribute("_authServerStatusCode");
if (statusCode != null) {
    response.setStatus(statusCode);
}

String code;
if (statusCode != null && statusCode == 401) {
    code = MessageUtil.ERROR_CODE_AUTH_FAIL;
} else if (statusCode != null && statusCode == 404) {
    code = MessageUtil.ERROR_CODE_SERVICE_NOT_FOUND;
} else {
    code = MessageUtil.ERROR_CODE_AP_ERROR;
}

String message = (String)request.getAttribute("errorMessage");


if ( message == null ) {
    message = "Unknown Error, If the problem persists, please contact the administrator..";
}

String jsonErrorMessage = MessageUtil.makeJsonErrorMessage(code, message);
out.println(jsonErrorMessage);
%>
<%--
<html>
  <head>
    <title>Error</title>
  </head>
  <body>
    <p>
      An error has occurred:
    </p>
    <blockquote>
      <label value="{request.errorMessage}" defaultValue=""/>
      <br/>
      <exceptions showMessage="true"/>
    </blockquote>
  </body>
</html>
<% response.setStatus(200); %>
 --%>