@SuppressWarnings("unchecked")
public void beforePhase(PhaseEvent phaseEvent) {
if (LOG.isInfoEnabled()) {
Date start = null;
Map map = null;
PhaseId phaseId = phaseEvent.getPhaseId();
if (LOG.isDebugEnabled() || phaseId.getOrdinal() == 1) {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
if (LOG.isTraceEnabled() && PhaseId.RESTORE_VIEW == phaseId) {
// this is before restoreView
Object request = externalContext.getRequest();
if (request instanceof HttpServletRequest) {
HttpServletRequest servletRequest = (HttpServletRequest) request;
LOG.trace("RequestURI = " + servletRequest.getRequestURI());
}
Map headerMap = externalContext.getRequestHeaderMap();
for (Object key : headerMap.keySet()) {
LOG.trace("Header : \"" + key + "\" = \"" + headerMap.get(key) + "\"");
}
Map parameterMap = externalContext.getRequestParameterMap();
for (Object key : parameterMap.keySet()) {
LOG.trace("Param : \"" + key + "\" = \"" + parameterMap.get(key) + "\"");
}
}
start = new Date();
map = externalContext.getRequestMap();
map.put(KEY + phaseId.getOrdinal() + "S", start);
}
if (LOG.isDebugEnabled()) {
Date end = null;
int ordinal = phaseId.getOrdinal();
while (end == null && ordinal > 0) {
end = (Date) map.get(KEY + --ordinal + "E");
}
if (end != null) {
LOG.debug("Time between phases " + ordinal + " and " + phaseId.getOrdinal() + ": "
+ (start.getTime() - end.getTime()) + " milliseconds");
}
}
if (LOG.isTraceEnabled()) {
LOG.trace("Before Phase :" + phaseId