/* ==================================================================
* Created [2009-4-27 下午11:32:55] by Jon.King
* ==================================================================
* TSS
* ==================================================================
* mailTo:jinpujun@hotmail.com
* Copyright (c) Jon.King, 2009-2012
* ==================================================================
*/
package com.jinhe.tss.core.exception;
import javax.servlet.ServletException;
/**
* <p> BusinessServletException.java </p>
*
*/
public class BusinessServletException extends ServletException implements IBusinessException {
private static final long serialVersionUID = -2924685196019749948L;
private int relogin = 0; // 是否需重新登录系统
private boolean popup = true; // 是否需显示错误信息给用户看
public BusinessServletException(Exception e) {
super(e.getMessage());
initCause(e);
if (e instanceof IBusinessException) {
IBusinessException be = (IBusinessException) e;
relogin = be.getRelogin();
popup = be.isPopup();
}
}
public BusinessServletException(Exception e, boolean relogin) {
super(e.getMessage());
initCause(e);
if (relogin) {
this.relogin = 1;
}
if (e instanceof IBusinessException) {
IBusinessException be = (IBusinessException) e;
popup = be.isPopup();
}
}
/**
* @param string 描述信息
*/
public BusinessServletException(String msg) {
super(msg);
}
/**
* @param msg 描述信息
* @param url 信息提示后返回的路径
*/
public BusinessServletException(String msg, boolean relogin) {
super(msg);
if (relogin) {
this.relogin = 1;
}
}
/**
* @param msg 描述信息
* @param url 信息提示后返回的路径
*/
public BusinessServletException(String msg, int relogin) {
super(msg);
this.relogin = relogin;
}
/**
* @param msg 描述信息
* @param t 异常原因
*/
public BusinessServletException(String msg, Throwable t) {
super(msg);
initCause(t);
if (t instanceof IBusinessException) {
IBusinessException be = (IBusinessException) t;
relogin = be.getRelogin();
}
}
/**
* @param msg 描述信息
* @param t 异常原因
* @param url 信息提示后返回的路径
*/
public BusinessServletException(String msg, Throwable t, boolean relogin) {
super(msg);
initCause(t);
if (relogin) {
this.relogin = 1;
}
if (t instanceof IBusinessException) {
IBusinessException be = (IBusinessException) t;
popup = be.isPopup();
}
}
public boolean isPopup() {
return this.popup;
}
public int getRelogin() {
return this.relogin;
}
}