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

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

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

HttpRequest.getHttpHeaders介绍

暂无

代码示例

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

@Override
public HttpHeaders getHttpHeaders()
{
 return delegate.getHttpHeaders();
}

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

static String getHeaderString(HttpRequest request, String header) {
 if (request == null) {
   return null;
 }
 if (request.getHttpHeaders() != null) {
   return request.getHttpHeaders().getHeaderString(header);
 }
 return null;
}

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

@Override
public int getLength()
{
 return httpRequest.getHttpHeaders().getLength();
}

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

@Override
public List<Locale> getAcceptableLanguages()
{
 return httpRequest.getHttpHeaders().getAcceptableLanguages();
}

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

@Override
public String getHeaderString(String name)
{
 return httpRequest.getHttpHeaders().getHeaderString(name);
}

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

@Override
public MultivaluedMap<String, String> getHeaders()
{
 return httpRequest.getHttpHeaders().getRequestHeaders();
}

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

@Override
public Map<String, Cookie> getCookies()
{
 return httpRequest.getHttpHeaders().getCookies();
}

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

@Override
public Locale getLanguage()
{
 return httpRequest.getHttpHeaders().getLanguage();
}

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

private Locale getLocale(HttpRequest request) {
 if (request == null)
 {
   return null;
 }
 List<Locale> locales = request.getHttpHeaders().getAcceptableLanguages();
 Locale locale = locales == null || locales.isEmpty() ? null : locales.get(0);
 return locale;
}

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

@Override
public Date getDate()
{
 return httpRequest.getHttpHeaders().getDate();
}

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

@Override
public MediaType getMediaType()
{
 return httpRequest.getHttpHeaders().getMediaType();
}

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

@Override
public List<MediaType> getAcceptableMediaTypes()
{
 return httpRequest.getHttpHeaders().getAcceptableMediaTypes();
}

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

public RequestImpl(final HttpRequest request, final HttpResponse response)
{
 this.headers = request.getHttpHeaders();
 this.httpMethod = request.getHttpMethod().toUpperCase();
 this.request = request;
 this.response = response;
}

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

private MultivaluedMap<String, String> getHeaders(HttpRequest request)
{
 return request.getHttpHeaders().getRequestHeaders();
}

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

@Override
public CompletionStage<Object> inject(HttpRequest request, HttpResponse response, boolean unwrapAsync)
{
 List<String> list = request.getHttpHeaders().getRequestHeaders().get(paramName);
 return CompletableFuture.completedFuture(extractValues(list));
}

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

@Override
public CompletionStage<Object> inject(HttpRequest request, HttpResponse response, boolean unwrapAsync)
{
 Cookie cookie = request.getHttpHeaders().getCookies().get(paramName);
 if (type.equals(Cookie.class)) return CompletableFuture.completedFuture(cookie);
 if (cookie == null) return CompletableFuture.completedFuture(extractValues(null));
 List<String> values = new ArrayList<String>();
 values.add(cookie.getValue());
 return CompletableFuture.completedFuture(extractValues(values));
}

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

@Override
public void checkViolationsfromCDI(HttpRequest request)
{
 if (request == null)
 {
   return;
 }
 SimpleViolationsContainer violationsContainer = SimpleViolationsContainer.class.cast(request.getAttribute(SimpleViolationsContainer.class.getName()));
 if (violationsContainer != null && violationsContainer.size() > 0)
 {
   throw new ResteasyViolationExceptionImpl(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
 }
}

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

private MediaType resolveContentType(HttpRequest jaxrsRequest, MediaType mt)
{
 if (mt == null || MediaType.MEDIA_TYPE_WILDCARD.equals(mt.getType()))
 {
   List<MediaType> acceptableMediaTypes = jaxrsRequest.getHttpHeaders()
       .getAcceptableMediaTypes();
   if (contentType != null && isAcceptable(acceptableMediaTypes, contentType))
   {
    return contentType;
   }
   return MediaTypeHelper.getBestMatch(potentialContentTypes, acceptableMediaTypes);
 }
 return mt;
}

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

public static MockHttpRequest deepCopy(HttpRequest request) throws IOException
{
 MockHttpRequest mock = new MockHttpRequest();
 mock.uri = (ResteasyUriInfo) request.getUri();
 mock.httpHeaders = (ResteasyHttpHeaders) request.getHttpHeaders();
 mock.httpMethod = request.getHttpMethod();
 byte[] bytes = ReadFromStream.readFromStream(1024, request.getInputStream());
 mock.inputStream = new ByteArrayInputStream(bytes);
 return mock;
}

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

@Override
public void checkViolations(HttpRequest request)
{
 // Called from resteasy-jaxrs only if two argument version of isValidatable() returns true.
 SimpleViolationsContainer violationsContainer = getViolationsContainer(request, null);
 Object target = violationsContainer.getTarget();
 if (target != null && violationsContainer.isFieldsValidated())
 {
   if (violationsContainer != null && violationsContainer.size() > 0)
   {
    throw new ResteasyViolationExceptionImpl(violationsContainer, request.getHttpHeaders().getAcceptableMediaTypes());
   }
 }
}

相关文章