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

com.alachisoft.ncache.web.ProxyResponse Maven / Gradle / Ivy

package com.alachisoft.ncache.web;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import org.apache.log4j.Logger;

public class ProxyResponse extends HttpServletResponseWrapper
{
    //private String ncacheSessionId = null; - sajid
    private String ncacheSessionId = null;
    private Logger logger = Logger.getLogger(ProxyRequest.class);

    //--------------------------------------------------------------------------------------------------------
    public ProxyResponse(HttpServletResponse response)
    {
        super(response);
    }
    //--------------------------------------------------------------------------------------------------------
    @Override
    public String encodeURL(String url)
    {
        String encUrl = super.encodeURL(url);
        if (!encUrl.equals(url) && ncacheSessionId != null && ncacheSessionId.length() > 0)
        {
            encUrl += ";" + ProxyRequest.NCACHE_SESSION_ID + "=" + ncacheSessionId;
        }
        return encUrl;
    }
    //--------------------------------------------------------------------------------------------------------
    @Override
    public String encodeRedirectURL(String url)
    {
        String encUrl = super.encodeRedirectURL(url);
        if (!encUrl.equals(url) && ncacheSessionId != null && ncacheSessionId.length() > 0)
        {
            encUrl += ";" + ProxyRequest.NCACHE_SESSION_ID + "=" + ncacheSessionId;
        }
        return encUrl;
    }
    //--------------------------------------------------------------------------------------------------------
    public void setRemoteSessionId(String id)
    {
        logger.debug("Remote session id is: " + id);
        this.ncacheSessionId = id;
    }
    //--------------------------------------------------------------------------------------------------------
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy