Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28963 > unrolled thread

Java API for RESTful Services

Started byjason.petersson@gmail.com
First post2014-07-06 09:01 -0700
Last post2014-07-08 00:14 +0200
Articles 8 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Java API for RESTful Services jason.petersson@gmail.com - 2014-07-06 09:01 -0700
    Re: Java API for RESTful Services Arne Vajhøj <arne@vajhoej.dk> - 2014-07-06 12:05 -0400
      Re: Java API for RESTful Services jason.petersson@gmail.com - 2014-07-06 09:26 -0700
        Re: Java API for RESTful Services Arne Vajhøj <arne@vajhoej.dk> - 2014-07-06 12:30 -0400
          Re: Java API for RESTful Services Jason Petersson <jason.petersson@gmail.com> - 2014-07-06 09:48 -0700
            Re: Java API for RESTful Services Arne Vajhøj <arne@vajhoej.dk> - 2014-07-06 19:12 -0400
    Re: Java API for RESTful Services Daniele Futtorovic <da.futt.news@laposte.net> - 2014-07-06 22:35 +0200
    Re: Java API for RESTful Services Joerg Meier <joergmmeier@arcor.de> - 2014-07-08 00:14 +0200

#28963 — Java API for RESTful Services

Fromjason.petersson@gmail.com
Date2014-07-06 09:01 -0700
SubjectJava API for RESTful Services
Message-ID<27ea72bb-99ad-4a0f-bca4-c3cbafdf032a@googlegroups.com>
Good morning,

are there any Java api's you can recommend for accessing  restful services? Thank you!

Best Regards,
Jason Petersson
http://jnpetersson.com

[toc] | [next] | [standalone]


#28964

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-07-06 12:05 -0400
Message-ID<53b973e1$0$291$14726298@news.sunsite.dk>
In reply to#28963
On 7/6/2014 12:01 PM, jason.petersson@gmail.com wrote:
> Good morning,
>
> are there any Java api's you can recommend for accessing  restful services? Thank you!

I believe JAX-RS 2 comes with a client API.

Commonly used implementations like Jersey and RESTEasy also comes
with client API's.

But I think a lot of developers just use plain Apache HttpClient
and whatever JSON or XML library they need to handle the data.

REST services are not like WS-* SOAP services.

Arne

[toc] | [prev] | [next] | [standalone]


#28968

Fromjason.petersson@gmail.com
Date2014-07-06 09:26 -0700
Message-ID<a8ae7ef9-01ee-41e9-9416-b78a226d3572@googlegroups.com>
In reply to#28964
Excellent. I will look into Jersey and RESTEasy as well. I have been using Apache HttpClient which works well I am just curious if there are additional API's used that provide additional features specific for REST.

Best Regards,
Jason Petersson
http://jnpetersson.com

On Sunday, July 6, 2014 9:05:52 AM UTC-7, Arne Vajhøj wrote:
> On 7/6/2014 12:01 PM, jason.petersson@gmail.com wrote:
> 
> > Good morning,
> 
> >
> 
> > are there any Java api's you can recommend for accessing  restful services? Thank you!
> 
> 
> 
> I believe JAX-RS 2 comes with a client API.
> 
> 
> 
> Commonly used implementations like Jersey and RESTEasy also comes
> 
> with client API's.
> 
> 
> 
> But I think a lot of developers just use plain Apache HttpClient
> 
> and whatever JSON or XML library they need to handle the data.
> 
> 
> 
> REST services are not like WS-* SOAP services.
> 
> 
> 
> Arne

[toc] | [prev] | [next] | [standalone]


#28970

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-07-06 12:30 -0400
Message-ID<53b979bf$0$299$14726298@news.sunsite.dk>
In reply to#28968
On 7/6/2014 12:26 PM, jason.petersson@gmail.com wrote:
> On Sunday, July 6, 2014 9:05:52 AM UTC-7, Arne Vajhøj wrote:
>> I believe JAX-RS 2 comes with a client API.
>>
>> Commonly used implementations like Jersey and RESTEasy also comes
>> with client API's.
>>
>> But I think a lot of developers just use plain Apache HttpClient
>> and whatever JSON or XML library they need to handle the data.
>>
>> REST services are not like WS-* SOAP services.

> Excellent. I will look into Jersey and RESTEasy as well. I have been
 > using Apache HttpClient which works well I am just curious if there
 > are additional API's used that provide additional features specific
 > for REST.

There are so little you need to do RESTful style. HTTP, 4 methods,
headers, URL and body.

The data handling depends a lot on whether you use XML or JSON or CSV or
whatever format.

Arne

[toc] | [prev] | [next] | [standalone]


#28974

FromJason Petersson <jason.petersson@gmail.com>
Date2014-07-06 09:48 -0700
Message-ID<0220c8d4-ecad-4877-b593-95eacb3c890b@googlegroups.com>
In reply to#28970
The response payload is even simpler than XML, JSON, CSV. Basically just returns a 0 or 1. With the HTTP Client there is sometime some additional whitespace parsing required. I believe the the minimal effort required to parse the response, the better.

https://authrequest.com/auth/auth?method=authenticate&organization=a&username=a&password=a
1 if failed and 0 if successful

Sincerely,
Jason Petersson
http://jnpetersson.com

On Sunday, July 6, 2014 9:30:56 AM UTC-7, Arne Vajhøj wrote:
> On 7/6/2014 12:26 PM, jason.petersson@gmail.com wrote:
> 
> > On Sunday, July 6, 2014 9:05:52 AM UTC-7, Arne Vajh�j wrote:
> 
> >> I believe JAX-RS 2 comes with a client API.
> 
> >>
> 
> >> Commonly used implementations like Jersey and RESTEasy also comes
> 
> >> with client API's.
> 
> >>
> 
> >> But I think a lot of developers just use plain Apache HttpClient
> 
> >> and whatever JSON or XML library they need to handle the data.
> 
> >>
> 
> >> REST services are not like WS-* SOAP services.
> 
> 
> 
> > Excellent. I will look into Jersey and RESTEasy as well. I have been
> 
>  > using Apache HttpClient which works well I am just curious if there
> 
>  > are additional API's used that provide additional features specific
> 
>  > for REST.
> 
> 
> 
> There are so little you need to do RESTful style. HTTP, 4 methods,
> 
> headers, URL and body.
> 
> 
> 
> The data handling depends a lot on whether you use XML or JSON or CSV or
> 
> whatever format.
> 
> 
> 
> Arne

[toc] | [prev] | [next] | [standalone]


#28984

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-07-06 19:12 -0400
Message-ID<53b9d7ec$0$293$14726298@news.sunsite.dk>
In reply to#28974
On 7/6/2014 12:48 PM, Jason Petersson wrote:
> The response payload is even simpler than XML, JSON, CSV. Basically
> just returns a 0 or 1. With the HTTP Client there is sometime some
> additional whitespace parsing required. I believe the the minimal
> effort required to parse the response, the better.
>
> https://authrequest.com/auth/auth?method=authenticate&organization=a&username=a&password=a
>
>1 if failed and 0 if successful

I think this is in the true spirit of REST. If it can be done simple,
then no need to make it complex.

Arne

[toc] | [prev] | [next] | [standalone]


#28980

FromDaniele Futtorovic <da.futt.news@laposte.net>
Date2014-07-06 22:35 +0200
Message-ID<lpcbu3$qqt$1@dont-email.me>
In reply to#28963
On 2014-07-06 18:01, jason.petersson@gmail.com allegedly wrote:
> Good morning,
> 
> are there any Java api's you can recommend for accessing  restful services? Thank you!
> 
> Best Regards,
> Jason Petersson
> http://jnpetersson.com
> 

I have used CXF <http://cxf.apache.org/> in the past and can recommend it.

[toc] | [prev] | [next] | [standalone]


#28993

FromJoerg Meier <joergmmeier@arcor.de>
Date2014-07-08 00:14 +0200
Message-ID<13fpsdxeg86tb$.13sej1zs8bxr3.dlg@40tude.net>
In reply to#28963
On Sun, 6 Jul 2014 09:01:40 -0700 (PDT), jason.petersson@gmail.com wrote:

> are there any Java api's you can recommend for accessing  restful services? Thank you!

Please, before you look any further, check out Retrofit.

http://square.github.io/retrofit/

In short, an example to access the GitHub REST API:

public interface GitHubService {
  @GET("/users/{user}/repos")
  List<Repo> listRepos(@Path("user") String user);
}

RestAdapter restAdapter = new RestAdapter.Builder()
    .setEndpoint("https://api.github.com")
    .build();

GitHubService service = restAdapter.create(GitHubService.class);

List<Repo> repos = service.listRepos("octocat");

There, done. That's literally all you need.

Liebe Gruesse,
		Joerg

-- 
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web