[opencms-dev] Weird inclusion issues with response.sendRedirect()

Matthew Evans matte at solidstategroup.com
Tue Jun 22 02:07:01 CEST 2004


Hi,
 
I've been trying to fix this bug all night and it's beate me.
I need help
 
I'm basically checking if someone is logged into the site based on OpenCMS
with this code:
 
<%@ page import="java.util.*,
                 com.opencms.flex.jsp.*,
                 com.opencms.file.*,
                 com.opencms.file.CmsUser" %>
 
<% 
 
com.opencms.flex.jsp.CmsJspActionElement cms = new
com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response);
CmsObject cmso = cms.getCmsObject();
boolean validated = false;
try { 
 
    Vector userGroups = cmso.getDirectGroupsOfUser(cms.user("name")); 
    CmsGroup thisGroup;
 
    for (Enumeration allGroups = userGroups.elements();
allGroups.hasMoreElements();) {
        thisGroup = (CmsGroup)allGroups.nextElement();
        if (thisGroup.getName().equals("Users")){
            validated = true;
        }
    }
 
} catch (Exception ex) {
  out.println("Error logging in");
}
 

if (!validated) { 
    out.println("redirecting to " + cms.link("/RGLIntranet/login.jsp"));
    //response.sendRedirect("/RGLIntranet/login.jsp");
}
%>
 
 
As you can see if they are not logged in as a user they are redirected to a
login page.
The problem is, if I uncomment the redirect line I get some kind of
inclusion loop error, but if I leave the line commented out it works
perfectly.
I've checked the login page to see if it is calling a template or anything
but it isn't so I dont know why it's complaining about an inclusion loop.
 
Anyone have any ideas? 
 
Cheers,
 
M at .
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040622/c61a9dfa/attachment.htm>


More information about the opencms-dev mailing list