I'm building a xpath layer to use on top of httpunit in our environment and would like to be able to instantiate my own instances of WebForm, WebImage, WebLink, WebTable, etc. Unfortunately, the constructors are either package-scoped or private (WebTable). Would it be possible to open these classes up a little more or at least provide public factories to get the appropriate instances of HttpUnit classes associated with provided DOM Nodes?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I ran into the same problem. I'm trying to call httpunit from Jython.
Jython is a Python interpreter written in Java. Using Jython, you can call Java methods from a Python script. Jython uses Java reflection to lookup and invoke Java methods.
The TableCell class inherits most of its methods from the ParsedHTML class. Since ParsedHTML is package-private, I can do this:
links = cell.getLinks();
but I can't do this:
Method method = cell.getClass().getMethod("getLinks", new Class[0]);
links = (WebLink[]) method.invoke(cell, new Object[0]);
Would the httpunit authors mind making ParsedHTML a public class?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm building a xpath layer to use on top of httpunit in our environment and would like to be able to instantiate my own instances of WebForm, WebImage, WebLink, WebTable, etc. Unfortunately, the constructors are either package-scoped or private (WebTable). Would it be possible to open these classes up a little more or at least provide public factories to get the appropriate instances of HttpUnit classes associated with provided DOM Nodes?
I ran into the same problem. I'm trying to call httpunit from Jython.
Jython is a Python interpreter written in Java. Using Jython, you can call Java methods from a Python script. Jython uses Java reflection to lookup and invoke Java methods.
The TableCell class inherits most of its methods from the ParsedHTML class. Since ParsedHTML is package-private, I can do this:
links = cell.getLinks();
but I can't do this:
Method method = cell.getClass().getMethod("getLinks", new Class[0]);
links = (WebLink[]) method.invoke(cell, new Object[0]);
Would the httpunit authors mind making ParsedHTML a public class?