public void onLongRunningRequest (@Nonnull @Nonempty final String sUniqueRequestID, @Nonnull final IRequestWebScope aRequestScope, @Nonnegative final long nRunningMilliseconds) { AuditHelper.onAuditExecuteSuccess ("long-running-request", sUniqueRequestID, Long.valueOf (nRunningMilliseconds), aRequestScope.getURL ()); }
private static void _trackAfterHandleRequest (@Nonnull final IRequestWebScope aRequestScope) { final String sID = aRequestScope.attrs ().getAsString (REQUEST_ATTR_ID); RequestTracker.removeRequest (sID); }
/** * This is a utility method to always retrieve the correct scope. * * @return The current request scope to use. */ @Nonnull protected static final IRequestParamContainer getParams () { return WebScopeManager.getRequestScope ().params (); }
@Nonnull public EContinue onException (@Nonnull final IRequestWebScope aRequestScope, @Nonnull final Throwable t) { final String sMsg = "Internal error on " + aRequestScope.getHttpVersion ().getName () + " " + aRequestScope.getMethod () + " on resource '" + aRequestScope.getURL () + "'"; if (StreamHelper.isKnownEOFException (t)) { // Debug only if (LOGGER.isDebugEnabled ()) LOGGER.debug (sMsg + " - " + ClassHelper.getClassLocalName (t) + " - " + t.getMessage ()); // Known - nothing more to do return EContinue.BREAK; } // Log always including full exception LOGGER.error (sMsg, t); // Invoke next handler return EContinue.CONTINUE; } }
/** * @return The {@link OutputStream} to write to the HTTP servlet response * @throws IOException * In case of an error */ @Nonnull default OutputStream getOutputStream () throws IOException { return getResponse ().getOutputStream (); } }
public void afterRequest (@Nonnull final IRequestWebScope aRequestScope) { // Timer per HTTP method m_aTimer.addTime (aRequestScope.getHttpMethod ().getName (), m_aSW.stopAndGetMillis ()); } }
final HttpSession aHttpSession = aRequestScope.getSession (bCreateIfNotExisting); if (aHttpSession != null) return internalGetOrCreateSessionScope (aHttpSession, bCreateIfNotExisting, bItsOkayToCreateANewSession);
LOGGER.debug ("Successfully handled request: " + aRequestScope.getPathWithinServlet ());
public void onLongRunningRequest (@Nonnull @Nonempty final String sUniqueRequestID, @Nonnull final IRequestWebScope aRequestScope, @Nonnegative final long nRunningMilliseconds) { LogHelper.log (LOGGER, m_aErrorLevel, () -> "Long running request. ID=" + sUniqueRequestID + "; millisecs=" + nRunningMilliseconds + "; URL=" + aRequestScope.getURL ()); }
private static boolean _trackBeforeHandleRequest (@Nonnull final IRequestWebScope aRequestScope) { // Check if an attribute is already present // An ID may already be present, if the request is internally dispatched // (e.g. via the error handler) String sID = aRequestScope.attrs ().getAsString (REQUEST_ATTR_ID); if (sID != null) { // Mainly debug logging to see, if this can be checked better // Therefore I need to understand better when this happens if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Request already contains an ID (" + sID + ") - so this is an recursive request..."); return false; } // Create a unique ID for the request sID = Long.toString (s_aRequestID.incrementAndGet ()); // Remember in request scope aRequestScope.attrs ().putIn (REQUEST_ATTR_ID, sID); // Remember request RequestTracker.addRequest (sID, aRequestScope); return true; }
public void onParallelRunningRequests (@Nonnegative final int nParallelRequests, @Nonnull @Nonempty final List <TrackedRequest> aRequests) { final StringBuilder aURLs = new StringBuilder (); for (final TrackedRequest aRequest : aRequests) aURLs.append ('\n').append (aRequest.getRequestScope ().getURL ()); onError ((Throwable) null, (IRequestWebScopeWithoutResponse) null, "Currently " + nParallelRequests + " parallel requests are active: " + aURLs.toString (), new StringMap ().add ("parallel-requests", nParallelRequests)); }
public void onRequest (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse, @Nonnull final EHttpVersion eHttpVersion, @Nonnull final EHttpMethod eHttpMethod, @Nonnull final IRequestWebScope aRequestScope) throws ServletException, IOException { if (m_aAsyncSpec.isAsynchronous () && aHttpRequest.isAsyncSupported ()) { // Run asynchronously // remember before invoking handler to avoid request scope destruction aRequestScope.attrs ().putIn (AbstractXServlet.REQUEST_ATTR_HANDLED_ASYNC, true); // Main async handler _handleAsync (aHttpRequest, aHttpResponse, eHttpVersion, eHttpMethod, aRequestScope); } else { // Run synchronously m_aNestedHandler.onRequest (aHttpRequest, aHttpResponse, eHttpVersion, eHttpMethod, aRequestScope); } }
public void onParallelRunningRequests (@Nonnegative final int nParallelRequests, @Nonnull @Nonempty final List <TrackedRequest> aRequests) { final ICommonsList <String> aURLs = new CommonsArrayList <> (); for (final TrackedRequest aRequest : aRequests) aURLs.add (aRequest.getRequestScope ().getURL ()); AuditHelper.onAuditExecuteSuccess ("parallel-running-requests", Integer.valueOf (nParallelRequests), aURLs); }
public void onLongRunningRequest (@Nonnull @Nonempty final String sUniqueRequestID, @Nonnull final IRequestWebScope aRequestScope, @Nonnegative final long nRunningMilliseconds) { if (m_aHandledLongRunning.add (sUniqueRequestID)) { onError ((Throwable) null, aRequestScope, "Long running request.", new StringMap ().add ("request-id", sUniqueRequestID) .add ("millisecconds", nRunningMilliseconds) .add ("URL", aRequestScope.getURL ())); } }
if (!WebScopeManager.getRequestScope ().attrs ().getAndSetFlag ("fineuploader5-globalvars")) aGlobalCnt = aPkg.var ("g_nUploadCnt", 0); else
if (!WebScopeManager.getRequestScope ().attrs ().getAndSetFlag ("fineuploader-globalvars")) aGlobalCnt = aPkg.var ("g_nUploadCnt", 0); else