Class OA2ServletUtils


  • public class OA2ServletUtils
    extends Object
    Utilities for various servlets. These handle the exceptions from the script runtime engine and perform a full rollback. These are messy, but unavoidable.

    Created by Jeff Gaynor
    on 4/26/22 at 6:52 AM

    • Field Detail

      • stackTraceMaxLines

        public static int stackTraceMaxLines
    • Constructor Detail

      • OA2ServletUtils

        public OA2ServletUtils()
    • Method Detail

      • handleScriptEngineException

        public static void handleScriptEngineException​(Object callingObject,
                                                       OA2SE oa2SE,
                                                       Throwable t,
                                                       edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger,
                                                       OA2ServiceTransaction transaction,
                                                       edu.uiuc.ncsa.security.storage.XMLMap tBackup)
      • handleScriptEngineException

        public static void handleScriptEngineException​(Object callingObject,
                                                       OA2SE oa2SE,
                                                       Throwable exception,
                                                       edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger,
                                                       OA2ServiceTransaction transaction,
                                                       edu.uiuc.ncsa.security.storage.XMLMap tBackup,
                                                       TXRecord txRecord)
        Parameters:
        callingObject -
        oa2SE -
        exception -
        debugger -
        transaction -
        tBackup -
        txRecord -
      • rollback

        protected static void rollback​(OA2SE oa2SE,
                                       edu.uiuc.ncsa.security.storage.XMLMap backup,
                                       TXRecord txRecord)
      • truncateStackTrace

        public static String truncateStackTrace​(Throwable e,
                                                int n,
                                                boolean printIt)
        Take a stack trace and print the first n lines of it.
        Parameters:
        e -
        n -
        Returns:
        the truncated stack trace
      • truncateStackTrace2

        protected static String truncateStackTrace2​(Throwable e,
                                                    int n,
                                                    boolean printIt)
      • ppξ

        protected static void ppξ​(Throwable throwable,
                                  Object callingObject,
                                  OA2SE oa2SE,
                                  edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger,
                                  String message)
        Pretty print the exception. This decides what to print and shortens the stack trace.
        Parameters:
        throwable -
        callingObject -
        debugger -
        message -
      • processReservedXAs

        public static void processReservedXAs​(net.sf.json.JSONObject xas,
                                              OA2ServiceTransaction t)
        This takes the set of reserved ExtendedParameters and sets state in the transaction. These parameters are reserved for system use and not propagated to the client scripting environment. Moreover, they are available to every client.
        Parameters:
        xas -
        t -
      • processXAs

        public static void processXAs​(javax.servlet.http.HttpServletRequest request,
                                      OA2ServiceTransaction t,
                                      OA2Client client)
        Process the extended attrubutes from the request's parameter map.
        Parameters:
        request -
        t -
        client -