/** * Action used for turning EOAdaptorDebugging output on or off.<br> * <br> * Synopsis:<br> * pw=<i>aPassword</i> <br> * Form Values:<br> * <strong>pw</strong> password to be checked against the system property <code> * er.extensions.ERXEOAdaptorDebuggingPassword</code>.<br> * <strong>debug</strong> flag signaling whether to turn EOAdaptorDebugging on or off (defaults to * off). The value should be one of: * * <ul> * <li>on * <li>true * <li>1 * <li>y * <li>yes * <li>off * <li>false * <li>0 * <li>n * <li>no * <ul> * <br> * Note: this action must be invoked against a specific instance (the instance number must * be in the request URL). * * @return a page showing what action was taken (with regard to EOAdaptorDebugging), if any. */ public WOActionResults eoAdaptorDebuggingAction() { if (canPerformActionWithPasswordKey("er.extensions.ERXEOAdaptorDebuggingPassword")) { ERXStringHolder result = pageWithName(ERXStringHolder.class); result.setEscapeHTML(false); String message; boolean currentState = ERXExtensions.adaptorLogging(); int instance = request().applicationNumber(); if (instance == -1) { log.info("EOAdaptorDebuggingAction requested without a specific instance."); message = "<p>You must invoke this action on a <em>specific</em> instance.</p>" + "<p>Your url should look like: <code>.../WebObjects/1/wa/...</code>, where '1' would be the first instance of the target application.</p>"; } else { String debugParam = request().stringFormValueForKey("debug"); log.debug("EOAdaptorDebuggingAction requested with 'debug' param:" + debugParam); if (debugParam == null || debugParam.trim().length() == 0) { message = "<p>EOAdaptorDebugging is currently <strong>" + (currentState ? "ON" : "OFF") + "</strong> for instance <strong>" + instance + "</strong>.</p>"; message += "<p>To change the setting, provide the 'debug' parameter to this action, e.g.: <code>...eoAdaptorDebugging?debug=on&pw=secret</code></p>"; } else { if (debugParam.trim().equalsIgnoreCase("on")) { debugParam = "true"; } else if (debugParam.trim().equalsIgnoreCase("off")) { debugParam = "false"; } boolean desiredState = ERXValueUtilities.booleanValueWithDefault(debugParam, false); log.debug( "EOAdaptorDebuggingAction requested 'debug' state change to: '" + desiredState + "' for instance: " + instance + "."); if (currentState != desiredState) { ERXExtensions.setAdaptorLogging(desiredState); message = "<p>Turned EOAdaptorDebugging <strong>" + (desiredState ? "ON" : "OFF") + "</strong> for instance <strong>" + instance + "</strong>.</p>"; } else { message = "<p>EOAdaptorDebugging setting <strong>not changed</strong>.</p>"; } } } message += "<p><em>Please be mindful of using EOAdaptorDebugging as it may have a large impact on application performance.</em></p>"; result.setValue(message); return result; } return forbiddenResponse(); }
/** * Returns a list of the traces of open editing context locks. This is only useful if * er.extensions.ERXApplication.traceOpenEditingContextLocks is enabled and * er.extensions.ERXOpenEditingContextLocksPassword is set. * * @return list of lock traces */ public WOActionResults showOpenEditingContextLockTracesAction() { if (canPerformActionWithPasswordKey("er.extensions.ERXOpenEditingContextLockTracesPassword")) { ERXStringHolder result = pageWithName(ERXStringHolder.class); result.setEscapeHTML(false); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("<pre>"); pw.println(ERXEC.outstandingLockDescription()); pw.println("</pre>"); pw.println("<hr>"); pw.println("<pre>"); pw.println(ERXObjectStoreCoordinator.outstandingLockDescription()); pw.println("</pre>"); pw.close(); result.setValue(sw.toString()); return result; } return forbiddenResponse(); }