Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create Session in Restful Service.

 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using Restful Service in Apache CXF for my web application.
I want to know how we create create session and maintain state in REST service.
Is there any examples available ?

Thanks.
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't. REST architectures are stateless.
Perhaps you could clue us in as to what you are trying to accomplish and we can help you REST-ize it.
 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating web-application, in which client will communicate with server.
First client will send request for log-in.
So, client will be authenticate, if its valid then set the user_id into session.
 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using REST service in Apache CXF. so, is there any way in CXF to maintain state ?
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you store state, you aren't creating a "REST-ful" service.
Which do you want? State or REST?
Is your only concern preserving the logged-in user id?
 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want REST services.
Once user is logged id, then it will send several request to server.
So, in that case how session should be maintain ? It should be maintain at client side?

If i want state not REST then how i can do that ?
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what you are looking for is container managed security. That way your REST resources don't know or care about the session and remain restful.
 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is not useful for my application.
I need some another way.
JAX-RS supports @Context.
Can we set cookies ?
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic