Custom Jython Responder Correlation

jdubreuiljdubreuil Posts: 1

In V9.1x, has anyone been able to get a custom correlation to work that uses regex? Example below

from java.util.regex import *
from java.lang import * 
from com.parasoft.api import *

def correlateOperation(context):
    requestHeadersStr = context.get(CorrelationScriptingHookConstants.HEADERS)      # Map<String, String>
    requestBodyBytes = context.get(CorrelationScriptingHookConstants.MESSAGE_BIN)   # byte[]
    requestBodyDoc = context.get(CorrelationScriptingHookConstants.MESSAGE_DOM)     # Document
    requestBodyStr = context.get(CorrelationScriptingHookConstants.MESSAGE_STR)     # String
    requestMethod = context.get(CorrelationScriptingHookConstants.REQUEST_METHOD)   # String
    requestUrl = context.get(CorrelationScriptingHookConstants.REQUEST_URI)         # String
    requestUrlParamsMap = context.get(CorrelationScriptingHookConstants.URL_PARAMS) # Map<String, String[]>
    attachments = context.get(CorrelationScriptingHookConstants.ATTACHMENTS)        # List<com.parasoft.api.ICorrelationAttachment>


    p = Pattern.compile("a*b");
    m = p.matcher(String("aaaab"));  
    return m.find() 
Sign In or Register to comment.