Search in sources :

Example 1 with Cleanable

use of org.jboss.resteasy.plugins.server.Cleanable in project resteasy by resteasy.

the class SseEventOutputImpl method clearContextData.

public void clearContextData() {
    Map<Class<?>, Object> map = ResteasyContext.getContextDataMap(false);
    Cleanables cleanables = map != null ? (Cleanables) map.get(Cleanables.class) : null;
    if (cleanables != null) {
        for (Iterator<Cleanable> it = cleanables.getCleanables().iterator(); it.hasNext(); ) {
            try {
                it.next().clean();
            } catch (Exception e) {
            // Empty
            }
        }
        ResteasyContext.clearContextData();
    }
}
Also used : Cleanables(org.jboss.resteasy.plugins.server.Cleanables) Cleanable(org.jboss.resteasy.plugins.server.Cleanable) ProcessingException(jakarta.ws.rs.ProcessingException) IOException(java.io.IOException) CompletionException(java.util.concurrent.CompletionException) UncheckedIOException(java.io.UncheckedIOException) ExecutionException(java.util.concurrent.ExecutionException)

Example 2 with Cleanable

use of org.jboss.resteasy.plugins.server.Cleanable in project resteasy by resteasy.

the class SynchronousDispatcher method clearContextData.

public void clearContextData() {
    Map<Class<?>, Object> map = ResteasyContext.getContextDataMap(false);
    Cleanables cleanables = map != null ? (Cleanables) map.get(Cleanables.class) : null;
    if (cleanables != null) {
        for (Iterator<Cleanable> it = cleanables.getCleanables().iterator(); it.hasNext(); ) {
            try {
                it.next().clean();
            } catch (Exception e) {
            // Empty
            }
        }
        ResteasyContext.clearContextData();
    }
    // just in case there were internalDispatches that need to be cleaned up
    MessageBodyParameterInjector.clearBodies();
}
Also used : Cleanables(org.jboss.resteasy.plugins.server.Cleanables) Cleanable(org.jboss.resteasy.plugins.server.Cleanable) NotFoundException(jakarta.ws.rs.NotFoundException) UnhandledException(org.jboss.resteasy.spi.UnhandledException) IOException(java.io.IOException) CompletionException(java.util.concurrent.CompletionException) InternalServerErrorException(org.jboss.resteasy.spi.InternalServerErrorException)

Aggregations

IOException (java.io.IOException)2 CompletionException (java.util.concurrent.CompletionException)2 Cleanable (org.jboss.resteasy.plugins.server.Cleanable)2 Cleanables (org.jboss.resteasy.plugins.server.Cleanables)2 NotFoundException (jakarta.ws.rs.NotFoundException)1 ProcessingException (jakarta.ws.rs.ProcessingException)1 UncheckedIOException (java.io.UncheckedIOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 InternalServerErrorException (org.jboss.resteasy.spi.InternalServerErrorException)1 UnhandledException (org.jboss.resteasy.spi.UnhandledException)1