目前,我使用《 Java本法典》在WT中发送XML数据。 是否有更方便的办法来派遣他们?
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 ?>
"+
"<item barcode= 111 ><name>Foo</name><quantity>100</quantity></item>");
}-*/;