aspose file tools*
The moose likes Servlets and the fly likes Response SendRedirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Response SendRedirect " Watch "Response SendRedirect " New topic
Author

Response SendRedirect

S Subbu
Ranch Hand

Joined: Mar 20, 2012
Posts: 87


Hi,

Please Give me clarrification about this topic.

When i use response.sendRedirect("somedomain") what happen to my Session.

I want to use same Session in other domain also Is it possible.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

You can't. A session is specific to one browser in one web app. If the other site needs data, you'll need to pass it on the request URL.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4658
    
    5

Bear Bibeault wrote: If the other site needs data, you'll need to pass it on the request URL.


or better, pass a nonce as a parameter to the request URL, and have the other site use the nonce to fetch the data it needs out of channel.
S Subbu
Ranch Hand

Joined: Mar 20, 2012
Posts: 87

Ok , how to pass my session attributes?

response.sendRedirect(response.encodeRedirectURL("somedomain"))

What happen when i use the above statement ?

Is That statement include my session attributes to the other domain session ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

No. As already stated you'd need to include them on the URL yourself. Are you limited to a redirect? Can the other server handle a POST?

Of course, in a truly modern system this would be handled by a web service.
S Subbu
Ranch Hand

Joined: Mar 20, 2012
Posts: 87

Oh ok,

i am unaware of web services . My Requirement is in my project is online Payment System(I was new to this type of payments).

How can i connect to other domain(for ex : somebank domain) and how i pass my session attributes.

I need to know webservices ?

Webservices minimize my problems?



Any idea to continue my work.
vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
S Subbu wrote:Oh ok,

i am unaware of web services . My Requirement is in my project is online Payment System(I was new to this type of payments).

How can i connect to other domain(for ex : somebank domain) and how i pass my session attributes.

I need to know webservices ?

Webservices minimize my problems?



Any idea to continue my work.



Yes. web services solves your issue in easy manner. you can also go for EJB.

Difference between EJB and Web services is :

EJB is homogenuous, while webservices are heterogeneous.

Directly you cannot pass data from your domain to another domain. As bear bibeault said, You can pass them from request URL.


Thanks
Vipul Kumar
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4658
    
    5

S Subbu wrote:i am unaware of web services . My Requirement is in my project is online Payment System(I was new to this type of payments).


Online payment systems have been solved technology since the turn of the century. Doing a real payment system (as opposed to a college programming assignment) from scratch is a huge amount of work -- there are many commercial solutions that are well tested, documented and run.

As a learning experience, it can make sense, if the rigor required is modest.

For a commercial product, unless you are Amazon or Apple, it makes zero sense to reinvent the wheel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Response SendRedirect