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

com.enonic.xp.web.servlet.ServletRequestHolder Maven / Gradle / Ivy

The newest version!
package com.enonic.xp.web.servlet;

import javax.servlet.http.HttpServletRequest;

import com.enonic.xp.annotation.PublicApi;

@PublicApi
public final class ServletRequestHolder
{
    private static final ThreadLocal CURRENT_REQUEST = new ThreadLocal<>();

    public static HttpServletRequest getRequest()
    {
        return CURRENT_REQUEST.get();
    }

    public static void setRequest( final HttpServletRequest req )
    {
        if ( req == null )
        {
            CURRENT_REQUEST.remove();
        }
        else
        {
            CURRENT_REQUEST.set( req );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy