URL has # included; want to send the url including # to the server
Gopi Gorantala
Greenhorn
Joined: Jan 18, 2013
Posts: 12
posted
0
Hi,
let suppose there are 2 applications say A & B.
I have my Servlet code in application A and I need to send a url to application B, which validates my credentials and returns me to the url which I gave firstly(single sign on authentication is happening here).
Now, when i am giving url which includes # in it. (let suppose for ex: http://google.com/DOC-68650#test_anchor ). and when I am giving this url, the total url has to go to application B, but only http://google.com/DOC-68650 is going to application B. I want to include #test_anchor also while passing a url from A application to B appliaction.
Can anyone please tell me how to achieve this. Appreciate your help on this.
I am using doFilter method in my program, I think it is a safe way to encode. Is it?
Gopi Gorantala
Greenhorn
Joined: Jan 18, 2013
Posts: 12
posted
0
How to check a url whether it is valid or not, Please include # symbol while validating the url using Java
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
The fact that you're battling the Servlet API should be an indicator that you're going about whatever problem you're trying to solve the wrong way.
The proper approach is to take a step back and ask yourself *why* you want to do this. To me it sounds as if URL parameters might work as well, and would not make you jump through hoops to get it done.
Using Referer just like the Coderanch is done (they make it hidden in Login page). By using referer they pull back to same page after Login. For # included , you got to deal with javascript >> onsubmit then >>encodeURIComponent(). Is this correct ranchers ?
It could likely be kludged with some JavaScript, but the point we're making is that kludges should not be necessary. The OP should rethink (and post) what he is actually trying to accomplish.
Naveen Kumar Kumar
Greenhorn
Joined: Jul 28, 2010
Posts: 19
posted
0
Gopi Gorantala wrote:How to check a url whether it is valid or not, Please include # symbol while validating the url using Java
Gopi, not sure if you are still searching for validating the url, however one of the existing Apache class: "UrlValidator" can be of some help for you to start validating the urls...check the below link: