org.glassfish.grizzly.http.server.Request.getPathInfo()方法的使用及代码示例

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

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

Request.getPathInfo介绍

[英]Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the HttpHandler path but precedes the query string. This method returns null if there was no extra path information.
[中]返回与客户端发出此请求时发送的URL相关的任何额外路径信息。额外的路径信息位于HttpHandler路径之后,但位于查询字符串之前。如果没有额外的路径信息,此方法将返回null。

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

public OTPRequest (Request req, Graph graph) {
  this.graph = graph;
  for (String key : req.getParameterNames()) {
    params.put(key, req.getParameter(key));
  }
  String path = req.getPathInfo();
  sfmt = SerializeFormat.JSON;
  if (req.getHeader("Accept").contains("application/xml")) {
    sfmt = SerializeFormat.XML;
  }
  if (req.getHeader("Accept").contains("application/json")) {
    sfmt = SerializeFormat.JSON;
  }
  if (path.endsWith(".xml")) {
    path = path.substring(0, path.length() - 4);
    sfmt = SerializeFormat.XML;
  };
  if (path.endsWith(".json")) {
    path = path.substring(0, path.length() - 5);
    sfmt = SerializeFormat.JSON;
  };
  parts = path.split("/");
  // path always begins with a slash, so part 0 is empty
  if (parts.length > 1) action = parts[1];
  if (parts.length > 2) id = parts[2];
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

String[] pathComponents = request.getPathInfo().split("/");

代码示例来源:origin: javaee/grizzly

@Override
@Property(MessageContext.PATH_INFO)
public String getPathInfo() {
  return request.getPathInfo();
}

代码示例来源:origin: org.activecomponents.jadex/jadex-platform-extension-webservice-desktop-grizzly

String pi = request.getPathInfo();

相关文章

微信公众号

最新文章

更多

Request类方法