Subsite-Filter leitet jetzt auch Frontpage der Subsite um (Ticket #1877).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2322 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
cba909a57d
commit
9c7a117618
|
|
@ -15,10 +15,8 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package com.arsdigita.subsite;
|
||||
|
||||
|
||||
// import com.arsdigita.subsite.Site;
|
||||
import javax.servlet.FilterChain;
|
||||
|
||||
|
|
@ -33,23 +31,25 @@ import com.arsdigita.web.BaseFilter;
|
|||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.navigation.NavigationContext;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.Web;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Package's main worker class, SubsiteFilter intercepts each incomming request
|
||||
* and checks if it matches a configured subsite address (name).
|
||||
* Package's main worker class, SubsiteFilter intercepts each incomming request and checks if it
|
||||
* matches a configured subsite address (name).
|
||||
*
|
||||
* SubsiteFilter class uses the standard servlet filter mechanism (servlet
|
||||
* specification 2.3 and beyond) so the servlet container ensures its
|
||||
* invocation.
|
||||
* SubsiteFilter class uses the standard servlet filter mechanism (servlet specification 2.3 and
|
||||
* beyond) so the servlet container ensures its invocation.
|
||||
*
|
||||
* Usage: SubsiteFilter has to be declared in the web.xml application configuration
|
||||
* file.
|
||||
* Usage: SubsiteFilter has to be declared in the web.xml application configuration file.
|
||||
*/
|
||||
public class SubsiteFilter extends BaseFilter {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
/**
|
||||
* A logger instance, primarily to assist debugging .
|
||||
*/
|
||||
private static final Logger s_log = Logger.getLogger(SubsiteFilter.class);
|
||||
|
||||
/**
|
||||
|
|
@ -86,12 +86,24 @@ public class SubsiteFilter extends BaseFilter {
|
|||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Got site " + site);
|
||||
}
|
||||
|
||||
if ((site != null) && ((sreq.getRequestURI() == null) || ("/".equals(sreq.getRequestURI())))) {
|
||||
final String redirectUrl =
|
||||
URL.there(sreq,
|
||||
site.getFrontPage().getPath()).
|
||||
toString();
|
||||
sresp.sendRedirect(redirectUrl);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sreq.setAttribute(SubsiteContext.SITE_REQUEST_ATTRIBUTE,
|
||||
site);
|
||||
sreq.setAttribute(NavigationContext.TEMPLATE_CONTEXT,
|
||||
site == null ? null :
|
||||
site.getTemplateContext());
|
||||
site == null ? null
|
||||
: site.getTemplateContext());
|
||||
|
||||
chain.doFilter(sreq, sresp);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue