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

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

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

Request.getUrl介绍

[英]Returns the URL for this request. URL is relative to Wicket filter path.
[中]返回此请求的URL。URL是相对于Wicket筛选器路径的。

代码示例

代码示例来源: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: stackoverflow.com

@Override
public Response execute(Request request) throws IOException {
  URI uri = URI.create(request.getUrl());
  String responseString = "";
  return new Response(request.getUrl(), 200, "nothing", Collections.EMPTY_LIST,
      new TypedByteArray("application/json", responseString.getBytes()));

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

/**
 * In case this request has been created using {@link #cloneWithUrl(Url)}, this method should
 * return the original URL.
 * 
 * @return original URL
 */
public Url getOriginalUrl()
{
  return getUrl();
}

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

/**
 * In case this request has been created using {@link #cloneWithUrl(Url)}, this method should
 * return the original URL.
 * 
 * @return original URL
 */
public Url getOriginalUrl()
{
  return getUrl();
}

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

@Override
public int getCompatibilityScore(Request request)
{
  Url url = request.getUrl();
  int score = -1;
  if (canBeHandled(url))
  {
    score = 1;
  }
  return score;
}

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

@Override
public int getCompatibilityScore(Request request)
{
  Url url = request.getUrl();
  int score = -1;
  if (canBeHandled(url))
  {
    score = 1;
  }
  return score;
}

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

/**
 * @return GET request parameters for this request.
 */
public IRequestParameters getQueryParameters()
{
  return new UrlRequestParametersAdapter(getUrl());
}

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

/**
 * @return GET request parameters for this request.
 */
public IRequestParameters getQueryParameters()
{
  return new UrlRequestParametersAdapter(getUrl());
}

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

protected boolean isActive() {
  Pattern onlyLetters = Pattern.compile("[^a-zA-Z0-9]");
  String contextPath = WebApplication.get().getServletContext().getContextPath();
  if (!contextPath.endsWith("/")) {
    contextPath += "/";
  }
  String url = onlyLetters.matcher(contextPath + getRequest().getUrl()).replaceAll("");
  String thisUrl = onlyLetters.matcher(menuItemUrl).replaceAll("");
  return url.endsWith(thisUrl);
}

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

Client client = new Client() {
  @Override public Response execute(Request request) throws IOException {
    final String reason = "Some reason.";
    final List<Header> headers = new ArrayList<>();
    final TypedString body = new TypedString("");//could be json or what ever you want
    final int status = 401;
    return new Response(request.getUrl(), status, reason, headers, body);
  }
};

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

@Override
public int getCompatibilityScore(Request request) {
  if (isInternalWicket(request)) {
    return 0;
  }
  // bluff we can parse all segments - makes sure we run first
  return request.getUrl().getSegments().size();
}

代码示例来源: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: com.github.javawithmarcus.wicket-cdi-1.1/wicket-cdi-1.1-core

@Override
  public void onDetach(RequestCycle cycle)
  {
    if (Boolean.TRUE.equals(cycle.getMetaData(DETACH_SCHEDULED_KEY)))
    {
      logger.debug("Firing Detach event {}", cycle.getRequest().getUrl());

      detachEvent.fire(new DetachEvent());

      cycle.setMetaData(DETACH_SCHEDULED_KEY, null);
    }
  }
}

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

@Override
  public void onDetach(RequestCycle cycle)
  {
    if (Boolean.TRUE.equals(cycle.getMetaData(DETACH_SCHEDULED_KEY)))
    {
      logger.debug("Firing Detach event {}", cycle.getRequest().getUrl());

      detachEvent.fire(new DetachEvent());

      cycle.setMetaData(DETACH_SCHEDULED_KEY, null);
    }
  }
}

代码示例来源:origin: net.ftlines.wicket-cdi/wicket-cdi

@Override
  public void onDetach(RequestCycle cycle)
  {
    if (Boolean.TRUE.equals(cycle.getMetaData(DETACH_SCHEDULED_KEY)))
    {
      logger.debug("Firing Detach event {}", cycle.getRequest().getUrl());

      detachEvent.fire(new DetachEvent());
      
      cycle.setMetaData(DETACH_SCHEDULED_KEY, null);
    }
  }
}

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

private boolean isInternalWicket(Request request) {
  Url url = request.getUrl();
  if (url.getSegments().size() > 0) {
    if (url.getSegments().get(0).equals((Application.get().getMapperContext().getNamespace()))) {
      // starts with wicket namespace - is an internal wicket url
      return true;
    }
  }
  return false;
}

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

private String mountLogoutPathWithRequectCycle(RequestCycle requestCycle, String baseUrl) {
  Request    request    = requestCycle.getRequest();
  Url        url        = request.getUrl();
  UrlToolkit urlToolkit = urlToolkitBuilder.build(url);
  Optional<String> filterPath = Optional.ofNullable(request.getFilterPath());
  String logoutPath = urlToolkit.concatServerAdressWithContext(baseUrl);
  logoutPath += "?service=" + urlToolkit.concatServerAdressWithContext(contextPath + filterPath.orElse(""));
  return logoutPath;
}

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

@Override
  public IRequestablePage newPageInstance(Class<? extends IRequestablePage> pageClass, PageParameters pageParameters) {
    return new PageRenderingPage(new BrixNodeModel(getNodeForUriPath(finalPath)),
        createBrixPageParams(request.getUrl(), finalPath));
  }
});

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

/**
 * 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();
}

相关文章