KB Article #181417
Jython scripts are unable to access certain whiteboard parameters
Problem
Jython scripts are unable to access certain whiteboard parameters, like http.request.uri
Resolution
The Python Script Engine uses the JavaProxyMap class to get attributes from java maps if the java map contains the attribute key, otherwise None is returned as default value. All HTTPMessage attributes (http.xyz) are generated lazily, and therefore are not present at the time the Jython script is invoked unless they were previously used. To avoid this, a Jython Scripting Filter should force the generation of the message attributes before using them, e.g.
def invoke(msg): msg.forceGenerateAttributes() Trace.debug("Attributes are now available: [" + str(msg.get("http.request.verb")) + "] [" + str(msg.get("http.request.uri")) + "]") return True