io.micronaut.http.HttpRequest.setAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中io.micronaut.http.HttpRequest.setAttribute()方法的一些代码示例,展示了HttpRequest.setAttribute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.setAttribute()方法的具体详情如下:
包路径:io.micronaut.http.HttpRequest
类名称:HttpRequest
方法名:setAttribute

HttpRequest.setAttribute介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

request.setAttribute(HttpAttributes.ROUTE_MATCH, routeMatch);
request.setAttribute(HttpAttributes.ROUTE, routeMatch.getRoute());
this.eventPublisher = eventPublisher;
this.handshaker = handshaker;

代码示例来源:origin: micronaut-projects/micronaut-core

} else if (uriRoutes.size() == 1) {
  UriRouteMatch<Object, Object> establishedRoute = uriRoutes.get(0);
  request.setAttribute(HttpAttributes.ROUTE, establishedRoute.getRoute());
  request.setAttribute(HttpAttributes.ROUTE_MATCH, establishedRoute);
  request.setAttribute(HttpAttributes.URI_TEMPLATE, establishedRoute.getRoute().getUriMatchTemplate().toString());
  routeMatch = Optional.of(establishedRoute);

代码示例来源:origin: micronaut-projects/micronaut-core

httpRequest.setAttribute(HttpAttributes.ROUTE_MATCH, routeMatch);

代码示例来源:origin: micronaut-projects/micronaut-spring

@Override
  public BindingResult<ModelMap> bind(ArgumentConversionContext<ModelMap> context, HttpRequest<?> source) {
    final Optional<ModelMap> attribute = source.getAttribute(ATTRIBUTE, ModelMap.class);
    if (!attribute.isPresent()) {
      final ModelMap modelMap = new ModelMap();
      source.setAttribute(ATTRIBUTE, modelMap);
      return () -> Optional.of(modelMap);
    }
    return () -> attribute;
  }
}

代码示例来源:origin: micronaut-projects/micronaut-spring

@Override
public BindingResult<Model> bind(ArgumentConversionContext<Model> context, HttpRequest<?> source) {
  final Optional<Model> attribute = source.getAttribute(ATTRIBUTE, Model.class);
  if (!attribute.isPresent()) {
    final ConcurrentModel concurrentModel = new ConcurrentModel();
    source.setAttribute(ATTRIBUTE, concurrentModel);
    return () -> Optional.of(concurrentModel);
  }
  return () -> attribute;
}

相关文章