本文整理了Java中org.glassfish.grizzly.http.server.Request.getRequestURL
方法的一些代码示例,展示了Request.getRequestURL
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getRequestURL
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Request
类名称:Request
方法名:getRequestURL
[英]Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
Because this method returns a StringBuilder
, not a String
, you can modify the URL easily, for example, to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
[中]重建客户端用于发出请求的URL。返回的URL包含协议、服务器名称、端口号和服务器路径,但不包括查询字符串参数。
由于此方法返回的是StringBuilder
,而不是String
,因此您可以轻松地修改URL,例如,添加查询参数。
此方法对于创建重定向消息和报告错误非常有用。
代码示例来源:origin: miltonio/milton2
@Override
public String getAbsoluteUrl() {
return wrapped.getRequestURL().toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-http-server
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: javaee/grizzly
private String composeReferrerHeader(final Request request) {
final StringBuilder sb = new StringBuilder(64);
final String queryString = request.getQueryString();
sb.append(request.getRequestURL());
if (queryString != null) {
sb.append('?').append(queryString);
}
return sb.toString();
}
代码示例来源:origin: org.activecomponents.jadex/jadex-platform-extension-webservice-desktop-grizzly
String full = request.getRequestURL().toString();
if(ctx!=null && full!=null)
代码示例来源:origin: com.xebialabs.restito/restito
/**
* Factory method
*/
public static Call fromRequest(final Request request) {
Call call = new Call();
call.request = request;
call.method = request.getMethod();
call.authorization = request.getAuthorization();
call.uri = request.getRequestURI();
call.contentType = request.getContentType();
call.url = request.getRequestURL().toString();
for (String headerName : request.getHeaderNames()) {
List<String> headers = new ArrayList<>();
request.getHeaders(headerName).forEach(headers::add);
call.headers.put(headerName, headers);
}
call.parameters = new HashMap<>(request.getParameterMap());
try {
call.postBody = request.getPostBody(999999).toStringContent(Charset.defaultCharset());
} catch (IOException e) {
throw new RuntimeException("Problem reading Post Body of HTTP call");
}
return call;
}
内容来源于网络,如有侵权,请联系作者删除!