本文整理匯總了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();
});
}