本文整理汇总了Java中com.google.gwt.http.client.URL.encodePathSegment方法的典型用法代码示例。如果您正苦于以下问题:Java URL.encodePathSegment方法的具体用法?Java URL.encodePathSegment怎么用?Java URL.encodePathSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.http.client.URL
的用法示例。
在下文中一共展示了URL.encodePathSegment方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUrl
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
/**
* Constructs a url for searching tweets
*
* the url has the form:
*
* HOST_URL/search/:text/:screenName/:collection/:fromYear/:fromMonth/:fromDay/:toYear/:toMonth/:toDay/:page
*
* @param e
* @return
*/
private static String getUrl(SearchEvent e){
searchText = e.getSearchText();
searchText = URL.encodePathSegment(searchText);
url = Consts.HOST_URL + "/search/" + searchText + "/";
url = url + e.getAccount() + "/" + ((e.getSearchType() == 2) ? "mentions" : "statuses");
url = url + "/" + e.getMediaOnly();
if (e.getStartDate() != null && e.getEndDate() != null){
url = url + e.getStartDate() + e.getEndDate() + "/";
}else if (e.getEndDate() != null){
url = url + "/0/0/0" + e.getEndDate() + "/";
}else if (e.getStartDate() != null){
url = url + e.getStartDate() + "/0/0/0/";
}else{
url = url + "/0/0/0/0/0/0/";
}
return url;
}
示例2: updateCommand
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
/**
* Updates command.
*
* @return a promise that resolves to the {@link WorkspaceImpl}, or rejects with an error
*/
public Promise<WorkspaceImpl> updateCommand(
String wsId, String commandName, CommandImpl commandUpdate) {
final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName);
final CommandDto commandDto =
dtoFactory
.createDto(CommandDto.class)
.withName(commandUpdate.getName())
.withCommandLine(commandUpdate.getCommandLine())
.withType(commandUpdate.getType())
.withAttributes(commandUpdate.getAttributes());
return asyncRequestFactory
.createRequest(PUT, url, commandDto, false)
.header(ACCEPT, APPLICATION_JSON)
.header(CONTENT_TYPE, APPLICATION_JSON)
.loader(loaderFactory.newLoader("Updating command..."))
.send(dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class))
.then((Function<WorkspaceDto, WorkspaceImpl>) WorkspaceImpl::new);
}
示例3: deleteCommand
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
/**
* Removes command from workspace.
*
* @param wsId workspace ID
* @param commandName the name of the command to remove
* @return a promise that will resolve when the command has been stopped, or rejects with an error
*/
public Promise<Void> deleteCommand(String wsId, String commandName) {
final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName);
return asyncRequestFactory
.createDeleteRequest(url)
.loader(loaderFactory.newLoader("Deleting command..."))
.send();
}
示例4: encodeUrl
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
/**
* Returns a string where all characters that are not valid for a complete URL have been escaped.
* Also, it will do URL rewriting for session tracking if necessary.
* Fires SESSION_MISMATCH if the seesion ID on the client is different from the one on the server.
*
* @param url this could be a full or partial url. Delimiter characters will be preserved.
* @param paramType if the the parameters are for the server use QUESTION_MARK if the client use POUND
* @param params parameters to be appended to the url. These parameters may contain
* delimiter characters. Unlike url, delimiter characters will be encoded as well.
* @return encoded url
*/
public static String encodeUrl(String url, ParamType paramType, Param... params) {
String paramChar= paramType== ParamType.QUESTION_MARK ? "?": "#";
String[] parts = url.split("\\"+paramChar, 2);
String baseUrl = parts[0];
String queryStr = URL.encode(parts.length==2 ? parts[1] : "");
if (params != null && params.length > 0) {
for (int i = 0; i < params.length; i++) {
Param param = params[i];
if (param != null && !StringUtils.isEmpty(param.getName())) {
String key = URL.encodePathSegment(param.getName().trim());
String val = param.getValue() == null ? "" : URL.encodePathSegment(param.getValue().trim());
queryStr += val.length() == 0 ? key : key + ServerRequest.KW_VAL_SEP + val + (i < params.length ? "&" : "");
}
}
}
return URL.encode(baseUrl) + (queryStr.length() == 0 ? "" : paramChar + queryStr);
}
示例5: loginRedirect
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
public static String loginRedirect(String token) {
if (token == null) {
token = "";
} else if (token.startsWith("/")) {
token = token.substring(1);
}
return selfRedirect("login/") + URL.encodePathSegment("#/" + token);
}
示例6: actionExport
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
public static void actionExport() {
// AtomTools.log(Level.INFO, "Window.Location.getQueryString() = " + Window.Location.getQueryString(), singleton);
// AtomTools.log(Level.INFO, "Window.Location.getHref() = " + Window.Location.getHref() , singleton);
// AtomTools.log(Level.INFO, "Window.Location.getPath() = " + Window.Location.getPath() , singleton);
// AtomTools.log(Level.INFO, "Window.Location.getPath() = " + Window.Location.getHost() , singleton);
String url = Window.Location.getHref();
AtomTools.log(Level.FINER, "originalUrl = " + url , singleton);
//String commingFrom = url.substring(url.indexOf("#")+1);
if(url.contains("?"))
url = url.substring(0, url.indexOf("?"));
else if(url.contains("#"))
url = url.substring(0, url.indexOf("#"));
AtomTools.log(Level.FINER, "cutUrl = " + url , singleton);
url = AtomTools.ensureEndsWithSlash(url);
//export servlet (and every other servlet but the gwt-rpc one) are defined to be on the root folder
// @ atom/atom-server/src/main/webapp/WEB-INF/web.xml
// if(!(url.endsWith("app/")))
// url += "app/";
url += "export?class=" + singleton.lastShownFrame.getRepresentedClass().getName();
url += "&filter=" + URL.encodePathSegment(AtomTools.getFilterString(singleton.lastShownFrame.getDataFilters()));
AtomTools.log(Level.FINER, "finishedUrl = " + url , singleton);
Window.open(url, "_blank", "");
}
示例7: initAndShow
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
private void initAndShow() {
// initialize JossoUtil... supply context information
JossoUtil.init(
Application.getInstance().getProperties().getProperty("sso.server.url"),
GWT.getModuleBaseURL(),
Application.getInstance().getProperties().getProperty("sso.user.profile.url")
);
commandTable = creator.makeCommandTable();
toolBar = creator.getToolBar();
layoutManager = creator.makeLayoutManager();
if (creator.isApplication()) {
requestHandler = getRequestHandler();
History.addValueChangeHandler(requestHandler);
}
nullFrame = new Frame();
nullFrame.setSize("0px", "0px");
nullFrame.setVisible(false);
RootPanel root = RootPanel.get();
root.clear();
root.add(nullFrame);
if (BrowserUtil.isTouchInput()) root.addStyleName("disable-select");
if (getLayoutManager()!=null) getLayoutManager().layout(creator.getLoadingDiv());
checkMobilAppInstall();
if (SupportedBrowsers.isSupported()) {
if (appReady != null) {
appReady.ready();
}
if (creator.isApplication()) {
// save the current state when you leave.
DeferredCommand.addCommand(new Command() {
public void execute() {
Window.addCloseHandler(new CloseHandler<Window>() {
public void onClose(CloseEvent<Window> windowCloseEvent) {
gotoUrl(null, false);
}
});
}
});
// coming back from prior session
String ssoBackTo = Cookies.getCookie(PRIOR_STATE);
final Request prevState = Request.parse(ssoBackTo);
if (prevState != null && prevState.isSearchResult()) {
Cookies.removeCookie(PRIOR_STATE);
History.newItem(ssoBackTo, true);
} else {
// url contains request params
String qs = Window.Location.getQueryString().replace("?", "");
if (!StringUtils.isEmpty(qs) && !qs.contains(IGNORE_QUERY_STR)) {
String qsDecoded = URL.decodeQueryString(qs);
String base = Window.Location.getHref();
base = base.substring(0, base.indexOf("?"));
String newUrl = base + "#" + URL.encodePathSegment(qsDecoded);
Window.Location.replace(newUrl);
} else {
String startToken = History.getToken();
if (StringUtils.isEmpty(startToken)) {
goHome();
} else {
requestHandler.processToken(startToken);
}
}
}
if (backgroundMonitor!=null) backgroundMonitor.syncWithCache(null);
}
} else {
hideDefaultLoadingDiv();
SupportedBrowsers.showUnsupportedMessage();
}
}
示例8: encodePathSegment
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
@Override
public String encodePathSegment(String decodedURLComponent) {
return URL.encodePathSegment(decodedURLComponent);
}
示例9: param
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
public static String param(String aName, String aValue) {
return aName + "=" + (aValue != null ? URL.encodePathSegment(aValue) : "");
}
示例10: encodePart
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
private String encodePart(String segment) {
return segment != null ? URL.encodePathSegment(segment) : null;
}
示例11: encodePathSegment
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
@Override
public String encodePathSegment(String decodedURLComponent) {
return URL.encodePathSegment(decodedURLComponent);
}
示例12: encodePathSegment
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
/**
* Returns a string where all characters that are not valid for a URL
* component have been escaped. The escaping of a character is done by
* converting it into its UTF-8 encoding and then encoding each of the
* resulting bytes as a %xx hexadecimal escape sequence.
*
* <p>
* The following character sets are <em>not</em> escaped by this method:
* <ul>
* <li>ASCII digits or letters</li>
* <li>ASCII punctuation characters:
*
* <pre>- _ . ! ~ * ' ( )</pre>
* </li>
* </ul>
* </p>
*
* <p>
* Notice that this method <em>does</em> encode the URL component delimiter
* characters:<blockquote>
*
* <pre>
* ; / ? : & = + $ , #
* </pre>
*
* </blockquote>
* </p>
*
* @param decodedURLComponent a string containing invalid URL characters
* @return a string with all invalid URL characters escaped
*
* @throws NullPointerException if decodedURLComponent is <code>null</code>
*/
public static String encodePathSegment(String decodedURLComponent)
{
if( decodedURLComponent == null )
{
return null;
}
return URL.encodePathSegment( decodedURLComponent );
}
示例13: toDataURL
import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
/**
* Creates a data URL from the given content and type.
*
* @param mimeType Type of the content.
* @param content Content.
* @return A data URL.
*/
public static String toDataURL(String mimeType, String content) {
return "data:" + mimeType + ',' + URL.encodePathSegment(content);
}