@@ -0,0 +1,2020 @@
+package edu.wisc.my.webproxy.beans.interceptors;%0A%0Aimport javax.portlet.ActionRequest;%0Aimport javax.portlet.ActionResponse;%0Aimport javax.portlet.PortletPreferences;%0Aimport javax.portlet.PortletRequest;%0Aimport javax.portlet.RenderRequest;%0Aimport javax.portlet.RenderResponse;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A%0Aimport edu.wisc.my.webproxy.beans.config.ConfigUtils;%0Aimport edu.wisc.my.webproxy.beans.config.GeneralConfigImpl;%0Aimport edu.wisc.my.webproxy.beans.http.Request;%0A%0A/**%0A * Insures that every outgoing proxy request targets the configured BaseURL.%0A */%0Apublic final class BaseUrlOnlyPreInterceptor implements PreInterceptor %7B%0A%0A    private final Log log = LogFactory.getLog(getClass());%0A%0A    @Override%0A    public void intercept(RenderRequest req, RenderResponse res, Request httpReq) %7B%0A        enforce(req, httpReq);%0A    %7D%0A%0A    @Override%0A    public void intercept(ActionRequest req, ActionResponse res, Request httpReq) %7B%0A        enforce(req, httpReq);%0A    %7D%0A%0A    @Override%0A    public void intercept(HttpServletRequest request, HttpServletResponse response, Request httpResp) %7B%0A        log.warn(%22Invoking intercept() with HttpServletRequest/HttpServletResponse;  %22 +%0A                %22The BaseURL is not accessable since there is no access to the %22 +%0A                %22PortletRequest.USER_INFO map.%22);%0A        /*%0A         * Nothing we can do here...%0A         */%0A    %7D%0A    %0A    /*%0A     * Implementation%0A     */%0A%0A    private void enforce(final PortletRequest req, Request httpReq) %7B%0A%0A        final PortletPreferences prefs = req.getPreferences();%0A%0A        final String baseUrlString = ConfigUtils.checkEmptyNullString(prefs.getValue(GeneralConfigImpl.BASE_URL, null), null);%0A        if (baseUrlString == null) %7B%0A            throw new IllegalStateException(%22Preference '%22 + GeneralConfigImpl.BASE_URL + %22' not set%22);%0A        %7D%0A%0A        httpReq.setUrl(baseUrlString);%0A%0A    %7D%0A%0A%7D%0A

Add a PreInterceptor that can force the portlet to proxy only the BaseURL