Tuesday, March 10, 2015

Anchor with SafeUri constant

Given the following:

public class NameTokens {
   
public static final String HOME_PAGE = "home";

   
public static String getHomePage() {
       
return HOME_PAGE;
   
}
}


UiBinder:

<ui:UiBinder
    ...

   
<ui:with field="nt" type="foo.bar.NameTokens" />

    ...

   
<li><a href="#{nt.getHomePage}">Home</a></li>
</ui:UiBinder>

A warning about not safe constant is displayed:

[WARN] Escaping unsafe runtime String expression used for URI with UriUtils.fromString(). Use SafeUri instead: <a href='#{nt.getHomePage}'> (:36)

Any way to fix this with ONLY using UiBinder and not having to switch to <g:Anchor> or <g:Hyperlink>?
Trying to use as few widgets as possible. I know it still works but trying to get rid of this warning, and not by simply ignoring it. Thanks.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment