Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jaxrs-dev] Client Filter Question

I'd like to foward this question I received today. Opinions?

 

 

Is it possible and valid to abort a running request using the exposed ClientRequestContext after the filter() method already exited?

 

// aborts request when exceeding timeout of 10s

@Override public void filter(ClientRequestContext requestContext) throws Exception {

  new Timer().schedule(new TimerTask() {

    @Override public void run() {

      requestContext.abortWith(Response.noContent().build());

    }

  }, 10_000);

}

 

 

Regards

-Markus

 


Back to the top