/** * Gets the request logger for this application. * * @return The request logger or null if no request is active, or if this is not a web * application */ protected org.apache.wicket.protocol.http.IRequestLogger getRequestLogger() { if (application instanceof WebApplication) { return application.getRequestLogger(); } return null; } }
/** * Determine whether a IRequestLogger is provided, and whether request logging has been enabled. * * @return true when request logging is enabled. */ private boolean isRequestLoggingEnabled() { IRequestLogger requestLogger = Application.get().getRequestLogger(); RequestLoggerSettings settings = Application.get().getRequestLoggerSettings(); return requestLogger != null && settings.isRequestLoggerEnabled(); }
/** * Registers the handler with the request logger. The first handler is used as the incoming * request handler, and the last registered handler as the outgoing response handler. * * @param handler */ private void registerHandler(IRequestHandler handler) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (first.get() == null) { first.set(handler); requestLogger.logEventTarget(handler); } requestLogger.logResponseTarget(handler); } }
/** * Determine whether a IRequestLogger is provided, and whether request logging has been enabled. * * @return true when request logging is enabled. */ private boolean isRequestLoggingEnabled() { IRequestLogger requestLogger = Application.get().getRequestLogger(); RequestLoggerSettings settings = Application.get().getRequestLoggerSettings(); return requestLogger != null && settings.isRequestLoggerEnabled(); }
/** * Registers the handler with the request logger. The first handler is used as the incoming * request handler, and the last registered handler as the outgoing response handler. * * @param handler */ private void registerHandler(IRequestHandler handler) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (first.get() == null) { first.set(handler); requestLogger.logEventTarget(handler); } requestLogger.logResponseTarget(handler); } }
@Override public final void removeAttribute(final Request request, final String name) { HttpSession httpSession = getHttpSession(request, false); if (httpSession != null) { String attributeName = getSessionAttributePrefix(request) + name; IRequestLogger logger = Application.get().getRequestLogger(); if (logger != null) { Object value = httpSession.getAttribute(attributeName); if (value != null) { logger.objectRemoved(value); } } httpSession.removeAttribute(attributeName); } }
@Override public final void removeAttribute(final Request request, final String name) { HttpSession httpSession = getHttpSession(request, false); if (httpSession != null) { String attributeName = getSessionAttributePrefix(request) + name; IRequestLogger logger = Application.get().getRequestLogger(); if (logger != null) { Object value = httpSession.getAttribute(attributeName); if (value != null) { logger.objectRemoved(value); } } httpSession.removeAttribute(attributeName); } }
@Override public String getSessionId(final Request request, final boolean create) { String id = null; HttpSession httpSession = getHttpSession(request, false); if (httpSession != null) { id = httpSession.getId(); } else if (create) { httpSession = getHttpSession(request, true); id = httpSession.getId(); IRequestLogger logger = Application.get().getRequestLogger(); if (logger != null) { logger.sessionCreated(id); } } return id; }
@Override public String getSessionId(final Request request, final boolean create) { String id = null; HttpSession httpSession = getHttpSession(request, false); if (httpSession != null) { id = httpSession.getId(); } else if (create) { httpSession = getHttpSession(request, true); id = httpSession.getId(); IRequestLogger logger = Application.get().getRequestLogger(); if (logger != null) { logger.sessionCreated(id); } } return id; }
@Override public final void setAttribute(final Request request, final String name, final Serializable value) { // ignore call if the session was marked invalid HttpSession httpSession = getHttpSession(request, false); if (httpSession != null) { String attributeName = getSessionAttributePrefix(request) + name; IRequestLogger logger = Application.get().getRequestLogger(); if (logger != null) { if (httpSession.getAttribute(attributeName) == null) { logger.objectCreated(value); } else { logger.objectUpdated(value); } } httpSession.setAttribute(attributeName, value); } }
@Override public final void setAttribute(final Request request, final String name, final Serializable value) { // ignore call if the session was marked invalid HttpSession httpSession = getHttpSession(request, false); if (httpSession != null) { String attributeName = getSessionAttributePrefix(request) + name; IRequestLogger logger = Application.get().getRequestLogger(); if (logger != null) { if (httpSession.getAttribute(attributeName) == null) { logger.objectCreated(value); } else { logger.objectUpdated(value); } } httpSession.setAttribute(attributeName, value); } }
/** * Registers the requested URL with the request logger, if one can be determined. * * @param cycle */ private void registerRequestedUrl(RequestCycle cycle) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (cycle.getRequest().getContainerRequest() instanceof HttpServletRequest) { HttpServletRequest containerRequest = (HttpServletRequest)cycle.getRequest() .getContainerRequest(); AppendingStringBuffer url = new AppendingStringBuffer(containerRequest.getRequestURL()); if (containerRequest.getQueryString() != null) url.append("?").append(containerRequest.getQueryString()); requestLogger.logRequestedUrl(url.toString()); } }
/** * Registers the requested URL with the request logger, if one can be determined. * * @param cycle */ private void registerRequestedUrl(RequestCycle cycle) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (cycle.getRequest().getContainerRequest() instanceof HttpServletRequest) { HttpServletRequest containerRequest = (HttpServletRequest)cycle.getRequest() .getContainerRequest(); AppendingStringBuffer url = new AppendingStringBuffer(containerRequest.getRequestURL()); if (containerRequest.getQueryString() != null) url.append("?").append(containerRequest.getQueryString()); requestLogger.logRequestedUrl(url.toString()); } }
private void onInternalDetach() { if (Session.exists()) { Session.get().internalDetach(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) requestLogger.performLogging(); } }
private void onInternalDetach() { if (Session.exists()) { Session.get().internalDetach(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) requestLogger.performLogging(); } }
@Override public void onDetach(final RequestCycle requestCycle) { if (Session.exists()) { Session.get().getPageManager().commitRequest(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) { requestLogger.requestTime((System.currentTimeMillis() - requestCycle.getStartTime())); } } } });
@Override public void onDetach(final RequestCycle requestCycle) { if (Session.exists()) { Session.get().getPageManager().commitRequest(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) { requestLogger.requestTime((System.currentTimeMillis() - requestCycle.getStartTime())); } } } });
IRequestLogger requestLogger = getApplication().getRequestLogger(); if (requestLogger != null)
IRequestLogger requestLogger = getApplication().getRequestLogger(); if (requestLogger != null)