本文整理汇总了Java中com.google.gwt.safehtml.shared.UriUtils类的典型用法代码示例。如果您正苦于以下问题:Java UriUtils类的具体用法?Java UriUtils怎么用?Java UriUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UriUtils类属于com.google.gwt.safehtml.shared包,在下文中一共展示了UriUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: check
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
/**
* Checks if the plugin is compliant with the constraints of plugin id.<br>
* A plugin id <br>
* <ul>
* <li>can not start with a dot or an underscore
* <li>can not contain any non-URL-safe characters
* <li>cannot contain uppercase letters
* <li>should be something short, but also reasonably descriptive
* </ul>
*
* @param id plugin id to be checked.
* @throws InvalidPluginIdException if the plugin is not compliant
*/
public static void check(String id) throws InvalidPluginIdException {
// checks if is null
if (id == null) {
throw new InvalidPluginIdException(INVALID_PLUGIN__ID_NULL);
} else if (id.charAt(0) == DOT || id.charAt(0) == UNDERSCORE) {
// checks if is starting with DOT or underscore
throw new InvalidPluginIdException(buildMessage(id, INVALID_PLUGIN__ID_FIRST_CHAR));
} else if (!UriUtils.isSafeUri(id)) {
// checks if is not safe URL
throw new InvalidPluginIdException(buildMessage(id, INVALID_PLUGIN__ID_URL_SAFE));
} else if (!id.toLowerCase(Locale.getDefault()).equals(id)) {
// checks if contains uppercase letters
throw new InvalidPluginIdException(buildMessage(id, INVALID_PLUGIN__ID_UPPERCASE));
}
}
示例2: init
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
public void init(LASRequest request, String cruiseid) {
message.setVisible(false);
request.setOperation("Cruise_List", "v7");
List<Map<String, String>> c = request.getVariableConstraints();
for (Iterator cIt = c.iterator(); cIt.hasNext();) {
Map<String, String> map = (Map<String, String>) cIt.next();
String varid = map.get("varID");
if ( varid.equals(cruiseid)) {
} else {
}
}
String url = Util.getProductServer()+"?xml="+URL.encode(request.toString());
RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, UriUtils.sanitizeUri(url));
try {
sendRequest.sendRequest(null, iconListRequestCallback);
} catch (RequestException e) {
message.setVisible(true);
message.setHTML("Unable to icon list");
}
}
示例3: urlElement
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
private static String urlElement(MDUrl url) {
// Sanitizing URL
String href = UriUtils.sanitizeUri(url.getUrl());
// "DeSanitize" custom url scheme
if (url.getUrl().startsWith("send:")) {
href = UriUtils.encodeAllowEscapes(url.getUrl());
} else {
// HotFixing url without prefix
if (!href.equals("#") && !href.contains("://")) {
href = "http://" + href;
}
}
return "<a " +
"target=\"_blank\" " +
"onClick=\"window.messenger.handleLinkClick(event)\" " +
"href=\"" + href + "\">" +
SafeHtmlUtils.htmlEscape(url.getUrlTitle()) +
"</a>";
}
示例4: render
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
public void render (com.google.gwt.cell.client.Cell.Context context,
User user, SafeHtmlBuilder sb) {
String summary;
if (user.summary != null) {
summary = PostHelper.makeMarkup(user.summary);
} else {
summary = "<p class=\"text-muted text-justify\">"
+ SafeHtmlUtils.fromString(UserHelper.name(user)).asString()
+ " has not entered a user summary.</p>";
}
RENDERER.render(sb, SafeHtmlUtils.fromString(UserHelper.name(user)),
SafeHtmlUtils.fromString("@" + user.username),
UriUtils.fromString(user.avatar + "?s=80&default=retro"),
SafeHtmlUtils.fromTrustedString(summary));
}
示例5: WidgetLinkData
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
public WidgetLinkData(PacketLinkData linkData, PanelLink panelLink) {
this.linkData = linkData;
this.panelLink = panelLink;
add(new HTML(TEMPLATE.messageWithLink(UriUtils.fromString(linkData.url),
linkData.homePageName, linkData.authorName,
Utility.toDateFormat(new Date(linkData.lastUpdate)))));
{
final HorizontalPanel panel = new HorizontalPanel();
panel.setVerticalAlignment(ALIGN_MIDDLE);
panel.add(new HTML(
TEMPLATE.image(UriUtils.fromString(linkData.url), linkData.bannerUrl)));
panel.add(new HTML(SafeHtmlUtils.fromString(linkData.description)));
{
final VerticalPanel panelButtons = new VerticalPanel();
panelButtons.add(buttonUpdate);
panelButtons.add(buttonRemove);
panel.add(panelButtons);
}
add(panel);
}
}
示例6: setUserDataList
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
public void setUserDataList(List<PacketUserData> userDataList) {
panelUserCodeList.clear();
radioButtonToUserData = Maps.newHashMap();
for (PacketUserData userData : userDataList) {
SafeUri imageUrl = UriUtils.fromString(Constant.ICON_URL_PREFIX
+ userData.imageFileName);
SafeHtml label = TEMPLATE.image(imageUrl, userData.userCode, userData.playerName);
RadioButton radioButton = new RadioButton(GROUP_USER_CODE, label);
radioButtonToUserData.put(radioButton, userData);
panelUserCodeList.add(radioButton);
if (this.userData.getUserCode() == userData.userCode) {
radioButton.setValue(true);
}
}
}
示例7: onSuccess
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
public void onSuccess(CategorySerializable[] result) {
String catid = UriUtils.fromString(result[0].getID()).asString();
String dsid = UriUtils.fromString(result[0].getDatasetSerializable().getID()).asString();
removeGetCategoriesEvent(catid, dsid);
eventBus.fireEventFromSource(new CategoriesReturnedEvent(result), RPCManager.this);
}
示例8: setAnnotationsHTMLURL
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
public void setAnnotationsHTMLURL(String url) {
RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, UriUtils.sanitizeUri(url));
try {
sendRequest.sendRequest(null, annotationsHTMLCallback);
} catch (RequestException e) {
e.printStackTrace();
}
}
示例9: createImageWrapper
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
private SafeHtml createImageWrapper(Image img) {
return htmlTemplate_.input(
UriUtils.fromTrustedString(img.authorWebsite),
UriUtils.fromTrustedString(img.imageUrl),
img.imageText,
img.authorName,
img.css
);
}
示例10: render
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
public void render (Context context, Post value, SafeHtmlBuilder builder) {
SafeUri link = PageTypeHelper.asHref(PageType.PostDetailPageType,
PostHelper.getSlug(value));
SafeHtml published = Templates.INSTANCE.notPublished(DateTimeHelper
.ago(value.created));
if (value.published != null) {
published = Templates.INSTANCE.publishedDate(DateTimeHelper
.ago(value.published));
}
String body = "Empty... :imp:";
if (value.summary != null && value.summary.length() > 0) {
body = value.summary;
} else if (value.content != null && value.content.body != null
&& value.content.body.length() > 0) {
body = value.content.body;
}
SafeHtml author = SafeHtmlUtils.EMPTY_SAFE_HTML;
if (PropertyController.get().booleanProperty(
PropertyHelper.POST_SHOW_AUTHOR, false)) {
author = Templates.INSTANCE
.author(UriUtils.fromString(value.author.avatar + "?s="
+ UserHelper.AVATAR_HEADER_SIZE + "&default=retro"),
UserHelper.handle(value.author));
}
RENDERER.render(builder, link, SafeHtmlUtils
.fromTrustedString(PostHelper.makeHeading2(value.title)),
SafeHtmlUtils.fromTrustedString(PostHelper.makeMarkup(body)),
author, published,
value.listed.booleanValue() ? SafeHtmlUtils.EMPTY_SAFE_HTML
: Templates.INSTANCE.notVisible());
}
示例11: copyrightHolderUrl
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
/**
* @return
*/
public SafeUri copyrightHolderUrl () {
Property p = propertyLookup.get(PropertyHelper.COPYRIGHT_URL);
return UriUtils.fromSafeConstant(
PropertyHelper.isEmpty(p) ? "https://www.willshex.com"
: p.value);
}
示例12: getDisplayString
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
protected String getDisplayString (User item) {
return Templates.INSTANCE.displayString(
UriUtils.fromString(item.avatar + "?s="
+ UserHelper.AVATAR_HEADER_SIZE + "&default=retro"),
UserHelper.name(item)).asString();
}
示例13: render
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
if (value != null) {
SafeUri uri = trustUri_ ? UriUtils.fromTrustedString(value) : UriUtils.fromString(value);
if (width_ == null && height_ != null) // resize with constraint on height
sb.append(template_.imgByHeight(uri, height_));
else if (height_ == null && width_ != null) // resize with constraint on width
sb.append(template_.imgByWidth(uri, width_));
else if (height_ != null) // resize with constraint on width and height
sb.append(template_.img(uri, width_, height_));
}
}
示例14: composeUrl
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
private static String composeUrl(String servletPath, String... params) {
String ret = servletPath;
ret = ret.replaceAll("[\\?&]+$", "");
String sep = ret.contains("?") ? "&" : "?";
for (String par : params) {
ret += sep + par;
sep = "&";
}
for (Entry<String, List<String>> e : Window.Location.getParameterMap().entrySet()) {
ret += sep + e.getKey() + "=" + e.getValue().get(0);
}
ret += sep + "random=" + Math.random();
return UriUtils.encode(ret);
}
示例15: getButton
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
public static SafeHtml getButton(int problemId, boolean inline) {
SafeUri uri = UriUtils.fromTrustedString("http://kishibe.dyndns.tv:8080/QMAClone#problem="
+ problemId);
if (inline) {
return TEMPLATES.plusOneInline(uri);
} else {
return TEMPLATES.plusOne(uri);
}
}