本文整理了Java中org.jboss.resteasy.spi.HttpResponse.getOutputHeaders()
方法的一些代码示例,展示了HttpResponse.getOutputHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.getOutputHeaders()
方法的具体详情如下:
包路径:org.jboss.resteasy.spi.HttpResponse
类名称:HttpResponse
方法名:getOutputHeaders
暂无
代码示例来源: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
public void doWrite(Object toOutput, Class type, Type genericType,
MediaType mediaType, Annotation[] annotations,
MultivaluedMap<String, Object> requestHeaders,
OutputStream outputStream) throws IOException
{
final Map<String, Object> attributes = new HashMap<String, Object>();
AbstractWriterInterceptorContext messageBodyWriterContext = new ClientWriterInterceptorContext(interceptors, factory, toOutput, type,
genericType, annotations, mediaType, requestHeaders, outputStream, attributes);
messageBodyWriterContext
.proceed();
}
代码示例来源:origin: resteasy/Resteasy
public Variant selectVariant(List<Variant> variants) throws IllegalArgumentException
{
if (variants == null || variants.size() == 0) throw new IllegalArgumentException(MESSAGES.variantListMustNotBeZero());
ServerDrivenNegotiation negotiation = new ServerDrivenNegotiation();
MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders();
negotiation.setAcceptHeaders(requestHeaders.get(ACCEPT));
negotiation.setAcceptCharsetHeaders(requestHeaders.get(ACCEPT_CHARSET));
negotiation.setAcceptEncodingHeaders(requestHeaders.get(ACCEPT_ENCODING));
negotiation.setAcceptLanguageHeaders(requestHeaders.get(ACCEPT_LANGUAGE));
varyHeader = ResponseBuilderImpl.createVaryHeader(variants);
response.getOutputHeaders().add(VARY, varyHeader);
return negotiation.getBestMatch(variants);
}
代码示例来源:origin: resteasy/Resteasy
response.setStatus(HttpResponseCodes.SC_ACCEPTED);
URI uri = request.getUri().getBaseUriBuilder().path(basePath).path(id).build();
response.getOutputHeaders().add(HttpHeaderNames.LOCATION, uri);
代码示例来源:origin: resteasy/Resteasy
private void writeException(Throwable t)
{
/*
* Here we cannot call AsyncResponse.resume(t) because that would invoke the response filters
* and we should not invoke them because we're already in them.
*/
HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class);
SynchronousDispatcher dispatcher = (SynchronousDispatcher) contextDataMap.get(Dispatcher.class);
ResteasyAsynchronousResponse asyncResponse = request.getAsyncContext().getAsyncResponse();
RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request);
tracingLogger.flush(httpResponse.getOutputHeaders());
dispatcher.unhandledAsynchronousException(httpResponse, t);
onComplete.accept(t);
asyncResponse.complete();
asyncResponse.completionCallbacks(t);
}
代码示例来源:origin: resteasy/Resteasy
response.getOutputHeaders().add(javax.ws.rs.core.HttpHeaders.SET_COOKIE, next);
it.remove();
&& jaxrsResponse.getMetadata().size() > 0)
response.getOutputHeaders().putAll(jaxrsResponse.getMetadata());
代码示例来源:origin: resteasy/Resteasy
if (!bufferExceptionEntity)
response.getOutputHeaders().add("resteasy.buffer.exception.entity", "false");
RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request);
tracingLogger.log("FINISHED", response.getStatus());
tracingLogger.flush(response.getOutputHeaders());
代码示例来源:origin: resteasy/Resteasy
if (mediaType == null || !mediaTypeSet)
Object o = response.getOutputHeaders().getFirst("Content-Type");
if (o != null)
代码示例来源:origin: resteasy/Resteasy
protected void writeResponse(HttpRequest request, HttpResponse response, Response jaxrsResponse)
{
try
{
ServerResponseWriter.writeNomapResponse((BuiltResponse) jaxrsResponse, request, response, providerFactory,
t -> {
if(t != null)
writeException(request, response, t, t2 -> {});
});
}
catch (Exception e)
{
//logger.error("writeResponse() failed mapping exception", e);
writeException(request, response, e, t -> {});
}
finally {
RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request);
tracingLogger.log("FINISHED", response.getStatus());
tracingLogger.flush(response.getOutputHeaders());
}
}
代码示例来源:origin: resteasy/Resteasy
Object o = httpResponse.getOutputHeaders().getFirst("Content-Type");
if (o != null)
代码示例来源:origin: resteasy/Resteasy
tracingLogger.flush(response.getOutputHeaders());
writeResponse(request, response, aborted);
return;
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
public Variant selectVariant(List<Variant> variants) throws IllegalArgumentException
{
if (variants == null || variants.size() == 0) throw new IllegalArgumentException(MESSAGES.variantListMustNotBeZero());
ServerDrivenNegotiation negotiation = new ServerDrivenNegotiation();
MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders();
negotiation.setAcceptHeaders(requestHeaders.get(ACCEPT));
negotiation.setAcceptCharsetHeaders(requestHeaders.get(ACCEPT_CHARSET));
negotiation.setAcceptEncodingHeaders(requestHeaders.get(ACCEPT_ENCODING));
negotiation.setAcceptLanguageHeaders(requestHeaders.get(ACCEPT_LANGUAGE));
varyHeader = ResponseBuilderImpl.createVaryHeader(variants);
response.getOutputHeaders().add(VARY, varyHeader);
return negotiation.getBestMatch(variants);
}
代码示例来源:origin: org.jboss.resteasy/resteasy-core
public void doWrite(Object toOutput, Class type, Type genericType,
MediaType mediaType, Annotation[] annotations,
MultivaluedMap<String, Object> requestHeaders,
OutputStream outputStream) throws IOException
{
final Map<String, Object> attributes = new HashMap<String, Object>();
AbstractWriterInterceptorContext messageBodyWriterContext = new ClientWriterInterceptorContext(interceptors, factory, toOutput, type,
genericType, annotations, mediaType, requestHeaders, outputStream, attributes);
messageBodyWriterContext
.proceed();
}
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
public void doWrite(Object toOutput, Class type, Type genericType,
MediaType mediaType, Annotation[] annotations,
MultivaluedMap<String, Object> requestHeaders,
OutputStream outputStream) throws IOException
{
final Map<String, Object> attributes = new HashMap<String, Object>();
AbstractWriterInterceptorContext messageBodyWriterContext = new ClientWriterInterceptorContext(interceptors, factory, toOutput, type,
genericType, annotations, mediaType, requestHeaders, outputStream, attributes);
messageBodyWriterContext
.proceed();
}
代码示例来源:origin: org.jboss.resteasy/resteasy-core
public Variant selectVariant(List<Variant> variants) throws IllegalArgumentException
{
if (variants == null || variants.size() == 0) throw new IllegalArgumentException(MESSAGES.variantListMustNotBeZero());
ServerDrivenNegotiation negotiation = new ServerDrivenNegotiation();
MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders();
negotiation.setAcceptHeaders(requestHeaders.get(ACCEPT));
negotiation.setAcceptCharsetHeaders(requestHeaders.get(ACCEPT_CHARSET));
negotiation.setAcceptEncodingHeaders(requestHeaders.get(ACCEPT_ENCODING));
negotiation.setAcceptLanguageHeaders(requestHeaders.get(ACCEPT_LANGUAGE));
varyHeader = ResponseBuilderImpl.createVaryHeader(variants);
response.getOutputHeaders().add(VARY, varyHeader);
return negotiation.getBestMatch(variants);
}
代码示例来源:origin: org.jboss.resteasy/resteasy-core
response.setStatus(HttpResponseCodes.SC_ACCEPTED);
URI uri = request.getUri().getBaseUriBuilder().path(basePath).path(id).build();
response.getOutputHeaders().add(HttpHeaderNames.LOCATION, uri);
代码示例来源:origin: org.jboss.resteasy/resteasy-core
private void writeException(Throwable t)
{
/*
* Here we cannot call AsyncResponse.resume(t) because that would invoke the response filters
* and we should not invoke them because we're already in them.
*/
HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class);
SynchronousDispatcher dispatcher = (SynchronousDispatcher) contextDataMap.get(Dispatcher.class);
ResteasyAsynchronousResponse asyncResponse = request.getAsyncContext().getAsyncResponse();
RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request);
tracingLogger.flush(httpResponse.getOutputHeaders());
dispatcher.unhandledAsynchronousException(httpResponse, t);
onComplete.accept(t);
asyncResponse.complete();
asyncResponse.completionCallbacks(t);
}
代码示例来源:origin: org.jboss.resteasy/resteasy-core
response.getOutputHeaders().add(javax.ws.rs.core.HttpHeaders.SET_COOKIE, next);
it.remove();
&& jaxrsResponse.getMetadata().size() > 0)
response.getOutputHeaders().putAll(jaxrsResponse.getMetadata());
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
if (!bufferExceptionEntity)
response.getOutputHeaders().add("resteasy.buffer.exception.entity", "false");
代码示例来源:origin: org.jboss.resteasy/resteasy-core
protected void writeResponse(HttpRequest request, HttpResponse response, Response jaxrsResponse)
{
try
{
ServerResponseWriter.writeNomapResponse((BuiltResponse) jaxrsResponse, request, response, providerFactory,
t -> {
if(t != null)
writeException(request, response, t, t2 -> {});
});
}
catch (Exception e)
{
//logger.error("writeResponse() failed mapping exception", e);
writeException(request, response, e, t -> {});
}
finally {
RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request);
tracingLogger.log("FINISHED", response.getStatus());
tracingLogger.flush(response.getOutputHeaders());
}
}
内容来源于网络,如有侵权,请联系作者删除!