org.apache.wicket.request.Request类的使用及代码示例

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

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

Request介绍

[英]Request object.
[中]请求对象。

代码示例

代码示例来源:origin: stackoverflow.com

public class MockClient implements Client {

  @Override
  public Response execute(Request request) throws IOException {
    Uri uri = Uri.parse(request.getUrl());

    Log.d("MOCK SERVER", "fetching uri: " + uri.toString());

    String responseString = "";

    if(uri.getPath().equals("/path/of/interest")) {
      responseString = "JSON STRING HERE";
    } else {
      responseString = "OTHER JSON RESPONSE STRING";
    }

    return new Response(request.getUrl(), 200, "nothing", Collections.EMPTY_LIST, new TypedByteArray("application/json", responseString.getBytes()));
  }
}

代码示例来源:origin: com.googlecode.wicket-jquery-ui/wicket-jquery-ui-core

/**
 * Gets the value of a query parameter
 *
 * @param name the name of the query parameter
 * @return a {@link StringValue}
 */
public static StringValue getQueryParameterValue(String name)
{
  final RequestCycle requestCycle = RequestCycle.get();
  final IRequestParameters parameters = requestCycle.getRequest().getQueryParameters();
  return parameters.getParameterValue(name);
}

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

@Override
protected boolean isActive() {
  return RequestCycle.get()
      .getRequest()
      .getRequestParameters()
      .getParameterValue(ActionContext.ITEM_PARAM_NAME)
      .toString("")
      .equals(this.title);
}

代码示例来源:origin: com.googlecode.wicket-jquery-ui/wicket-jquery-ui-core

/**
 * Gets the value of a post parameter
 *
 * @param name the name of the post parameter
 * @return a {@link StringValue}
 */
public static StringValue getPostParameterValue(String name)
{
  final RequestCycle requestCycle = RequestCycle.get();
  final IRequestParameters parameters = requestCycle.getRequest().getPostParameters();
  return parameters.getParameterValue(name);
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

@Override
protected void respond(AjaxRequestTarget target) {
  final RequestCycle requestCycle = RequestCycle.get();
  StringValue position = requestCycle.getRequest().getRequestParameters().getParameterValue("position");
  if (!position.isNull()) {
    final String strPos = position.toString();
    if (!Strings.isEmpty(strPos)) {
      onToggleFromClient(strPos, toggle(strPos));
    }
  }
}

代码示例来源: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.wicketstuff/wicketstuff-shiro

/**
   * {@inheritDoc}
   */
  @Override
  protected HttpServletRequest load()
  {
    return (HttpServletRequest)RequestCycle.get().getRequest().getContainerRequest();
  }
}

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

@Override
protected void respond(final AjaxRequestTarget target)
{
  final RequestCycle requestCycle = RequestCycle.get();
  final String val = requestCycle.getRequest()
    .getRequestParameters()
    .getParameterValue(settings.getParameterName())
    .toOptionalString();
  onRequest(val, requestCycle);
}

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

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

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

@Override
protected void respond(AjaxRequestTarget target)
{
  String windowName = getComponent().getRequest().getRequestParameters().getParameterValue(PARAM_WINDOW_NAME).toString();
  if (boundName == null)
  {
    // not bound to any window yet
    if (Strings.isEmpty(windowName))
    {
      // create new name
      windowName = newWindowName();
      target.appendJavaScript(String.format("window.name = '%s';", windowName));
    }
    // now bound to window
    boundName = windowName;
  }
  else if (boundName.equals(windowName) == false)
  {
    onNewWindow(target);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-engine

@Override
protected void onBeforeRender() {
  super.onBeforeRender();
  Request request = RequestCycle.get().getRequest();
  /**
   * Strip the first query parameter from URL if it is empty
   * Copied from {@link AbstractComponentMapper#removeMetaParameter}
   */
  Url urlCopy = new Url(request.getUrl());
  if (!urlCopy.getQueryParameters().isEmpty() &&
      Strings.isEmpty(urlCopy.getQueryParameters().get(0).getValue())) {
    String pageComponentInfoCandidate = urlCopy.getQueryParameters().get(0).getName();
    if (PageComponentInfo.parse(pageComponentInfoCandidate) != null) {
      urlCopy.getQueryParameters().remove(0);
    }
  }
  parameters = new PageParametersEncoder().decodePageParameters(urlCopy);
}

代码示例来源:origin: org.jabylon/rest.ui

/**
 *
 * @return the web context or "" if mounted as /
 */
public static String getContextPath()
{
  String path = RequestCycle.get().getRequest().getFilterPath();
  if(path==null || path.isEmpty())
    return "";
  return path;
}

代码示例来源: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: org.apache.wicket/wicket-core

/**
 * Build value to Origin header based on RequestCycle Url
 *
 * @return Origin header
 */
protected String createOriginHeader(){
  Url url = RequestCycle.get().getRequest().getUrl();
  return url.getProtocol() + "://" +url.getHost() + ":" + url.getPort();
}

代码示例来源:origin: com.googlecode.wicket-jquery-ui/wicket-jquery-ui-core

/**
 * Indicates whether the query contains the specified parameter
 *
 * @param name the name of the query parameter
 * @return {@code true} if the parameter is found
 */
public static boolean hasQueryParameter(final String name)
{
  final RequestCycle requestCycle = RequestCycle.get();
  final IRequestParameters parameters = requestCycle.getRequest().getQueryParameters();
  return parameters.getParameterNames().stream().anyMatch(name::equals);
}

代码示例来源:origin: com.googlecode.wicket-jquery-ui/wicket-jquery-ui-core

/**
 * Gets the values of a query parameter
 *
 * @param name the name of the query parameter
 * @return a {@link List} of {@link StringValue}
 */
public static List<StringValue> getQueryParameterValues(String name)
{
  final RequestCycle requestCycle = RequestCycle.get();
  final IRequestParameters parameters = requestCycle.getRequest().getQueryParameters();
  return parameters.getParameterValues(name);
}

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

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

代码示例来源:origin: com.googlecode.wicket-jquery-ui/wicket-jquery-ui-core

/**
 * Gets the values of a post parameter
 *
 * @param name the name of the post parameter
 * @return a {@link List} of {@link StringValue}
 */
public static List<StringValue> getPostParameterValues(String name)
{
  final RequestCycle requestCycle = RequestCycle.get();
  final IRequestParameters parameters = requestCycle.getRequest().getPostParameters();
  return parameters.getParameterValues(name);
}

代码示例来源:origin: OrienteerBAP/Orienteer

private boolean isActiveItem(IModel<String> urlModel) {
    String currentUrl = RequestCycle.get().getRequest().getUrl().getPath();
    String url = urlModel.getObject();
    return url!=null && currentUrl.equals(url.replaceFirst("^/", ""));
  }
}

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

public SpecialKeys(final Request request) {
  String rawKeys = request.getRequestParameters().getParameterValue("keys").toString();
  if (rawKeys != null && rawKeys.length() > 0) {
    String[] strings = Strings.split(rawKeys, ',');
    for (String string : strings)
      this.specialKeys.add(SpecialKey.getSpecialKey(string));
  }
}

相关文章