
/**
 * 
 */
package org.tio.sitexxx.view.http;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.http.common.HttpRequest;
import org.tio.http.common.HttpResponse;
import org.tio.http.common.RequestLine;
import org.tio.http.server.intf.ThrowableHandler;
import org.tio.http.server.util.Resps;
import org.tio.sitexxx.service.vo.RequestExt;
import org.tio.sitexxx.server.utils.WebUtils;

/**
 * @author tanyaowu
 *
 */
public class TioSiteViewThrowableHandler implements ThrowableHandler {
	private static Logger log = LoggerFactory.getLogger(TioSiteViewThrowableHandler.class);

	public static final TioSiteViewThrowableHandler ME = new TioSiteViewThrowableHandler();

	@Override
	public HttpResponse handler(HttpRequest request, RequestLine requestLine, Throwable throwable) throws Exception {
		log.error(request.toString(), throwable);
		RequestExt requestExt = WebUtils.getRequestExt(request);
		requestExt.setCanCache(false);
		return Resps.resp500(request, throwable);
	}
}
