Search code examples
javapythonjythongrinder

Jython/Grinder/Grinderstone: self arg can't be coerced to net.grinder.plugin.http.HTTPUtilities


A grinder script i have been building out for the past few days has been working pretty well up until just now. I am getting a runtime error initially saying:

    self.token___LASTFOCUS = HTTPUtilities.valueFromHiddenInput('__LASTFOCUS')       
TypeError: valueFromHiddenInput(): expected 2-3 args; got 1

so i added [another arg][1], something i knew would be at the beginning of the script, and got a slightly more useful error. Although now I am not sure what to do with this

    self.token___LASTFOCUS = HTTPUtilities.valueFromHiddenInput('__LASTFOCUS', '')       
TypeError: valueFromHiddenInput(): self arg can't be coerced to net.grinder.plugin.http.HTTPUtilities

Any idea why 'self' isn't being coerced?

[1]: http://grinder.sourceforge.net/g3/script-javadoc/net/grinder/plugin/http/HTTPUtilities.html#valueFromHiddenInput(java.lang.String, java.lang.String)


Solution

  • found the answer i needed these lines

    from net.grinder.plugin.http import HTTPPluginControl
    httpUtilities = HTTPPluginControl.getHTTPUtilities()
    

    It looks like HTTPUtilities might be a singleton or has a factory method. Not to sure on what that specific architecture is.