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


Java UrlBuilder.setParameter方法代码示例

本文整理汇总了Java中com.google.gwt.http.client.UrlBuilder.setParameter方法的典型用法代码示例。如果您正苦于以下问题:Java UrlBuilder.setParameter方法的具体用法?Java UrlBuilder.setParameter怎么用?Java UrlBuilder.setParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.http.client.UrlBuilder的用法示例。


在下文中一共展示了UrlBuilder.setParameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildUrl

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
private void buildUrl() {
	UrlBuilder urlBuilder = Window.Location.createUrlBuilder();
	PlanRequestBean planRequest = getPlanRequestBean();
	if (planRequest.getDeparture().isSet(false))
		urlBuilder.setParameter("origin",
				getLocationAsStringParam(planRequest.getDeparture()));
	if (planRequest.getArrival().isSet(false))
		urlBuilder.setParameter("destination",
				getLocationAsStringParam(planRequest.getArrival()));
	DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/[email protected]:mm");
	urlBuilder.setParameter(
			planRequest.isDateDeparture() ? "depart" : "arrive",
			dtf.format(planRequest.getDate()));
	if (planRequest.isWheelchairAccessible())
		urlBuilder.setParameter("wheelchair", "y");
	Set<TransportMode> modes = planRequest.getModes();
	String modesStr = "";
	for (TransportMode mode : modes) {
		modesStr = modesStr + mode.toString() + ",";
	}
	modesStr = modesStr.substring(0, modesStr.length() - 1);
	urlBuilder.setParameter("modes", modesStr);
	url = urlBuilder.buildString();
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:25,代码来源:PlannerState.java

示例2: getUiSwitcherUrl

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
private static String getUiSwitcherUrl(String token) {
  UrlBuilder builder = new UrlBuilder();
  builder.setProtocol(Location.getProtocol());
  builder.setHost(Location.getHost());
  String port = Location.getPort();
  if (port != null && !port.isEmpty()) {
    builder.setPort(Integer.parseInt(port));
  }
  String[] tokens = token.split("@", 2);
  if (Location.getPath().endsWith("/") && tokens[0].startsWith("/")) {
    tokens[0] = tokens[0].substring(1);
  }
  builder.setPath(Location.getPath() + tokens[0]);
  if (tokens.length == 2) {
    builder.setHash(tokens[1]);
  }
  builder.setParameter("polygerrit", "1");
  return builder.buildString();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:Gerrit.java

示例3: switchLocale

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
/**
 * Switches the application locale.
 * @param locale new locale
 */
private void switchLocale(String locale) {
    UrlBuilder urlBuilder = Window.Location.createUrlBuilder();
    urlBuilder.setParameter(LOCALE_ATTRIBUTE, locale);
    String url = urlBuilder.buildString();
    Window.Location.assign(url);
}
 
开发者ID:proarc,项目名称:proarc,代码行数:11,代码来源:Editor.java

示例4: getApplicationUrl

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
/**
 * Returns the current application URL (with current optional parameters) with the given additional parameter
 * {@code paramName}.
 * 
 * @param withParameters
 *          {@code true} to retrieve existing current URL parameters, {@code false} to forget them.
 * @param paramName
 *          The parameter name.
 * @param paramValues
 *          The parameter value(s).
 * @return the current application URL (with current optional parameters) with the given additional parameter
 *         {@code paramName}.
 */
public static String getApplicationUrl(boolean withParameters, String paramName, String... paramValues) {

	final UrlBuilder urlBuilder = new UrlBuilder();

	urlBuilder.setProtocol(Location.getProtocol());
	urlBuilder.setHost(Location.getHost());
	final Integer port = asInt(Location.getPort());
	if (port != null) {
		urlBuilder.setPort(port);
	}
	urlBuilder.setPath(Location.getPath());

	if (Location.getParameterMap() != null) {
		// "?gwt.codesvr=127.0.0.1:9997" for example.
		for (final Entry<String, List<String>> param : Location.getParameterMap().entrySet()) {

			if ("gwt.codesvr".equalsIgnoreCase(param.getKey()) && isNotEmpty(param.getValue())) {
				// Hosted mode parameter exception.
				urlBuilder.setParameter(param.getKey(), param.getValue().get(0));

			} else if (withParameters) {
				final String[] values = param.getValue() != null ? param.getValue().toArray(new String[param.getValue().size()]) : null;
				urlBuilder.setParameter(param.getKey(), values);
			}
		}
	}

	if (isNotBlank(paramName) && paramValues != null) {
		urlBuilder.setParameter(paramName, paramValues);
	}

	return urlBuilder.buildString();
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:47,代码来源:ClientUtils.java

示例5: addGraphToReport

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
@Override
public void addGraphToReport(final RequestCallback callback, final int kscReportId, final String graphTitle, final String graphName, final String resourceId, final String timeSpan) {
    UrlBuilder builder = new UrlBuilder();
    builder.setPath(BASE_URL + "/" + kscReportId);
    builder.setParameter("title", graphTitle);
    builder.setParameter("reportName", graphName);
    builder.setParameter("resourceId", resourceId);
    builder.setParameter("timespan", timeSpan);

    // we just want a relative URL, so we render it and strip the beginning :)
    final String url = builder.buildString().replace("http:///", "");
    GWT.log("making request: " + url);
    sendRequest(callback, RequestBuilder.PUT, url);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:DefaultKscReportService.java

示例6: buildLocaleUrl

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
/** Build the correct URL for the new locale. */
private String buildLocaleUrl(String selectedLocale) {
	UrlBuilder builder = Window.Location.createUrlBuilder();
	builder.removeParameter("locale");
	if (!"default".equals(selectedLocale)) {
		builder.setParameter("locale", selectedLocale);
	}
	return builder.buildString();
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:10,代码来源:LocaleSelect.java

示例7: showSampleInNewTab

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
public static void showSampleInNewTab(ShowcaseSampleDefinition sample) {
	UrlBuilder urlBuilder = Window.Location.createUrlBuilder();
	urlBuilder.setParameter("sample", sample.getKey());
	String url = urlBuilder.buildString();
	Window.open(url, sample.getTitle(), "");
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:7,代码来源:ExampleBase.java

示例8: runAnalysis

import com.google.gwt.http.client.UrlBuilder; //导入方法依赖的package包/类
protected void runAnalysis() {
	
	String pagename = Window.Location.getPath().substring( 0, Window.Location.getPath().lastIndexOf( "/" ) );
	
	pagename += "/report.jsp";
	
	UrlBuilder ub = Window.Location.createUrlBuilder();
	
	ub.setPath( pagename );
	ub.setParameter( "target", entityLabel.getText() );
	ub.setParameter( "rc", rcLabel.getText() );
	Window.Location.replace( ub.buildString() );
}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:14,代码来源:RiskAnalysisModule.java


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