How to get the url from the browser as object in my server class?
hi boss,
i am writing one server class. in that serversocket created at the port 9000.
now i want to get url in the browser as a java object.
boss i used getInputStream() method to get url but i get as a string object.
from that i have to get contextpath, path info ...etc
here, i want one URL class object if tried to get that by String as parameter of constructor, it gives MalformedException.
i sent url in browser as http://localhost:9000/app/servlet , is it ok? boss.
is it ok for URL class object or any other class object we have to create ?
and i want to send response to the browser. so i want its address for that i used outputStream() but the output didn't going to browser.
how can i send the response to the browser?
plzzz tell me by which class i have to get the browser url information?
plz help me thank u boss,
Re: How to get the url from the browser as object in my server class?
Are you using a normal HttpServlet here?
In that case I guess you have an incoming HttpServletRequest object. You can use the request object to get the requestURL and URI.
See HttpServletRequest (Servlet API Documentation))
// Json
Re: How to get the url from the browser as object in my server class?
hi json ,
i am not using any HttpServlet or any?
at my socket which is running at a port no 9000,
i want to take URL class Object? how is it possible?
//chinni