java.net.URL.getBasePath() --> time to have it?

Bruno Borges bruno.borges at oracle.com
Thu Jan 17 09:11:57 PST 2013


Correct, that works.

But perhaps another method to only return protocol+hostname+port would 
also be convenient?




On 01/17/2013 02:38 PM, Michael McMahon wrote:
> Hi Bruno,
>
> This sounds similar to what URI.resolve() provides:
>
> For example:
>
> new URI("http://www.foo.com/a/b/c").resolve("")
>
> returns http://www.foo.com/a/b/
>
> URL has a constructor which does something similar
> (the URL(URL, String) one)
>
> - Michael
>
>
> On 15/01/13 22:18, Bruno Borges wrote:
>> Hey folks,
>>
>> To be able to get the basePath of a URL, so we can load other stuff 
>> somewhere else, defined as  a relative path, it is common to see 
>> people coding stuff like this:
>>
>> https://gist.github.com/4355670
>>
>> I don't know if there's something in the Java API that offers this, 
>> but it would be a great increment to the java.net.URL class (and 
>> perhaps java.net.URI as well), to offer this out of the box.
>>
>> Thoughts?
>>
>> PS: apparently, I sent this message during holidays, that's why 
>> nobody replied? --> 
>> http://mail.openjdk.java.net/pipermail/net-dev/2012-December/005374.html
>> -- 
>> Bruno Borges
>> Principal Product Manager | JavaEE WebLogic GlassFish
>> Oracle LAD PM Team        | Cloud Application Foundation
>> +55 11 5187 6514 (Work)   | +55 11 99564 9058 (Mobi)
>

-- 
Bruno Borges
Principal Product Manager | JavaEE WebLogic GlassFish
Oracle LAD PM Team        | Cloud Application Foundation
+55 11 5187 6514 (Work)   | +55 11 99564 9058 (Mobi)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20130117/13c8ac1b/attachment.html 


More information about the net-dev mailing list