-
Url capture
I need to capture a Url, pass it to a string and then parse it out. Can anyone
help me?
-
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?
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks