Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How to get the url from the browser as object in my server class?

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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,


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default 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

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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

Similar Threads

  1. UDP Server Client program to send and receive messages
    By Koren3 in forum Java Networking
    Replies: 1
    Last Post: September 5th, 2011, 10:16 AM
  2. Object o = new Object(); need help
    By zeeshanmirza in forum Object Oriented Programming
    Replies: 11
    Last Post: January 6th, 2010, 10:01 PM
  3. [ASK] Make Object as a layer
    By bocahTuaNakalzz in forum AWT / Java Swing
    Replies: 2
    Last Post: October 24th, 2009, 01:07 PM
  4. How can i point the mouse over a html element within the web browser?
    By bobomonkey in forum Java Theory & Questions
    Replies: 2
    Last Post: October 18th, 2009, 12:37 PM
  5. Having trouble printing object information in main class
    By KingLane in forum Object Oriented Programming
    Replies: 1
    Last Post: October 11th, 2009, 06:53 PM