wood burning stoves 2.0*
The moose likes Servlets and the fly likes Retreiving AJAX xml from request in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Retreiving AJAX xml from request in Servlet" Watch "Retreiving AJAX xml from request in Servlet" New topic
Author

Retreiving AJAX xml from request in Servlet

Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
I can do the above in a servlet when I call



Which all works fine.

What I want to do is save off the request information for after I redirect to a login page, so I can retreive the request (and it's xml stream) after a successful login.

For a non-ajax request I was simply saving off the necessary URL +



So, basically, I need to do the same thing with the xml being sent in. Not quite sure how to at this point...

thanks,
Tom
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Would saving off the inputStream of the request (to a Session variable) a safe way to handle this? Or even the best way?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

I don't have much of an idea of what you are trying to accomplish, but from the point of view of the server an Ajax request and a "normal" request are identical. What's the issue?
[ January 11, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
I will try to clarify.

I'm receiving request in my servlet. It was sent as an AJAX-type request and contains an xml stream.

There's a security issue that requires redirecting the user to the login page.

After a successful login, I want to have access to that xml stream, and process it in the original servlet the request was made to.

Part of the issue is that it becomes another request (I believe) at the login page, so I no longer can just call



I may be looking at this the wrong way (from how lost I am, it's entirely possible) but I was thinking I could save off the request's xml inputStream as a session object, for retrieval later.

What I'm realizing as I'm typing is that, I can process the stream as I need to before taking the action that requires the eventual redirection, and already have the information that I'll need afterwards( I think ). Hope this works, saving off an inputStream didn't sound like a good idea at all!

sorry if I needlessly took up anyone's time! thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Right, you cannot save the request or the stream for another request later. The request and its resources are only valid for that single request.

Grabbing the data in the request biody and tucking it away for later is perfectly legitimate.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retreiving AJAX xml from request in Servlet