All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.smartcosmos.concurrent.AbstractDelegatingRequestAttributesSupport Maven / Gradle / Ivy

Go to download

Provides Spring Configuration and Annotations making it easier to develop SMART COSMOS Extensions

The newest version!
package net.smartcosmos.concurrent;

import java.util.concurrent.Callable;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.servlet.support.RequestContext;

/**
 * An internal support class that wraps {@link Callable} with
 * {@link DelegatingRequestAttributesCallable} and {@link Runnable} with
 * {@link DelegatingRequestAttributesRunnable}
 *
 * @see Class org.springframework.security.concurrent.AbstractDelegatingSecurityContextSupport
 * @author Robert Van Voorhees
 */
public class AbstractDelegatingRequestAttributesSupport {

    private final RequestAttributes requestAttributes;

    /**
     * Creates a new {@link AbstractDelegatingRequestAttributesSupport} that uses the
     * specified {@link RequestContext}.
     *
     * @param requestAttributes the {@link RequestContext} to use for each
     * {@link DelegatingRequestAttributesRunnable} and each
     * {@link DelegatingRequestAttributesCallable} or null to default to the current
     * {@link RequestContext}.
     */
    AbstractDelegatingRequestAttributesSupport(RequestAttributes requestAttributes) {
        this.requestAttributes = requestAttributes;
    }

    protected final Runnable wrap(Runnable delegate) {
        return DelegatingRequestAttributesRunnable.create(delegate, requestAttributes);
    }

    protected final  Callable wrap(Callable delegate) {
        return DelegatingRequestAttributesCallable.create(delegate, requestAttributes);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy