AW: [opencms-dev] CmsUser as a session variable

M Butcher mbutcher at grcomputing.net
Fri Aug 29 21:01:01 CEST 2003


Ben,

Not sure if I understand all of your problem, but in addition to Frank's
message I would add that you should look at the loginWebUser and
readWebUser methods as well. They are scoped to WebUser, and use a
different set of permissions than loginUser.

See the javadoc for more info.

Matt

On Fri, 2003-08-29 at 08:59, Frank Wunderlich wrote:
> Hi Ben,
> 
> I don't know why this exception is raised.
> 
> But why don't you use 
> 	cmso.loginUser(user,passwd)
> instead of 
> 	cmso.readUser(user,passwd)?
> 
> That way OpenCms automatically keeps the current user in the session.
> Regards,
> Frank.
> 
> 
> --
> Frank Wunderlich 
> Berlin . Germany
> www.frank-wunderlich.de
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: opencms-dev-admin at opencms.org 
> > [mailto:opencms-dev-admin at opencms.org] Im Auftrag von Ben Rometsch
> > Gesendet: Freitag, 29. August 2003 05:23
> > An: opencms-dev at opencms.org
> > Betreff: [opencms-dev] CmsUser as a session variable
> > 
> > 
> > Hi,
> > 
> > I have the following in a jsp page (it's the execution part 
> > of a user login
> > form):
> > 
> > ----------
> > 
> > <%@ page import="java.util.*,
> >                  com.opencms.flex.jsp.*,
> >                  com.opencms.file.*,
> >                  com.opencms.file.CmsUser" %>
> > 
> > <%
> >   if (request.getParameter("login") != null) {
> > 
> >     CmsJspActionElement cms = new 
> > CmsJspActionElement(pageContext, request,
> > response);
> >     CmsObject cmso = cms.getCmsObject();
> > 
> >     String username = request.getParameter("username");
> >     String password = request.getParameter("password");
> >     
> >     try { 
> >       CmsUser webUser = cmso.readUser(username,password);
> >       out.println("You are now logged in as " + username);
> >     } catch (Exception ex) {
> >       out.println("Error logging in");
> >     }
> >   }
> > %>
> > 
> > -----------
> > 
> > This is working fine. The problem I have is that I want to 
> > make the webUser instance session scoped. If I add the 
> > following underneath the page import:
> > 
> > <jsp:useBean id="webUser" class="com.opencms.file.CmsUser" 
> > scope="session"/>
> > 
> > And change the line:
> > 
> > CmsUser webUser = cmso.readUser(username,password);
> > 
> > To 
> > 
> > webUser = cmso.readUser(username,password);
> > 
> > I get an error:
> > 
> > 
> > javax.servlet.ServletException: Resource loader error in file 
> > '/RGLIntranet/login.jsp'
> > 
> > Root cause:
> > org.apache.jasper.JasperException
> > 	at 
> > org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
> > Wrapper.java:2
> > 54)
> > 	at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> > .java:295)
> > 	at 
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > 	at 
> > org.apache.catalina.core.ApplicationDispatcher.invoke(Applicat
> > ionDispatcher.
> > java:684)
> > 	at 
> > org.apache.catalina.core.ApplicationDispatcher.doInclude(Appli
> > cationDispatch
> > er.java:575)
> > 	at 
> > org.apache.catalina.core.ApplicationDispatcher.include(Applica
> > tionDispatcher
> > .java:498)
> > 	at 
> > com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> > xRequestDispat
> > cher.java:180)
> > 	at com.opencms.flex.CmsJspLoader.service(CmsJspLoader.java:955)
> > 	at 
> > com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> > xRequestDispat
> > cher.java:268)
> > 	at com.opencms.flex.CmsJspLoader.load(CmsJspLoader.java:567)
> > 	at 
> > com.opencms.flex.CmsJspLoader.initlaunch(CmsJspLoader.java:235)
> > 	at com.opencms.core.OpenCms.showResource(OpenCms.java:956)
> > 	at
> > com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:310)
> > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > 	at 
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(Application
> > FilterChain.java:247)
> > 	at 
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilterCh
> > ain.java:193)
> > 	at 
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValve.ja
> > va:256)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at 
> > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > ontextValve.ja
> > va:191)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at
> > org.apache.catalina.core.StandardContext.invoke(StandardContex
> > t.java:2416)
> > 	at 
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > Valve.java:180
> > )
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at 
> > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDi
> > spatcherValve.
> > java:171)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:641)
> > 	at 
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> > Valve.java:172
> > )
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:641)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at 
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > gineValve.java
> > :174)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at
> > org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.
> > java:223)
> > 	at
> > org.apache.coyote.http11.Http11Processor.process(Http11Process
> > or.java:601)
> > 	at 
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> > r.processConne
> > ction(Http11Protocol.java:392)
> > 	at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> > nt.java:565)
> > 	at 
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.jav
> > a:619)
> > 	at java.lang.Thread.run(Thread.java:534)
> > 
> > --------------- End of root cause.
> > 
> > 	at com.opencms.flex.CmsJspLoader.service(CmsJspLoader.java:962)
> > 	at 
> > com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> > xRequestDispat
> > cher.java:268)
> > 	at com.opencms.flex.CmsJspLoader.load(CmsJspLoader.java:567)
> > 	at 
> > com.opencms.flex.CmsJspLoader.initlaunch(CmsJspLoader.java:235)
> > 	at com.opencms.core.OpenCms.showResource(OpenCms.java:956)
> > 	at
> > com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:310)
> > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > 	at 
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(Application
> > FilterChain.java:247)
> > 	at 
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilterCh
> > ain.java:193)
> > 	at 
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValve.ja
> > va:256)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at 
> > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > ontextValve.ja
> > va:191)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at
> > org.apache.catalina.core.StandardContext.invoke(StandardContex
> > t.java:2416)
> > 	at 
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > Valve.java:180
> > )
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at 
> > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDi
> > spatcherValve.
> > java:171)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:641)
> > 	at 
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> > Valve.java:172
> > )
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:641)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at 
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > gineValve.java
> > :174)
> > 	at 
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.invok
> > eNext(StandardPipeline.java:643)
> > 	at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:480)
> > 	at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > 	at
> > org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.
> > java:223)
> > 	at
> > org.apache.coyote.http11.Http11Processor.process(Http11Process
> > or.java:601)
> > 	at 
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> > r.processConne
> > ction(Http11Protocol.java:392)
> > 	at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> > nt.java:565)
> > 	at 
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.jav
> > a:619)
> > 	at java.lang.Thread.run(Thread.java:534)
> > 
> > 
> > 
> > Does anyone know why this would be?
> > 
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, 
> > please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> > 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
-- 
M Butcher <mbutcher at grcomputing.net>



More information about the opencms-dev mailing list