Url capture


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Url capture

Hybrid View

  1. #1
    Dusty Guest

    Url capture


    I need to capture a Url, pass it to a string and then parse it out. Can anyone
    help me?

  2. #2
    Tom Duffy Guest

    Re: Url capture


    Hello Dusty:

    Just call the toString() method on the URL object to get a String representation.
    Then you can do whatever you want to the String:
    URL url;
    try{
    url = "http://www.myserver.com"
    }catch(MalformedURLException mue){}
    String URLString = url.toString();

    Hope this helps.

    Tom Duffy

    "Dusty" <dkodet@csuchico.edu> wrote:
    >
    >I need to capture a Url, pass it to a string and then parse it out. Can

    anyone
    >help me?



  3. #3
    Paul Clapham Guest

    Re: Url capture


    Dusty <dkodet@csuchico.edu> wrote in message
    news:390a253f$1@news.devx.com...
    >
    > I need to capture a Url, pass it to a string and then parse it out. Can

    anyone
    > help me?


    I can't guess what you mean by "capturing" a URL. But once you've got it
    into a string, use the java.net.URL class to parse it:

    import java.net.URL;

    URL u = new URL(the string you captured it into);
    String protocol = u.getProtocol();
    String host = u.getHost();

    etc.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center