gpt4 book ai didi

com.github.bordertech.wcomponents.WebUtilities.getPath()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 16:13:05 26 4
gpt4 key购买 nike

本文整理了Java中com.github.bordertech.wcomponents.WebUtilities.getPath()方法的一些代码示例,展示了WebUtilities.getPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebUtilities.getPath()方法的具体详情如下:
包路径:com.github.bordertech.wcomponents.WebUtilities
类名称:WebUtilities
方法名:getPath

WebUtilities.getPath介绍

[英]Adds GET parameters to a path.
[中]将GET参数添加到路径。

代码示例

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Adds GET parameters to a path.
 *
 * @param url the existing url path
 * @param parameters are put into the URL as get parameters.
 * @return the complete url eg http://localhost/app?step=1
 */
public static String getPath(final String url, final Map<String, String> parameters) {
  return getPath(url, parameters, false);
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * {@inheritDoc}
 */
@Override
public String getPostPath() {
  if (windowId == null) {
    return backing.getPostPath();
  } else {
    Map<String, String> parameters = new HashMap<>();
    parameters.put(WWindow.WWINDOW_REQUEST_PARAM_KEY, windowId);
    String url = getWServletPath();
    return WebUtilities.getPath(url, parameters, true);
  }
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
   * @return the URL which can be used to target this resource.
   */
  public String getTargetUrl() {
    UIContext uic = UIContextHolder.getCurrent();

    if (uic == null) {
      return null;
    }

    String url = uic.getEnvironment().getWServletPath();
    Map<String, String> parameters = new HashMap<>();
    String resourceCacheKey = InternalResourceMap.getResourceCacheKey(resourceName);
    parameters.put(WServlet.STATIC_RESOURCE_PARAM_NAME, resourceName);

    if (resourceCacheKey != null) {
      parameters.put("cacheKey", resourceCacheKey);
    }

    return WebUtilities.getPath(url, parameters, true);
  }
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Returns a dynamic URL that this wwindow component can be accessed from.
 *
 * @return the URL to access this wwindow component.
 */
public String getUrl() {
  Environment env = getEnvironment();
  Map<String, String> parameters = env.getHiddenParameters();
  parameters.put(WWINDOW_REQUEST_PARAM_KEY, getId());
  // Override the step count with WWindow step
  parameters.put(Environment.STEP_VARIABLE, String.valueOf(getStep()));
  String url = env.getWServletPath();
  return WebUtilities.getPath(url, parameters, true);
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Creates a dynamic URL that the poster can be loaded from. In fact the URL points to the main application servlet,
 * but includes a non-null for the parameter associated with this WComponent (ie, its label). The handleRequest
 * method below detects this when the browser requests a file.
 *
 * @return the url to load the poster from, or null if there is no poster defined.
 */
public String getPosterUrl() {
  Image poster = getComponentModel().poster;
  if (poster == null) {
    return null;
  }
  // this variable needs to be set in the portlet environment.
  String url = getEnvironment().getWServletPath();
  Map<String, String> parameters = getBaseParameterMap();
  parameters.put(POSTER_REQUEST_PARAM_KEY, "x");
  return WebUtilities.getPath(url, parameters, true);
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Creates dynamic URLs that the video clips can be loaded from. In fact the URL points to the main application
 * servlet, but includes a non-null for the parameter associated with this WComponent (ie, its label). The
 * handleRequest method below detects this when the browser requests a file.
 *
 * @return the urls to load the video files from, or null if there are no clips defined.
 */
public String[] getVideoUrls() {
  Video[] video = getVideo();
  if (video == null || video.length == 0) {
    return null;
  }
  String[] urls = new String[video.length];
  // this variable needs to be set in the portlet environment.
  String url = getEnvironment().getWServletPath();
  Map<String, String> parameters = getBaseParameterMap();
  for (int i = 0; i < urls.length; i++) {
    parameters.put(VIDEO_INDEX_REQUEST_PARAM_KEY, String.valueOf(i));
    urls[i] = WebUtilities.getPath(url, parameters, true);
  }
  return urls;
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
 * Creates dynamic URLs that the video clips can be loaded from. In fact the URL points to the main application
 * servlet, but includes a non-null for the parameter associated with this WComponent (ie, its label). The
 * handleRequest method below detects this when the browser requests a file.
 *
 * @return the urls to load the video files from, or null if there are no clips defined.
 */
public String[] getTrackUrls() {
  Track[] tracks = getTracks();
  if (tracks == null || tracks.length == 0) {
    return null;
  }
  String[] urls = new String[tracks.length];
  // this variable needs to be set in the portlet environment.
  String url = getEnvironment().getWServletPath();
  Map<String, String> parameters = getBaseParameterMap();
  for (int i = 0; i < urls.length; i++) {
    parameters.put(TRACK_INDEX_REQUEST_PARAM_KEY, String.valueOf(i));
    urls[i] = WebUtilities.getPath(url, parameters, true);
  }
  return urls;
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

@Test
public void testGetPath() {
  // Simple case
  String url = "/foo";
  String expected = "/foo";
  Assert.assertEquals("Incorrect path returned for " + url, expected, WebUtilities.
      getPath(url, null));
  // Simple case with one param
  Map<String, String> params = new HashMap<>();
  params.put("a", "b");
  url = "/foo";
  expected = "/foo?a=b";
  Assert.assertEquals("Incorrect path returned for " + url + " with a=b", expected,
      WebUtilities.getPath(url, params));
  // Case with existing params and two in the map
  params = new HashMap<>();
  params.put("c", "d");
  params.put("e", "f");
  url = "/foo?a=b";
  expected = "/foo?a=b&amp;c=d&amp;e=f";
  assertURLEquals(expected, WebUtilities.getPath(url, params), "&amp;");
  // As a javascript url
  expected = "/foo?a=b&c=d&e=f";
  assertURLEquals(expected, WebUtilities.getPath(url, params, true), "&");
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

urls[i] = WebUtilities.getPath(url, parameters, true);

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

return WebUtilities.getPath(url, parameters, true);

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

return WebUtilities.getPath(url, parameters, true);

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

return WebUtilities.getPath(url, parameters, true);

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

return WebUtilities.getPath(url, parameters, true);

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

return WebUtilities.getPath(url, parameters, true);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com