本文整理汇总了Java中com.google.gwt.safehtml.shared.UriUtils类的典型用法代码示例。如果您正苦于以下问题:Java UriUtils类的具体用法?Java UriUtils怎么用?Java UriUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UriUtils类属于com.google.gwt.safehtml.shared包,在下文中一共展示了UriUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
}
开发者ID:pepstock-org,项目名称:Charba,代码行数:29,代码来源:PluginIdChecker.java
示例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");
}
}
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:23,代码来源:CruiseIconWidget.java
示例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>";
}
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:22,代码来源:HtmlMarkdownUtils.java
示例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));
}
开发者ID:billy1380,项目名称:blogwt,代码行数:20,代码来源:UserSummaryCell.java
示例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);
}
}
开发者ID:nodchip,项目名称:QMAClone,代码行数:25,代码来源:WidgetLinkData.java
示例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);
}
}
}
开发者ID:nodchip,项目名称:QMAClone,代码行数:18,代码来源:PanelSettingUserCodeView.java
示例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);
}
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:10,代码来源:RPCManager.java
示例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();
}
}
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:9,代码来源:LASAnnotationsPanel.java
示例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
);
}
开发者ID:MNCC,项目名称:showcase,代码行数:10,代码来源:PhotoGallery.java
示例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());
}
开发者ID:billy1380,项目名称:blogwt,代码行数:39,代码来源:PostSummaryCell.java
示例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);
}
开发者ID:billy1380,项目名称:blogwt,代码行数:10,代码来源:PropertyController.java
示例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();
}
开发者ID:billy1380,项目名称:blogwt,代码行数:8,代码来源:UserOracle.java
示例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_));
}
}
开发者ID:csavelief,项目名称:gwt-sandbox,代码行数:13,代码来源:ClickableImageCell.java
示例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);
}
开发者ID:kaaproject,项目名称:kaa,代码行数:15,代码来源:ServletHelper.java
示例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);
}
}
开发者ID:nodchip,项目名称:QMAClone,代码行数:10,代码来源:PlusOne.java
示例16: createFakeResource
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
/**
* Creates a fake resource class that returns its own name where possible.
*/
@SuppressWarnings("unchecked") // safe since the proxy implements type
private <T> T createFakeResource(Class<T> type, final String name) {
return (T) Proxy.newProxyInstance(
FakeClientBundleProvider.class.getClassLoader(),
new Class<?>[] {type},
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
Class<?> returnType = method.getReturnType();
if (returnType == String.class) {
return name;
} else if (returnType == SafeHtml.class) {
return SafeHtmlUtils.fromTrustedString(name);
} else if (returnType == SafeUri.class) {
return UriUtils.fromTrustedString(name);
} else if (returnType == boolean.class) {
return false;
} else if (returnType == int.class) {
return 0;
} else if (method.getParameterTypes()[0] == ResourceCallback.class) {
// Read the underlying resource type out of the generic parameter
// in the method's argument
Class<?> resourceType =
(Class<?>)
((ParameterizedType) args[0].getClass().getGenericInterfaces()[0])
.getActualTypeArguments()[0];
((ResourceCallback<ResourcePrototype>) args[0]).onSuccess(
(ResourcePrototype) createFakeResource(resourceType, name));
return null;
} else {
throw new IllegalArgumentException(
"Unexpected return type for method " + method.getName());
}
}
});
}
开发者ID:google,项目名称:gwtmockito,代码行数:40,代码来源:FakeClientBundleProvider.java
示例17: shouldCreateFakeMessages
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Test
public void shouldCreateFakeMessages() {
SampleMessages messages = GWT.create(SampleMessages.class);
assertEquals("noArgs", messages.noArgs());
assertEquals("oneArg(somearg)", messages.oneArg("somearg"));
assertEquals("twoArgs(onearg, twoarg)", messages.twoArgs("onearg", "twoarg"));
assertEquals("safeHtml(arg)",
messages.safeHtml(SafeHtmlUtils.fromTrustedString("arg")).asString());
assertEquals("safeHtmlWithUri(argX, http://uriY)",
messages.safeHtmlWithUri(SafeHtmlUtils.fromTrustedString("argX"),
UriUtils.fromSafeConstant("http://uriY")).asString());
}
开发者ID:google,项目名称:gwtmockito,代码行数:14,代码来源:GwtMockitoTest.java
示例18: onResponseReceived
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
@Override
public void onResponseReceived(Request request, Response response) {
HTMLPanel html = new HTMLPanel(UriUtils.fromString(response.getText()).asString());
panel.add(html);
}
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:6,代码来源:PrintPanel.java
示例19: asHref
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
public static SafeUri asHref (PageType pageType) {
return UriUtils.fromString("#" + pageType.asTargetHistoryToken());
}
开发者ID:billy1380,项目名称:blogwt,代码行数:4,代码来源:PageTypeHelper.java
示例20: slugToHref
import com.google.gwt.safehtml.shared.UriUtils; //导入依赖的package包/类
public static SafeUri slugToHref (String slug) {
return UriUtils.fromString("#" + slugToTargetHistoryToken(slug));
}
开发者ID:billy1380,项目名称:blogwt,代码行数:4,代码来源:PageTypeHelper.java
注:本文中的com.google.gwt.safehtml.shared.UriUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论