This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
i have this specification:
This is the plain text response part of the POST originated by the Server in the step above. Encoding must be as Name=Value fields
separated by carriage-return-linefeeds (CRLF).
IMPORTANT NOTE: Before writing the three fields above to the Response object of the POST, please ensure you clear your response
buffer to remove any header code, comments or HTML. The Sage Pay Server is expecting “Status=” to be the first characters in the
I am not sure what this means:
this is my attempt but i am getting an invalid state exception
but the response works, so what am i supposed to be doing?
It might be useful to see what line of your code the exception is being thrown by (it'll be later in that stack trace), but I'd guess it's line 9 of that snippet.
I think the problem is the sendRedirect() call. That tries to set and send the headers of the response, and will throw an exception if the response is already committed. And writing to and/or flushing the output stream will commit the response (i.e. start sending content to the client).
Why are you trying to redirect? I'd expect your servlet to want to return content or redirect the client, but not both.
the second line is the url to redirect the user to in our system.
Thanks both of you, just removing the redirect gets rid of the exception. can i just double check what is happening flow wise here
Sorry if this is a bit rambling but i am trying to understand...
the 3rd party are calling my servlet with the usual request and response.
I am updating the response
The 3rd party are reading the response (no idea how they are doing that, same way as the client wondow i suppose)
as we can't do a redirect now (the response has been played with) what are the 3rd party doing with the url i give them, starting a new post, like the user clicking a link?