Hello All, I have researched this but I can't seem to find an answer. So I must turn to the Guru's. Does anyone know how to read a return URL after
//example - actual url has params and all. URL u=new URL("http://www.msn.com"); URLConnection uc=u.openConnection(); is made. I have an app that does credit card processing and I need to send a url with the customers info and then I get a return url telling me if the transaction is compete or not. I can read the content of the page just fine but I need to be able to parse the return url. Any help would be much appreciated. Thanks, Tim
in case i understand your question right... request.getRequestURL().toString() will give you the url from which the request was made... but still, i didn't really understand what do you want to do [ March 25, 2003: Message edited by: Asher Tarnopolski ]
Really sorry for the confusion, it's not a usual process so here's an example of what happens: Customer enters their credit card info thru my site and clicks the submit button. I am using struts in my app so this form post is sent to it's ActionForm then to the Action object that it's tied to. This is where I call the URL object and send a "Get" thru the URL object using URLConnection to my creditcard processing company with the info the customer gave me. example: URL u=new URL("https://creditcardprocessing.com?c_info=Card Name&C_number=4111111111111111&C_exp=012005&T_code=02&T_amt=1.00"); URLConnection uc=u.openConnection(); uc.setDoInput(true); uc.setDoOutput(true); uc.setUseCaches(false);
The creditcard processing company then sends a response back to me with codes in the return url - or querystring - whatever you like to call it - URI if that helps - that tells me if the transaction succeeded or failed. There is no content in the body in the return from the creditcard company, all of the information I need is contained in the return url seperated out by params: approved=no&message=OverLimit... basicly the ccprocessing company manipulates the url before it sends it's response back to me. The trick is, Since I am initiating this post is this manner I need to be able to read the response url. This is where I'm stumped. I can do it just fine in asp or jsp or even php but I want to stick with my paradigm and handle the communication from the action object. Any help or feedback is welcome, I want to learn. Tim
I think what he's trying to get at is that the processor does some work, then does a sendRedirect. He can read the response page (because that's the end result with follow redirect enabled) but he doesn't know the final URL that he was redirected to. I would check the response message using getResponseMessage()
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.