You must give it a JSON value:
public String postUpper(String s) { return s.toUpperCase(); } curl -X POST -H “Content-Type: application/json" -d '"hello"' http://localhost:8080/rest/upper HELLO$ There is a new version in progress that will be able to help a bit more with this. Then again, this REST API is a simple support for your Javascript code to call Java. If you need more control over your REST then a JAX-RS solution might be better. Kind regards, Peter Kriens > On 24 aug. 2016, at 05:36, manoj.vrajam...@wipro.com wrote: > > I inserted the following method in the existing class: > > public String putValue(String string) { > String status = string; > return (status + " World"); > } > > 2. Tried calling curl --data "param1=Hello" http://localhost:8080/rest/value > > > But got the following error: > > manoj@manoj-Latitude-E5420:~$ curl --data "param1=Hello" > http://localhost:8080/rest/value > <html> > <head> > <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> > <title>Error 500 </title> > </head> > <body> > <h2>HTTP ERROR: 500</h2> > <p>Problem accessing /rest/value. Reason: > <pre> java.io.FileNotFoundException: No such method postvalue/0. > Available: {getservletname/0=[getservletname/0], > getinitparameternames/0=[getinitparameternames/0], > getinitparameter/1=[getinitparameter/1], getstatus/1=[getstatus/1], > getsetvalue/1=[getsetvalue/1], getupper/1=[getupper/1], > getservletcontext/0=[getservletcontext/0], > getservletinfo/0=[getservletinfo/0], getservletconfig/0=[getservletconfig/0], > putvalue/0=[putvalue/0]}</pre></p> > <hr /><i><small>Powered by Jetty://</small></i> > </body> > </html> > > From: osgi-dev-boun...@mail.osgi.org <osgi-dev-boun...@mail.osgi.org> on > behalf of David Leangen <o...@leangen.net> > Sent: 23 August 2016 17:56:18 > To: OSGi Developer Mail List > Subject: Re: [osgi-dev] Help > > ** This mail has been sent from an external source ** > > Hi Manoj, > > It is similar to get. The java method name starts with the http method name, > so for instance putUpper() etc. > > The test cases in this project should help: > > > https://github.com/osgi/osgi.enroute.bundles/tree/master/osgi.enroute.rest.simple.test > > > Cheers, > =David > > > >> On Aug 23, 2016, at 8:36 PM, <manoj.vrajam...@wipro.com> >> <manoj.vrajam...@wipro.com> wrote: >> >> Hi All, >> >> The Enroute Quick Start Tutorial sample application helps to invoke the >> “GET” HTTP method by adding methods preceding with “get” like getUpper(), >> getStatus() and so on. to the Application class. >> >> I am trying to test using curl on a Linux terminal. GET works fine. >> >> Now, >> >> I would like to try other HTTP methods (like PUT,POST, DELETE) on this REST >> API application. >> >> What should I do? Please suggest… >> >> Thanks, >> Manoj >> The information contained in this electronic message and any attachments to >> this message are intended for the exclusive use of the addressee(s) and may >> contain proprietary, confidential or privileged information. If you are not >> the intended recipient, you should not disseminate, distribute or copy this >> e-mail. Please notify the sender immediately and destroy all copies of this >> message and any attachments. WARNING: Computer viruses can be transmitted >> via email. The recipient should check this email and any attachments for the >> presence of viruses. The company accepts no liability for any damage caused >> by any virus transmitted by this email. www.wipro.com >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev