本文整理汇总了Java中play.mvc.Http.Request.getHeader方法的典型用法代码示例。如果您正苦于以下问题:Java Request.getHeader方法的具体用法?Java Request.getHeader怎么用?Java Request.getHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.mvc.Http.Request
的用法示例。
在下文中一共展示了Request.getHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRequest
import play.mvc.Http.Request; //导入方法依赖的package包/类
/**
* This method will be called on each request.
*
* @param request Request
* @param actionMethod Method
* @return Action
*/
@SuppressWarnings("rawtypes")
public Action onRequest(Request request, Method actionMethod) {
String messageId = request.getHeader(JsonKey.MESSAGE_ID);
ProjectLogger.log("method call start.." + request.path() + " " + actionMethod + " " + messageId,
LoggerEnum.INFO.name());
if (ProjectUtil.isStringNullOREmpty(messageId)) {
UUID uuid = UUID.randomUUID();
messageId = uuid.toString();
ProjectLogger.log("message id is not provided by client.." + messageId);
}
ExecutionContext.setRequestId(messageId);
return new ActionWrapper(super.onRequest(request, actionMethod));
}
示例2: RequestHeader
import play.mvc.Http.Request; //导入方法依赖的package包/类
/**
* Constructor RequestHeader
* @param request
* @return new RequestHeader Object
* @throws Exception
*/
public RequestHeader (Request request) throws Exception {
this.remoteAddress = request.remoteAddress();
this.requestType = RequestType.valueOf(request.method().toUpperCase() );
this.userAgent = request.getHeader("User-Agent");
this.httpAccept = request.getHeader("Accept");
this.headers = request.headers();
}