org.jboss.resteasy.spi.HttpRequest.setAttribute()方法的使用及代码示例

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

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

HttpRequest.setAttribute介绍

暂无

代码示例

代码示例来源:origin: resteasy/Resteasy

@Override
public void setAttribute(String name, Object value)
{
 delegate.setAttribute(name, value);
}

代码示例来源:origin: resteasy/Resteasy

@Override
public void setProperty(String name, Object object)
{
 httpRequest.setAttribute(name, object);
}

代码示例来源:origin: resteasy/Resteasy

@Override
public void setProperty(String name, Object object)
{
 if (object == null)
 {
   request.removeAttribute(name);
 }
 else
 {
   request.setAttribute(name, object);
 }
}

代码示例来源:origin: resteasy/Resteasy

@Override
public void setProperty(String name, Object object)
{
 if (object == null)
 {
   request.removeAttribute(name);
 }
 else
 {
   request.setAttribute(name, object);
 }
}

代码示例来源:origin: resteasy/Resteasy

protected SimpleViolationsContainer getViolationsContainer(HttpRequest request, Object target)
{
 if (request == null)
 {
   return new SimpleViolationsContainer(target);
 }
 SimpleViolationsContainer violationsContainer = SimpleViolationsContainer.class.cast(request.getAttribute(SimpleViolationsContainer.class.getName()));
 if (violationsContainer == null)
 {
   violationsContainer = new SimpleViolationsContainer(target);
   request.setAttribute(SimpleViolationsContainer.class.getName(), violationsContainer);
 }
 return violationsContainer;
}

代码示例来源:origin: resteasy/Resteasy

protected Validator getValidator(HttpRequest request)
{
 Validator v = Validator.class.cast(request.getAttribute(Validator.class.getName()));
 if (v == null) {
   Locale locale = getLocale(request);
   if (locale == null)
   {
    v = validatorFactory.getValidator();
   }
   else
   {
    MessageInterpolator interpolator = new LocaleSpecificMessageInterpolator(validatorFactory.getMessageInterpolator(), locale);
    v = validatorFactory.usingContext().messageInterpolator(interpolator).getValidator();
   }
   request.setAttribute(Validator.class.getName(), v);
 }
 return v;
}

代码示例来源:origin: resteasy/Resteasy

public CompletionStage<BuiltResponse> invoke(HttpRequest request, HttpResponse response, Object target)
{
 request.setAttribute(ResourceMethodInvoker.class.getName(), this);
 incrementMethodCount(request.getHttpMethod());
 ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
 if (method.getPath() != null)
 {
   uriInfo.pushMatchedURI(uriInfo.getMatchingPath());
 }
 uriInfo.pushCurrentResource(target);
 BuiltResponse rtn = invokeOnTarget(request, response, target);
 // FIXME: async
 return CompletableFuture.completedFuture(rtn);
}

代码示例来源:origin: resteasy/Resteasy

public CompletionStage<Object> invokeDryRun(HttpRequest request, HttpResponse response, Object target)
{
 request.setAttribute(ResourceMethodInvoker.class.getName(), this);
 incrementMethodCount(request.getHttpMethod());
 ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
 if (method.getPath() != null)
 {
   uriInfo.pushMatchedURI(uriInfo.getMatchingPath());
 }
 uriInfo.pushCurrentResource(target);
 return invokeOnTargetDryRun(request, response, target);
}

代码示例来源:origin: resteasy/Resteasy

request.setAttribute(RESTEASY_CHOSEN_ACCEPT, sortEntry.getAcceptType());
return sortEntry.match;

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

@Override
public void setAttribute(String name, Object value)
{
 delegate.setAttribute(name, value);
}

代码示例来源:origin: stackoverflow.com

import org.jboss.resteasy.plugins.providers.multipart.InputPart;

@Provider
@ServerInterceptor
public class ContentTypeSetterPreProcessorInterceptor implements
    PreProcessInterceptor {

  public ServerResponse preProcess(HttpRequest request,
      ResourceMethod method) throws Failure, WebApplicationException {
    request.setAttribute(InputPart.DEFAULT_CONTENT_TYPE_PROPERTY,
        "*/*; charset=UTF-8");
    return null;
  }

}

代码示例来源:origin: stackoverflow.com

@Provider
@ServerInterceptor
public class CharsetPreProcessInterceptor implements PreProcessInterceptor {

  @Override
  public ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure, WebApplicationException {
    request.setAttribute(InputPart.DEFAULT_CHARSET_PROPERTY, "charset=UTF-8");
    return null;
  }

}

代码示例来源:origin: org.jboss.resteasy/resteasy-core

@Override
public void setAttribute(String name, Object value)
{
 delegate.setAttribute(name, value);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-core

@Override
public void setProperty(String name, Object object)
{
 httpRequest.setAttribute(name, object);
}

代码示例来源:origin: resteasy/Resteasy

/**
* According to configuration/request header it initialize {@link RESTEasyTracingLogger} and put it to the request properties.
*
* @param configuration application-wide tracing configuration type and tracing level threshold.
* @param request       request instance to get runtime properties to store {@link RESTEasyTracingLogger} instance to
*                      if tracing support is enabled for the request.
*/
static void initTracingSupport(Configuration configuration,
                   HttpRequest request) {
 if (!TRACING.AVAILABLE || request.getAttribute(RESTEasyTracing.PROPERTY_NAME) != null)
   return;
 final RESTEasyTracingLogger tracingLogger;
 if (RESTEasyTracingUtils.isTracingSupportEnabled(RESTEasyTracingUtils.getRESTEasyTracingConfig(configuration), request)) {
   tracingLogger = RESTEasyTracingLogger.create(
       RESTEasyTracingUtils.getTracingThreshold(RESTEasyTracingUtils.getRESTEasyTracingThreshold(configuration), request),
       RESTEasyTracingUtils.getTracingLoggerNameSuffix(request),
        RESTEasyTracingUtils.getTracingInfoFormat(request));
 } else {
   tracingLogger = RESTEasyTracingLogger.empty();
 }
 request.setAttribute(RESTEasyTracing.PROPERTY_NAME, tracingLogger);
}

代码示例来源:origin: resteasy/Resteasy

request.setAttribute(GeneralValidator.class.getName(), validator);

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

@Override
public void setProperty(String name, Object object)
{
 if (object == null)
 {
   request.removeAttribute(name);
 }
 else
 {
   request.setAttribute(name, object);
 }
}

代码示例来源:origin: org.jboss.resteasy/resteasy-core

@Override
public void setProperty(String name, Object object)
{
 if (object == null)
 {
   request.removeAttribute(name);
 }
 else
 {
   request.setAttribute(name, object);
 }
}

代码示例来源:origin: org.jboss.resteasy/resteasy-core

@Override
public void setProperty(String name, Object object)
{
 if (object == null)
 {
   request.removeAttribute(name);
 }
 else
 {
   request.setAttribute(name, object);
 }
}

代码示例来源:origin: org.jboss.resteasy/resteasy-core

public CompletionStage<Object> invokeDryRun(HttpRequest request, HttpResponse response, Object target)
{
 request.setAttribute(ResourceMethodInvoker.class.getName(), this);
 incrementMethodCount(request.getHttpMethod());
 ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
 if (method.getPath() != null)
 {
   uriInfo.pushMatchedURI(uriInfo.getMatchingPath());
 }
 uriInfo.pushCurrentResource(target);
 return invokeOnTargetDryRun(request, response, target);
}

相关文章