Class OA2ServletUtils
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.servlet.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 Summary
Fields Modifier and Type Field Description static intstackTraceMaxLinesstatic StringTEMPLATES_KEY
-
Constructor Summary
Constructors Constructor Description OA2ServletUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidhandleScriptEngineException(Object callingObject, OA2SE oa2SE, Throwable t, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger, OA2ServiceTransaction transaction, edu.uiuc.ncsa.security.storage.XMLMap tBackup)static voidhandleScriptEngineException(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)protected static voidppξ(Throwable throwable, Object callingObject, OA2SE oa2SE, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger, String message)Pretty print the exception.static voidprocessReservedXAs(net.sf.json.JSONObject xas, OA2ServiceTransaction t)This takes the set of reservedExtendedParametersand sets state in the transaction.static voidprocessXAs(Map<String,String[]> params, OA2ServiceTransaction t, OA2Client client)static voidprocessXAs(javax.servlet.http.HttpServletRequest request, OA2ServiceTransaction t, OA2Client client)Process the extended attrubutes from the request's parameter map.protected static voidrollback(OA2SE oa2SE, edu.uiuc.ncsa.security.storage.XMLMap backup, TXRecord txRecord)static StringtruncateStackTrace(Throwable e, int n, boolean printIt)Take a stack trace and print the first n lines of it.protected static StringtruncateStackTrace2(Throwable e, int n, boolean printIt)
-
-
-
Field Detail
-
stackTraceMaxLines
public static int stackTraceMaxLines
-
TEMPLATES_KEY
public static final String TEMPLATES_KEY
- See Also:
- Constant Field Values
-
-
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 reservedExtendedParametersand 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(Map<String,String[]> params, OA2ServiceTransaction t, OA2Client client)
-
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-
-
-