org.apache.wicket.request.Request.getContextPath()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(178)

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

Request.getContextPath介绍

[英]Returns the context path or an empty string if the application is running under root context. Returned path, unless an empty string, will always start with a slash and will never end with a slash.
[中]如果应用程序在根上下文下运行,则返回上下文路径或空字符串。返回的路径,除非是空字符串,否则总是以斜杠开始,永远不会以斜杠结束。

代码示例

代码示例来源:origin: de.alpharogroup/jaulp-wicket-base

/**
 * Gets the context path from the given WebPage.
 * 
 * @param page
 *            the page
 * @return the context path
 */
public static String getContextPath(final Page page)
{
  return page.getRequest().getContextPath();
}

代码示例来源:origin: apache/wicket

public CharSequence getContextPath() {
  contextPath.compareAndSet(null, RequestCycle.get().getRequest().getContextPath());
  return contextPath.get();
}

代码示例来源:origin: org.apache.wicket/wicket-native-websocket-core

public CharSequence getContextPath() {
  contextPath.compareAndSet(null, RequestCycle.get().getRequest().getContextPath());
  return contextPath.get();
}

代码示例来源:origin: de.alpharogroup/jaulp-wicket-base

/**
 * Gets the context path.
 * 
 * @return the context path
 */
public static String getContextPath()
{
  return RequestCycle.get().getRequest().getContextPath();
}

代码示例来源:origin: org.wicketstuff/wicketstuff-portlet

private Url encodeSharedResourceUrl(Url url) {
  if (url != null) {
    Request request = RequestCycle.get().getRequest();
    StringBuilder urlBuilder = new StringBuilder();
    urlBuilder.append(request.getContextPath());
    urlBuilder.append(request.getFilterPath());
    urlBuilder.append(PortletFilter.SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX);
    urlBuilder.append(Base64.encodeBase64URLSafeString(ThreadPortletContext.getWindowID().getBytes()));
    urlBuilder.append('/');
    urlBuilder.append(url.toString());
    url = Url.parse(urlBuilder.toString());
  }
  return url;
}

代码示例来源:origin: brix-cms/brix-cms

protected boolean isSelected(ChildEntry entry) {
  final String url = "/" + getRequest().getContextPath();
  Reference ref = entry.getReference();
  if (ref == null) {
    return false;
  } else {
    return isSelected(ref, url);
  }
}

代码示例来源:origin: org.opensingular/singular-requirement-commons

public static String getBaseURL() {
  final RequestCycle requestCycle = RequestCycle.get();
  final Request request = requestCycle.getRequest();
  final String currentPath = request.getUrl().toString();
  String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl());
  if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) {
    final int beginPath = fullUrl.lastIndexOf(currentPath);
    fullUrl = fullUrl.substring(0, beginPath - 1);
  }
  final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath());
  final Optional<String> filterPath = Optional.ofNullable(requestCycle.getRequest().getFilterPath());
  return fullUrl + contextPath.orElse("") + filterPath.orElse("");
}

代码示例来源:origin: org.opensingular/singular-requirement-module

public static String getBaseURL() {
  final RequestCycle requestCycle = RequestCycle.get();
  final Request request = requestCycle.getRequest();
  final String currentPath = request.getUrl().toString();
  String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl());
  if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) {
    final int beginPath = fullUrl.lastIndexOf(currentPath);
    fullUrl = fullUrl.substring(0, beginPath - 1);
  }
  final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath());
  final Optional<String> filterPath = Optional.ofNullable(requestCycle.getRequest().getFilterPath());
  return fullUrl + contextPath.orElse("") + filterPath.orElse("");
}

代码示例来源:origin: org.artifactory/artifactory-web-common

public static String getWicketAppPath() {
  Request request = RequestCycle.get().getRequest();
  return request.getContextPath() + request.getFilterPath() + "/";
}

代码示例来源:origin: org.opensingular/singular-server-commons

public static String getBaseURL() {
  final RequestCycle requestCycle = RequestCycle.get();
  final Request request = requestCycle.getRequest();
  final String currentPath = request.getUrl().toString();
  String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl());
  if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) {
    final int beginPath = fullUrl.lastIndexOf(currentPath);
    fullUrl = fullUrl.substring(0, beginPath - 1);
  }
  final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath());
  final Optional<String> filterPath = Optional.ofNullable(requestCycle.getRequest().getFilterPath());
  return fullUrl + contextPath.orElse("") + filterPath.orElse("");
}

代码示例来源:origin: org.opensingular/server-commons

public static String getBaseURL() {

    final RequestCycle requestCycle = RequestCycle.get();
    final Request      request      = requestCycle.getRequest();
    final String       currentPath  = request.getUrl().toString();

    String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl());

    if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) {
      final int beginPath = fullUrl.lastIndexOf(currentPath);
      fullUrl = fullUrl.substring(0, beginPath - 1);
    }

    final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath());
    final Optional<String> filterPath  = Optional.ofNullable(requestCycle.getRequest().getFilterPath());

    return fullUrl + contextPath.orElse("") + filterPath.orElse("");
  }
}

代码示例来源:origin: apache/wicket

Url commonPrefix = Url.parse(request.getContextPath() + request.getFilterPath());

代码示例来源:origin: org.apache.wicket/wicket-request

Url commonPrefix = Url.parse(request.getContextPath() + request.getFilterPath());

代码示例来源:origin: org.apache.wicket/wicket-request

render.append(request.getContextPath());
render.append(request.getFilterPath());

代码示例来源:origin: org.opensingular/singular-requirement-module

protected String getBaseUrl() {
  return RequestCycle.get().getRequest().getContextPath() + SingularSession.get().getServerContext().getUrlPath();
}

代码示例来源:origin: apache/wicket

render.append(request.getContextPath());
render.append(request.getFilterPath());

代码示例来源:origin: org.opensingular/singular-wicket-utils

render.append(request.getContextPath());
render.append(request.getFilterPath());

代码示例来源:origin: org.opensingular/wicket-utils

render.append(request.getContextPath());
render.append(request.getFilterPath());

代码示例来源:origin: org.geoserver.web/gs-web-wms

+ ":"
          + clientUrl.getPort()
          + r.getContextPath();
} else {
  styleUrl = proxyBaseUrl;

相关文章