开发者

GWT: Check if URL is dead

开发者 https://www.devze.com 2023-04-09 16:24 出处:网络
I\'m trying to check if a url (in String form) returns 404 erro开发者_StackOverflowr. However, I can\'t seem to use java.net.URL, and I read somewhere that java.net is not supported in GWT? If so, how

I'm trying to check if a url (in String form) returns 404 erro开发者_StackOverflowr. However, I can't seem to use java.net.URL, and I read somewhere that java.net is not supported in GWT? If so, how do I check if URL is dead or not in GWT?

Much appreciated.


You are right. In client side GWT you cannot use java.net.URL. Take a look at Google's JRE Emulation Reference if you are unsure what parts of the Java standard library can be uses with GWT.

Theoretically it would be possible to check a URL with an AJAX request (see RequestBuilder). But due to the same origin policy it is likely that the browser prevents such an attempt.

So I think you should implement the check on your applications server side (according to the link provided by Roflcoptr above in the comments) and call that routine with GWT-RPC.

0

精彩评论

暂无评论...
验证码 换一张
取 消