Currently I use the JavaScript code to send XML data in GWT. Is there an easier way to send them?
sendRequest.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
// ItemExtension client = ProxyFactory.create(ItemExtension.class, "http://localhost:8081");
sendXMLFFI(restInput.getText());
protected native void sendXMLFFI(String text)
/*-{
var xmlhttp=false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
xmlhttp.open("POST", "./REST/Items",true);
xmlhttp.setRequestHeader("Content-Type", "application/xml")
xmlhttp.send("<?xml version='1.0' encoding='UTF-8'?>\n\n"+
"<item barcode='111'><name>Foo</name><quantity>100</quantity></item>");
}-*/;