@Override public boolean hasEntity() { return getMediaType() != null; }
@Override public synchronized void resume() { if(!suspended) throw new RuntimeException("Cannot resume: not suspended"); if(inFilter) { // suspend/resume within filter, same thread: just ignore and move on suspended = false; return; } ResteasyProviderFactory.pushContextDataMap(contextDataMap); // go on, but with proper exception handling try { filter(); }catch(Throwable t) { // don't throw to client writeException(t); } }
protected RequestMethodStats doPreProcess(PreMatchContainerRequestContext request) throws Failure, WebApplicationException { RequestMethodStats stats = new RequestMethodStats(); stats.uri = request.getUriInfo().getRequestUri().toString(); stats.method = request.getMethod(); stats.callStartTime = System.nanoTime(); try { stats.callStartTime = Long.parseLong(httpHeaders.getHeaderString(REQUEST_START_TIME_HEADER)); } catch (Exception e) { // ignore -- we just won't set call start time properly } try { stats.loginTime = Long.parseLong(httpHeaders.getHeaderString(REQUEST_LOGIN_TIME_HEADER)); } catch (Exception e) { // ignore -- we just won't set login time. } MultivaluedTreeMap.addAll(request.getHeaders(), stats.requestHeaders); MediaType mediaType = request.getMediaType(); if (mediaType != null && mediaType.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) { MultivaluedMap<String,String> formParameters = request.getHttpRequest().getDecodedFormParameters(); if (formParameters != null) MultivaluedTreeMap.addAll(formParameters, stats.formParameters); } request.setProperty(REQUEST_STATS_NAME, stats); return stats; }
requestContext = new PreMatchContainerRequestContext(request, requestFilters, () -> { continuation.run(); return null; }); aborted = requestContext.filter(); if(requestContext == null || !requestContext.startedContinuation())
public Response preprocess(HttpRequest request) { Response aborted = null; try { for (HttpRequestPreprocessor preprocessor : this.requestPreprocessors) { preprocessor.preProcess(request); } ContainerRequestFilter[] requestFilters = providerFactory.getContainerRequestFilterRegistry().preMatch(); // FIXME: support async PreMatchContainerRequestContext requestContext = new PreMatchContainerRequestContext(request, requestFilters, null); aborted = requestContext.filter(); } catch (Exception e) { //logger.error("Failed in preprocess, mapping exception", e); aborted = new ExceptionHandler(providerFactory, unwrappedExceptions).handleException(request, e); } return aborted; }
return null; BuiltResponse serverResponse = (BuiltResponse)getResponseAbortedWith(); if (serverResponse != null) else writeException(throwable); return null;