struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Whitehurst <dlwhitehu...@gmail.com>
Subject Using PUT with REST Plugin
Date Wed, 13 May 2009 00:22:53 GMT
Can someone show me using my example of how to use the PUT feature of
the REST Plugin.  I'll provide my example that doesn't work.  I need
to know if I'm setting this up correctly using GWT.  I can't get it to
work.  The Confluence showed id=Thrillers so I've also tried
&id=customers and that didn't work either.  I'm using the REST Plugin
on top of AppFuse for DAO and service managers.  I use RequestBuilder
in a static class to GET and POST.  The GET part works fine.

private static String EDIT_CUSTOMER_URL =
"http://localhost/service/json/customers/";

private void postEdit() {
        formCustomer.setId(CustomerTable.getSelectedCustomer().getId());
        String url = EDIT_CUSTOMER_URL;
        //url = url.concat(formCustomer.getId());

        StringBuffer postData = new StringBuffer();

        postData.append("_method=").append(URL.encodeComponent("put"));
        postData.append("&id").append(URL.encodeComponent(formCustomer.getId()));

        postData.append("&name=");
        postData.append(URL.encodeComponent(formCustomer.getName()));

        postData.append("&phone=");
        postData.append(URL.encodeComponent(formCustomer.getPhone()));

        Window.alert("Getting ready to post: " + postData.toString() +
" " + url );

        // POST
        RequestUtils.submitPost(url, postData);
        restoreCustomerDetailPanel();
    }

Thanks

David

--
David L. Whitehurst
http://www.capehenrytech.com … Providing software instruction through
a sea of Technology.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message