当前位置: 首页>>代码示例>>Java>>正文


Java URL.encodePathSegment方法代码示例

本文整理汇总了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;
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:35,代码来源:SearchView.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:WorkspaceServiceClient.java

示例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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:WorkspaceServiceClient.java

示例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);
}
 
开发者ID:lsst,项目名称:firefly,代码行数:31,代码来源:WebUtil.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:Gerrit.java

示例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", "");
	}
 
开发者ID:fhcampuswien,项目名称:atom,代码行数:33,代码来源:App.java

示例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();
        }


    }
 
开发者ID:lsst,项目名称:firefly,代码行数:82,代码来源:Application.java

示例8: encodePathSegment

import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
@Override
public String encodePathSegment(String decodedURLComponent) {
  return URL.encodePathSegment(decodedURLComponent);
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:5,代码来源:UrlEncoder.java

示例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) : "");
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:4,代码来源:AppClient.java

示例10: encodePart

import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
private String encodePart(String segment) {
    return segment != null ? URL.encodePathSegment(segment) : null;
}
 
开发者ID:growbit,项目名称:turbogwt-http,代码行数:4,代码来源:UriBuilderImpl.java

示例11: encodePathSegment

import com.google.gwt.http.client.URL; //导入方法依赖的package包/类
@Override
public String encodePathSegment(String decodedURLComponent) {
    return URL.encodePathSegment(decodedURLComponent);
}
 
开发者ID:reinert,项目名称:requestor,代码行数:5,代码来源:UrlCodecImpl.java

示例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>
 * ; / ? : &amp; = + $ , #
 * </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 );
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:42,代码来源:SharedMethods.java

示例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);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:11,代码来源:Files.java


注:本文中的com.google.gwt.http.client.URL.encodePathSegment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。