本文整理了Java中org.glassfish.grizzly.http.server.Request.getPathInfo
方法的一些代码示例,展示了Request.getPathInfo
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getPathInfo
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Request
类名称: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();
内容来源于网络,如有侵权,请联系作者删除!