Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java RESTful web service

Reply
Thread Tools

java RESTful web service

 
 
Wouter
Guest
Posts: n/a
 
      03-31-2009
Hey,

I want to create a RESTful java web service.
I am developping an application for Android and I need a web service
to handle data!
But I have a problem, I want a user to login with a username and
password but how can I do this with
a rest web service? The username and login would be saved in a (mysql)
database!

Can anyone help me?

Thank you,

Wouter
 
Reply With Quote
 
 
 
 
Tom Anderson
Guest
Posts: n/a
 
      03-31-2009
On Tue, 31 Mar 2009, Wouter wrote:

> I want to create a RESTful java web service. I am developping an
> application for Android and I need a web service to handle data! But I
> have a problem, I want a user to login with a username and password but
> how can I do this with a rest web service?


Use HTTP authentication. In particular, HTTP digest authentication. It's
handled in the HTTP layer, so it doesn't impose any requirements on
application flow which would interfere with the RESTfulness of your web
app.

How are you implementing the web app?

If it's with servlets or JSPs, you can do this by configuration, without
having to write any code. You have to put some stuff in your web.xml
saying which URLs you want protected and a bit about how,

Then there's container-specific configuration about how the authentication
should be done - where the list of users is kept, that sort of thing. In
Tomcat, it's done with the server.xml file; see:

http://tomcat.apache.org/tomcat-5.5-...fig/realm.html
http://tomcat.apache.org/tomcat-5.5-...alm-howto.html

> The username and login would be saved in a (mysql) database!


Tomcat can do that - use a JDBCRealm or DataSourceRealm.

tom

--
People don't want nice. People want London. -- Al
 
Reply With Quote
 
 
 
 
Frank Cisco
Guest
Posts: n/a
 
      03-31-2009
Restful web service? Is that like one that's really lazy?


 
Reply With Quote
 
Wouter
Guest
Posts: n/a
 
      03-31-2009
On Mar 31, 2:45*pm, Tom Anderson <t...@urchin.earth.li> wrote:
> On Tue, 31 Mar 2009, Wouter wrote:
> > I want to create a RESTful java web service. I am developping an
> > application for Android and I need a web service to handle data! But I
> > have a problem, I want a user to login with a username and password but
> > how can I do this with a rest web service?

>
> Use HTTP authentication. In particular, HTTP digest authentication. It's
> handled in the HTTP layer, so it doesn't impose any requirements on
> application flow which would interfere with the RESTfulness of your web
> app.
>
> How are you implementing the web app?
>
> If it's with servlets or JSPs, you can do this by configuration, without
> having to write any code. You have to put some stuff in your web.xml
> saying which URLs you want protected and a bit about how,
>
> Then there's container-specific configuration about how the authentication
> should be done - where the list of users is kept, that sort of thing. In
> Tomcat, it's done with the server.xml file; see:
>
> http://tomcat.apache.org/tomcat-5.5-...alm-howto.html
>
> > The username and login would be saved in a (mysql) database!

>
> Tomcat can do that - use a JDBCRealm or DataSourceRealm.
>
> tom
>
> --
> People don't want nice. People want London. -- Al


Thank you for your answer and this very usefull links Tom!
I don't want to have a real website. Just a backend web service for my
android application!
I want to read some xml data (REST objects) and do some posting on the
REST web service.
So I have a login screen at my Android application and i have to make
a HttpUrlConnection to the
web service and how can I check if the filled in username and password
is correct (that they exists in the database?)
How can I make this in my webservice?

Thx

Wouter
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      03-31-2009
On Tue, 31 Mar 2009, Wouter wrote:

> On Mar 31, 2:45*pm, Tom Anderson <t...@urchin.earth.li> wrote:
>> On Tue, 31 Mar 2009, Wouter wrote:
>>> I want to create a RESTful java web service. I am developping an
>>> application for Android and I need a web service to handle data! But I
>>> have a problem, I want a user to login with a username and password but
>>> how can I do this with a rest web service?

>>
>> Use HTTP authentication. In particular, HTTP digest authentication. It's
>> handled in the HTTP layer, so it doesn't impose any requirements on
>> application flow which would interfere with the RESTfulness of your web
>> app.
>>
>> How are you implementing the web app?
>>
>> If it's with servlets or JSPs, you can do this by configuration, without
>> having to write any code. You have to put some stuff in your web.xml
>> saying which URLs you want protected and a bit about how,
>>
>> Then there's container-specific configuration about how the authentication
>> should be done - where the list of users is kept, that sort of thing. In
>> Tomcat, it's done with the server.xml file; see:
>>
>> http://tomcat.apache.org/tomcat-5.5-...alm-howto.html
>>
>>> The username and login would be saved in a (mysql) database!

>>
>> Tomcat can do that - use a JDBCRealm or DataSourceRealm.

>
> Thank you for your answer and this very usefull links Tom! I don't want
> to have a real website. Just a backend web service for my android
> application! I want to read some xml data (REST objects) and do some
> posting on the REST web service. So I have a login screen at my Android
> application and i have to make a HttpUrlConnection to the web service
> and how can I check if the filled in username and password is correct
> (that they exists in the database?) How can I make this in my
> webservice?


As i said. Tell us more about how you're implementing the web service.

tom

--
People don't want nice. People want London. -- Al
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      03-31-2009
Tom Anderson wrote:
> On Tue, 31 Mar 2009, Wouter wrote:
>> I want to create a RESTful java web service. I am developping an
>> application for Android and I need a web service to handle data! But I
>> have a problem, I want a user to login with a username and password
>> but how can I do this with a rest web service?

>
> Use HTTP authentication. In particular, HTTP digest authentication. It's
> handled in the HTTP layer, so it doesn't impose any requirements on
> application flow which would interfere with the RESTfulness of your web
> app.


The only alternative is a custom HTTP header with username/password.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      03-31-2009
Frank Cisco wrote:
> Restful web service? Is that like one that's really lazy?


http://en.wikipedia.org/wiki/REST

Arne
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      04-01-2009
On Tue, 31 Mar 2009 04:12:35 -0700 (PDT), Wouter
<> wrote, quoted or indirectly quoted someone who
said :

>I want to create a RESTful java web service


If you are using Applets or Java Web Start to login see
http://mindprod.com/jgloss/authentication.html

If just an ordinary browser, your servlet womb, such as Tomcat,
handles it for you (I don't recognise the term Restful). Your Servlets
can ignore authentication. You set it up in the Tomcat config files in
a fairly straightforward way. Just scan the docs for "login" or
"authentication". There are several types.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Danish studies of 10,000 birds killed revealed that almost all died in
collisions with buildings, cars and wires; only 10 were killed by windmills.
Alternative energy sources are absolutely necessary.
Global warming will kill birds and bats, as well as other species,
in much greater numbers than wind power."
~ Dr. David Suzuki
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      04-01-2009
Roedy Green wrote:
> On Tue, 31 Mar 2009 04:12:35 -0700 (PDT), Wouter
> <> wrote, quoted or indirectly quoted someone who
> said :
>> I want to create a RESTful java web service

>
> If you are using Applets or Java Web Start to login see
> http://mindprod.com/jgloss/authentication.html


He wrote:

#I am developping an application for Android

> If just an ordinary browser, your servlet womb, such as Tomcat,
> handles it for you (I don't recognise the term Restful).


http://en.wikipedia.org/wiki/REST

Arne
 
Reply With Quote
 
Richard Maher
Guest
Posts: n/a
 
      04-01-2009
Hi,

"Arne Vajhøj" <> wrote in message
news:49d2bb37$0$90264$...
> Roedy Green wrote:
> > On Tue, 31 Mar 2009 04:12:35 -0700 (PDT), Wouter
> > <> wrote, quoted or indirectly quoted someone who
> > said :
> >> I want to create a RESTful java web service

> >
> > If you are using Applets or Java Web Start to login see
> > http://mindprod.com/jgloss/authentication.html

>
> He wrote:
>
> #I am developping an application for Android


Is there any chance that the OP is using (looking to use) IPsec for a VPN,
or that anyone else here knows something about how this MOBIKE
(http://www.ietf.org/rfc/rfc4555.txt) protocol works?

If so, can you please just confirm that this protocol allows a hand-held
device to receive dynamic IP addresses from its carrier(s) yet still remain
a part of the IPsec configured VPN to a given host(s)?

This has to be the mutt's nuts!

Sorry if it's off-topic but I saw the following this morning and this post
rang a bell: -
http://www.net-security.org/secworld.php?id=7257
>
> > If just an ordinary browser, your servlet womb, such as Tomcat,
> > handles it for you (I don't recognise the term Restful).

>
> http://en.wikipedia.org/wiki/REST
>
> Arne


Cheers Richard Maher


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does it matter how you implement RESTful web services? ses Java 6 04-30-2010 10:34 AM
newbie question - RESTful web service book Brian Wolf Ruby 2 02-02-2010 03:51 PM
Web Services Restful Services imlakhani Java 1 12-16-2009 03:06 PM
WCF and RESTful web service that outputs complex XML type (.NET 3.5) Matty J ASP .Net Web Services 0 04-20-2008 01:17 AM
"RESTful Web Services" Rich Morin Ruby 5 06-10-2007 03:33 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57