本文整理汇总了Java中io.vertx.core.http.HttpServerRequest.uri方法的典型用法代码示例。如果您正苦于以下问题:Java HttpServerRequest.uri方法的具体用法?Java HttpServerRequest.uri怎么用?Java HttpServerRequest.uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.http.HttpServerRequest
的用法示例。
在下文中一共展示了HttpServerRequest.uri方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: redirect
import io.vertx.core.http.HttpServerRequest; //导入方法依赖的package包/类
public static HttpServerResponse redirect(HttpServerRequest request,HttpServerResponse response,String page){
String uri = request.uri();
String mainpage= null;
// System.out.println("--->"+uri);
if(!"/".equals(uri))
mainpage=request.absoluteURI().replace(request.uri(), "")+page;
else{
if(page.startsWith("/"))
page = page.substring(1);
mainpage=request.absoluteURI()+page;
}
response.putHeader("Content-Type", "text/html;charset=utf-8");
response.putHeader("Location", mainpage);
response.setStatusCode(HttpStatus.See_OTher);
return response;
}
示例2: getFormattedElement
import io.vertx.core.http.HttpServerRequest; //导入方法依赖的package包/类
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
HttpServerRequest request = accessLogParam.getRoutingContext().request();
if (null == request) {
return EMPTY_RESULT;
}
String uri = request.uri();
if (StringUtils.isEmpty(uri)) {
return EMPTY_RESULT;
}
return uri;
}
示例3: getMatrixParam
import io.vertx.core.http.HttpServerRequest; //导入方法依赖的package包/类
private static String getMatrixParam(HttpServerRequest request, String name) {
// get URL ... and find ;name=value pair
String url = request.uri();
String[] items = url.split(";");
for (String item : items) {
String[] nameValue = item.split("=");
if (nameValue.length == 2 && nameValue[0].equals(name)) {
return nameValue[1];
}
}
return null;
}
示例4: getRoute
import io.vertx.core.http.HttpServerRequest; //导入方法依赖的package包/类
@GET
@Path("/context")
public String getRoute(@Context HttpServerResponse response, @Context HttpServerRequest request) {
response.setStatusCode(201);
return request.uri();
}
示例5: search
import io.vertx.core.http.HttpServerRequest; //导入方法依赖的package包/类
@Override
public Record search(final List<Record> records,
final RoutingContext context) {
final HttpServerRequest request = context.request();
// Input source
final String uri = request.uri();
final Optional<Record> hitted =
records.stream()
.filter(record -> isMatch(uri, record))
.findAny();
// Find valid;
return hitted.orElse(null);
}
示例6: handle
import io.vertx.core.http.HttpServerRequest; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext rc) {
HttpServerRequest clientRequest = rc.request();
String uri = clientRequest.uri();
uri = appObj.offsetUrl(uri);
appObj.takeRequest(rc, clientRequest, uri, ar -> {
HttpServerResponse clientResponse = rc.response();
if (ar.succeeded()) {
this.handle(clientRequest, clientResponse, ar.result());
} else {
if (ar.cause() instanceof TimeoutException)
clientResponse.setStatusCode(HttpStatus.Request_Timeout);
else
clientResponse.setStatusCode(HttpStatus.Service_Unavailable);
// ar.cause().printStackTrace();
}
if (!clientResponse.ended())
clientResponse.end();
});
}