本文整理了Java中org.jboss.resteasy.spi.HttpRequest.getMutableHeaders()
方法的一些代码示例,展示了HttpRequest.getMutableHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.getMutableHeaders()
方法的具体详情如下:
包路径:org.jboss.resteasy.spi.HttpRequest
类名称:HttpRequest
方法名:getMutableHeaders
暂无
代码示例来源:origin: weibocom/motan
@Override
public Response toResponse(Exception exception) {
HttpRequest httpRequest = ResteasyProviderFactory.getContextData(HttpRequest.class);
// 当为rpc调用时,序列化异常
if (httpRequest != null && RestfulUtil.isRpcRequest(httpRequest.getMutableHeaders())) {
return RestfulUtil.serializeError(exception);
}
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(exception.getMessage()).build();
}
代码示例来源:origin: weibocom/motan
@Override
public Object invoke(HttpRequest request, HttpResponse httpResponse, Object resource)
throws Failure, ApplicationException {
if (!Provider.class.isInstance(resource)) {
return super.invoke(request, httpResponse, resource);
}
Object[] args = injectArguments(request, httpResponse);
RestfulContainerRequest req = new RestfulContainerRequest();
req.setInterfaceName(method.getResourceClass().getClazz().getName());
req.setMethodName(method.getMethod().getName());
req.setParamtersDesc(ReflectUtil.getMethodParamDesc(method.getMethod()));
req.setArguments(args);
req.setHttpRequest(request);
req.setAttachments(RestfulUtil.decodeAttachments(request.getMutableHeaders()));
try {
Response resp = Provider.class.cast(resource).call(req);
RestfulUtil.encodeAttachments(httpResponse.getOutputHeaders(), resp.getAttachments());
return resp.getValue();
} catch (Exception e) {
if (e != null && e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new InternalServerErrorException("provider call process error:" + e.getMessage(), e);
}
}
代码示例来源:origin: resteasy/Resteasy
@Override
public MultivaluedMap<String, String> getMutableHeaders()
{
return delegate.getMutableHeaders();
}
代码示例来源:origin: resteasy/Resteasy
if (context.getHeaders().containsKey(HttpHeaders.VARY)) {
for (Object varyHeader : context.getHeaders().get(HttpHeaders.VARY)) {
if (request.getMutableHeaders().containsKey(varyHeader)) {
varyHeaders.addAll((String) varyHeader, request.getMutableHeaders().get(varyHeader));
代码示例来源:origin: org.jboss.resteasy/resteasy-core
@Override
public MultivaluedMap<String, String> getMutableHeaders()
{
return delegate.getMutableHeaders();
}
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
@Override
public MultivaluedMap<String, String> getMutableHeaders()
{
return delegate.getMutableHeaders();
}
代码示例来源:origin: Doccrazy/keycloak-protocol-cas
public MediaType selectResponseType() {
String format = uriInfo.getQueryParameters().getFirst(CASLoginProtocol.FORMAT_PARAM);
if (format != null && !format.isEmpty()) {
//if parameter is set, it overrides all header values (see spec section 2.5.1)
request.getMutableHeaders().putSingle(HttpHeaders.ACCEPT, "application/" + format.toLowerCase());
}
try {
Variant variant = restRequest.selectVariant(Variant.mediaTypes(MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_JSON_TYPE).build());
return variant == null ? MediaType.APPLICATION_XML_TYPE : variant.getMediaType();
} catch (BadRequestException e) {
//the default Accept header set by java.net.HttpURLConnection is invalid (cf. RESTEASY-960)
return MediaType.APPLICATION_XML_TYPE;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!