Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: generic rest-api Date: Mon, 21 Nov 2016 19:59:52 -0500 Organization: Aioe.org NNTP Server Lines: 37 Message-ID: References: <7194c303-1388-4e3f-b340-39cd7d129653@googlegroups.com> NNTP-Posting-Host: 68.229.81.69 Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: gioia.aioe.org 1479776392 3243 68.229.81.69 (22 Nov 2016 00:59:52 GMT) X-Complaints-To: abuse@aioe.org NNTP-Posting-Date: Tue, 22 Nov 2016 00:59:52 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 In-Reply-To: <7194c303-1388-4e3f-b340-39cd7d129653@googlegroups.com> Cache: gioia.aioe.org 1479776392 3243 68.229.81.69 1479776392 68.229.81.69 1431 808 B659TxQLtDLb4NZOVG3Sfw 68.229.81 1 0 Xref: csiph.com comp.lang.java.programmer:35923 On 11/21/2016 7:08 PM, Philipp Kraus wrote: > I'm writing a framework which should be also accessable with a > webservice. At the moment I'm using Jetty for the server. > Is there any componente or framework to create a structure like this > and is also portable to Tomcat, Jetty and Glassfish? Most likely any solution will be portable among any Java web container. > I have got > a set of objects and each object should be defined as a webservice > with a REST-API which returns the object as a JSON structure. > > I need a call like http://server/"any path"/object_identifier/state > which returns the current state of the object (I can get these > information by calling a method). And also I need for each method in > the object a call like http://server/"any > path"/object_identifier/methodname The best case should be an > automatically generation of all this URLs. > > I'm knowing > Jersy, but I think I need some wrapper code around to do this. The standard way is using JAX-RS. I believe that Spring has its own non-standard thing. http://server/"any path"/object_identifier/state is easy as it is just a normal RESTful GET request. http://server/"any path"/object_identifier/methodname is tricky because it is not RESTful but RPC style. RESTful only have resources and GET, POST, PUT and DELETE. Arne