當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpServerRequest.uri方法代碼示例

本文整理匯總了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;
	}
 
開發者ID:troopson,項目名稱:etagate,代碼行數:17,代碼來源:RequestHelper.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:15,代碼來源:UriPathIncludeQueryElement.java

示例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;
	}
 
開發者ID:zandero,項目名稱:rest.vertx,代碼行數:15,代碼來源:ArgumentProvider.java

示例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();
}
 
開發者ID:zandero,項目名稱:rest.vertx,代碼行數:8,代碼來源:TestContextRest.java

示例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);
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:14,代碼來源:CommonArithmetic.java

示例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();
	});

}
 
開發者ID:troopson,項目名稱:etagate,代碼行數:28,代碼來源:RequestHandler.java


注:本文中的io.vertx.core.http.HttpServerRequest.uri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。