• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

retrieving user session

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone know how I can retrieve a particular session by its ID or some
other unique attribute rather than the request object. I want to use a
payment processor (NobelPay) for a ticket-selling web site and they return a
code from the payment process indicating whether the transaction succeeded,
failed or is missing information. Whatever that return value is, I need to
associate it with the user who has data stored in a session on our server. I
think I may be able to add some values to the querystring that NobelPay
returns to us. If so, can I use them to identify a user session on our server?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why can't you just pass the HttpSession to the payment processor when you submit the request? That way it is attached to the processor's work and available at the end when needed.

There is no built in way to reference a session in the way you are talking about. You could build your own map, but I prefer keeping a reference to the session. It's much simpler.
 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there some way to attach an entire object to a querystring? The way this process works is that, I send them form data (or rather the POST does) that they need to process the credit card transaction along with the URL to which they return. I can include a querystring with values I need back. They append other values to the querystring (result of the transaction). I believe the name-value pairs the querystring contains are character data only, right? I can't see how I'd include an entire HttpSession object. Is there some way to do this?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand what the problem is. If all this action is taking place as part of a JSP request-response cycle, or series of cycles, then you should have the user's session available at all times. It should be there automatically due to the user's request having the session ID.
What exactly have you tried?
Incidently, you should not try to keep a session reference around between request-response cycles, sessions are managed by the servlet container.
Bill
 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, here's what's happening. Users go to our site and fill out a series of forms that submit data to our server. The data is added to their session on our server. The last form is submitted to our payment processor, NobelPay. It does not submit to our server, but the one at NobelPay. NobelPay returns a response with an approval code and a status of CONFIRMED, DENIED or MISSING INFORMATION. I have to further process the data for the user's session adding the approval code and possibly updating fields if there was missing data. I can add an id in a form field that we submit to NobelPay and they return it in their querystring in the response to the client. At that point, how do I identify the user's session on our server?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the last form does not get submitted to your server, how do you ever see the response from NobelPay?
Bill
 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the hidden form fields that is submitted to NobelPay is a "response url" to a jsp on our server. I'm guessing that NobelPay sends their response to the client with a client redirect to that url. Not sure how it works, but we have to include the response url in order to get the information about whether or not the payment transaction succeed back to the client.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A good alternative would be to use an id generated by you for the transaction. When the response comes back from NobelPay, you can update the transaction's state in the database. The next time the user makes a request, you can look up the status in the database.

This also has the advantage of being durable in case the user's browser crashes. The session would then be inaccessible and you need some record of the transaction.
 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I was thinking of doing -- getting back the orderID, retrieving and updating the records in the database. I was just hoping there was a way to avoid it, but I think after the response from NobelPay, there's no way to access the user's session on our server. Can't think of how one would do it. Thanks, anyway.
 
reply
    Bookmark Topic Watch Topic
  • New Topic