You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Luca Zago <za...@libero.it> on 2002/09/18 13:56:03 UTC

Template for directory browsing + creating new roles

Hi,
- has somebody ever created a template to associate to webDav servlet?
In my opinion it's a tricky..because it does only a forward....then the
only solution for the template is building
another servlet..with different html format..inside.
- And what about creating new roles? when I create a user with a new
role I got the error:

Sep 2002 19:34:25 - org.apache.slide.common.Domain - WARNING - Service 
slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
mypackage.acl.slide.roles.SlideEditorImpl
org.apache.slide.common.ServiceAccessException: Service 
slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
mypackage.acl.slide.roles.
SlideEditorImpl

some ideas?
thank you in advance

Luca


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Template for directory browsing + creating new roles

Posted by Luca Zago <za...@libero.it>.
GREAT,Christopher!
It was a classpath issue. Putting the Roles classes in the 
common/classes, everything work fine.
It can be useful to other people, asking about the users.

Thanks again.

Christopher Lenz wrote:
> Luca Zago wrote:
> 
>> ok..about WebDav servlet..you are right. It was a misunderstanding of
>> mine.. Then if I use only jsp, and not a webDAV client, if I understand
>> wwll, the servlet is useless..I can use only taglib in jsp pages.
> 
> 
> Right.
> 
>> about the creaction of the a user with a customized role, the
>> SlideEditorImpl has the contructor you suggest me, even if it's not
>> called directly by me, after all when I create a user with an role
>> 'user' evrything works fine, and the contructor I call is that one
>> without parameters.
>> Here is the stack trace of the exception:
> 
> 
>> 18 Sep 2002 16:09:24 - org.apache.slide.common.Domain - WARNING -
>> Service slidestore.reference.JDBCDescriptorsStore@88df60 access error :
>> mypackage.acl.slide.roles.SlideEditorImpl
>> org.apache.slide.common.ServiceAccessException: Service
>> slidestore.reference.JDBCDescriptorsStore@88df60 access error :
>> mypackage.acl.slide.roles.SlideEditorImpl
>> org.apache.slide.common.ServiceAccessException: Service
>> slidestore.reference.JDBCDescriptorsStore@88df60 access error :
>> mypackage.acl.slide.roles.SlideEditorImpl at 
>> slidestore.reference.JDBCDescriptorsStore.retrieveObject(JDBCDescriptorsStore.java:683) 
> 
> 
> 
> Okay, this is pretty clear. The JDBC store fails to instantiate your 
> SlideEditorImpl class. Again, it must be public and the constructor with 
> the parameters must be public.
> 
> Maybe this is a classpath issue. For example, if you have 
> slide-stores.jar in $TOMCAT_HOME/common/lib, the SlideEditorImpl must 
> also be loadable by the common class loader. I.e., if it is only in the 
> web-app classpath or shared classpath, loading it from the JDBC store 
> will fail.
> 
> Hope this helps.
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Template for directory browsing + creating new roles

Posted by Christopher Lenz <cm...@gmx.de>.
Luca Zago wrote:
> ok..about WebDav servlet..you are right. It was a misunderstanding of
> mine.. Then if I use only jsp, and not a webDAV client, if I understand
> wwll, the servlet is useless..I can use only taglib in jsp pages.

Right.

> about the creaction of the a user with a customized role, the
> SlideEditorImpl has the contructor you suggest me, even if it's not
> called directly by me, after all when I create a user with an role
> 'user' evrything works fine, and the contructor I call is that one
> without parameters.
> Here is the stack trace of the exception:

> 18 Sep 2002 16:09:24 - org.apache.slide.common.Domain - WARNING -
> Service slidestore.reference.JDBCDescriptorsStore@88df60 access error :
> mypackage.acl.slide.roles.SlideEditorImpl
> org.apache.slide.common.ServiceAccessException: Service
> slidestore.reference.JDBCDescriptorsStore@88df60 access error :
> mypackage.acl.slide.roles.SlideEditorImpl
> org.apache.slide.common.ServiceAccessException: Service
> slidestore.reference.JDBCDescriptorsStore@88df60 access error :
> mypackage.acl.slide.roles.SlideEditorImpl at 
> slidestore.reference.JDBCDescriptorsStore.retrieveObject(JDBCDescriptorsStore.java:683) 

Okay, this is pretty clear. The JDBC store fails to instantiate your 
SlideEditorImpl class. Again, it must be public and the constructor with 
the parameters must be public.

Maybe this is a classpath issue. For example, if you have 
slide-stores.jar in $TOMCAT_HOME/common/lib, the SlideEditorImpl must 
also be loadable by the common class loader. I.e., if it is only in the 
web-app classpath or shared classpath, loading it from the JDBC store 
will fail.

Hope this helps.

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Template for directory browsing + creating new roles

Posted by Luca Zago <za...@libero.it>.
ok..about WebDav servlet..you are right. It was a misunderstanding of
mine.. Then if I use only jsp, and not a webDAV client, if I understand
wwll, the servlet is useless..I can use only taglib in jsp pages.

about the creaction of the a user with a customized role, the
SlideEditorImpl has the contructor you suggest me, even if it's not
called directly by me, after all when I create a user with an role
'user' evrything works fine, and the contructor I call is that one
without parameters.
Here is the stack trace of the exception:


18 Sep 2002 16:09:24 - org.apache.slide.common.Domain - WARNING -
Service slidestore.reference.JDBCDescriptorsStore@88df60 access error :
mypackage.acl.slide.roles.SlideEditorImpl
org.apache.slide.common.ServiceAccessException: Service
slidestore.reference.JDBCDescriptorsStore@88df60 access error :
mypackage.acl.slide.roles.SlideEditorImpl
org.apache.slide.common.ServiceAccessException: Service
slidestore.reference.JDBCDescriptorsStore@88df60 access error :
mypackage.acl.slide.roles.SlideEditorImpl at 
slidestore.reference.JDBCDescriptorsStore.retrieveObject(JDBCDescriptorsStore.java:683)
at 
org.apache.slide.store.StandardStore.retrieveObject(StandardStore.java:171)
         at
org.apache.slide.structure.StructureImpl.create(StructureImpl.java:321)
         at
mypackage.acl.slide.SlideUsersGroupsManager.createUser(SlideUsersGroupsManager.java:131)
         at
mypackage.acl.jsp.AddUserAction.perform(AddUserAction.java:80)
         at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
         at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
         at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:527)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.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(Http11Processor.java:405)
         at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)
18 Sep 2002 16:09:25 -
org.apache.slide.transaction.SlideTransactionManager - WARNING -
Rollback Transaction 7 xid Thread-4-1032358164427-7- in thread
  Thread-4


Christopher Lenz wrote:
 > Luca Zago wrote:
 >
 >> Thank you very much for the suggesstons, Christopher . But my
 >> doubts remain:, following my observations:
 >>
 >> Christopher Lenz wrote:
 >>
 >>> Luca Zago wrote:
 >>>
 >>>>
 >>>> Hi, - has somebody ever created a template to associate to
 >>>> webDav servlet? In my opinion it's a tricky..because it does
 >>>> only a forward....then the only solution for the template is
 >>>> building another servlet..with different html format..inside.
 >>>
 >>>
 >>>
 >>>
 >>> I don't understand. Could you try to explain why it's a problem
 >>> that the webdav-servlet forwards to the template? You can forward
 >>> to a JSP-page that uses the Slide taglib as a template, for
 >>> example.
 >>
 >>
 >> ---> Sure I can do it, but I wonder in that case what is the
 >> utility of the webDav servlet. In the sense that all the
 >> permissions checking must be done by taglib in the page. Instead
 >> using the standard servlet these cheking is done by the servlet
 >> itself..and the result are the files you really can access. I am
 >> evaluating the possibility to rewrite this servlet to templatize
 >> the static HTML code hard coded inside.
 >
 >
 > To be honest, I have no idea what your problem is. :-P
 >
 > The WebdavServlet does processing of the WebDAV and HTTP requests.
 > The *only* thing it delegates to the template is GET requests to
 > collection nodes. Using the Slide taglib in the template you can
 > effectively generate the same kind of listing the WebDAV servlet
 > generates, but you can customize it.
 >
 > The permission checking is done in the Slide kernel layer. Both the
 > taglib andd the WebDAV servlet get the permission checking for free.
 >
 > Of course, you can also just extend the WebdavServlet and override
 > doGet(). But that's for people who like HTML in servlets, or who
 > don't want to use JSP.
 >
 >>>> - And what about creating new roles? when I create a user with
 >>>> a new role I got the error:
 >>>>
 >>>> Sep 2002 19:34:25 - org.apache.slide.common.Domain - WARNING -
 >>>>  Service slidestore.reference.JDBCDescriptorsStore@88df60
 >>>> access error : mypackage.acl.slide.roles.SlideEditorImpl
 >>>> org.apache.slide.common.ServiceAccessException: Service
 >>>> slidestore.reference.JDBCDescriptorsStore@88df60 access error :
 >>>>  mypackage.acl.slide.roles. SlideEditorImpl
 >>>
 >>>
 >>>
 >>>
 >>> Make sure that class (SlideEditorImpl) is public and not
 >>> abstract, i.e. it must be instantiatable from outside the
 >>> mypackage.acl.slide.riles package.
 >>>
 >>> In addition, it needs to extend ObjectNode, and have a
 >>> constructor that matches the one in ObjectNode. I.e. it should
 >>> look like:
 >>>
 >>> public class SlideEditorImpl extends SubjectNode {
 >>>
 >>> public SlideEditorImpl(String uri, Vector children, Vector links)
 >>> { super(uri, children, links); }
 >>>
 >>> [...]
 >>>
 >>> }
 >>
 >>
 >>
 >> My class is exactly as you wrote :) then in the Domain.xml I added:
 >>
 >>
 >> <role name="editor">mypackage.acl.slide.roles.SlideEditorImpl
 >> </role>
 >>
 >> the code to create the user is:
 >>
 >> ObjectNode object = (ObjectNode)(Class.forName(ROLE_PACKAGE +
 >> info.getRole())).newInstance();
 >
 >
 > Here you're using the default constructor. The class must also have a
 >  constructor with the parameters are outlined above, so that it can
 > be instantiated by the store.
 >
 >> structure.create(slideToken, object, strUri);
 >> NodeRevisionDescriptor revision =  new NodeRevisionDescriptor(0);
 >> revision.setProperty(new NodeProperty("resourcetype",
 >> "<collection/>",true)); revision.setCreationDate(new Date());
 >> revision.setLastModified(new Date()); revision.setProperty( new
 >> NodeProperty("getcontentlength", "0", true)); revision.setProperty(
 >>  new NodeProperty("source", "", true)); revision.setProperty( new
 >> NodeProperty("password",info.getPassword(),
 >> NodeProperty.SLIDE_NAMESPACE));
 >>
 >> content.create(getSlideToken(), strUri, revision,null);
 >>
 >>
 >> The Errror is thrown by the last method call..at the content
 >> creation.
 >
 >
 > Weird. Can you send the full stack trace?
 >


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Template for directory browsing + creating new roles

Posted by Christopher Lenz <cm...@gmx.de>.
Luca Zago wrote:
> Thank you very much for the suggesstons, Christopher .
> But my doubts remain:, following my observations:
> 
> Christopher Lenz wrote:
> 
>> Luca Zago wrote:
>>
>>>
>>> Hi,
>>> - has somebody ever created a template to associate to webDav servlet?
>>> In my opinion it's a tricky..because it does only a forward....then the
>>> only solution for the template is building
>>> another servlet..with different html format..inside.
>>
>>
>>
>> I don't understand. Could you try to explain why it's a problem that 
>> the webdav-servlet forwards to the template? You can forward to a 
>> JSP-page that uses the Slide taglib as a template, for example.
> 
> ---> Sure I can do it, but I wonder in that case what is the utility of 
> the webDav servlet. In the sense that all the permissions checking must 
> be done by taglib in the page. Instead using the standard servlet these 
> cheking is done by the servlet itself..and the result are the files you 
> really can access.
> I am evaluating the possibility to rewrite this servlet to templatize 
> the static HTML code hard coded inside.

To be honest, I have no idea what your problem is. :-P

The WebdavServlet does processing of the WebDAV and HTTP requests. The 
*only* thing it delegates to the template is GET requests to collection 
nodes. Using the Slide taglib in the template you can effectively 
generate the same kind of listing the WebDAV servlet generates, but you 
can customize it.

The permission checking is done in the Slide kernel layer. Both the 
taglib andd the WebDAV servlet get the permission checking for free.

Of course, you can also just extend the WebdavServlet and override 
doGet(). But that's for people who like HTML in servlets, or who don't 
want to use JSP.

>>> - And what about creating new roles? when I create a user with a new
>>> role I got the error:
>>>
>>> Sep 2002 19:34:25 - org.apache.slide.common.Domain - WARNING - 
>>> Service slidestore.reference.JDBCDescriptorsStore@88df60 access error 
>>> : mypackage.acl.slide.roles.SlideEditorImpl
>>> org.apache.slide.common.ServiceAccessException: Service 
>>> slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
>>> mypackage.acl.slide.roles.
>>> SlideEditorImpl
>>
>>
>>
>> Make sure that class (SlideEditorImpl) is public and not abstract, 
>> i.e. it must be instantiatable from outside the 
>> mypackage.acl.slide.riles package.
>>
>> In addition, it needs to extend ObjectNode, and have a constructor 
>> that matches the one in ObjectNode. I.e. it should look like:
>>
>> public class SlideEditorImpl extends SubjectNode {
>>
>>   public SlideEditorImpl(String uri, Vector children, Vector links) {
>>     super(uri, children, links);
>>   }
>>
>>   [...]
>>
>> }
> 
> 
> My class is exactly as you wrote :)
> then in the Domain.xml I added:
> 
> <role name="editor">mypackage.acl.slide.roles.SlideEditorImpl </role>
> 
> the code to create the user is:
> 
>  ObjectNode object = (ObjectNode)(Class.forName(ROLE_PACKAGE + 
> info.getRole())).newInstance();

Here you're using the default constructor. The class must also have a 
constructor with the parameters are outlined above, so that it can be 
instantiated by the store.

>                       structure.create(slideToken, object, strUri);
>                       NodeRevisionDescriptor revision =  new 
> NodeRevisionDescriptor(0);
>                       revision.setProperty(new 
> NodeProperty("resourcetype", "<collection/>",true));
>                       revision.setCreationDate(new Date());
>                       revision.setLastModified(new Date());
>                       revision.setProperty(
>         new NodeProperty("getcontentlength", "0", true));
>                       revision.setProperty(
>             new NodeProperty("source", "", true));
>                       revision.setProperty(
>                          new NodeProperty("password",info.getPassword(),
>                                          NodeProperty.SLIDE_NAMESPACE));
> 
>     content.create(getSlideToken(), strUri, revision,null);
> 
> 
> The Errror is thrown by the last method call..at the content creation.

Weird. Can you send the full stack trace?

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Template for directory browsing + creating new roles

Posted by Luca Zago <za...@libero.it>.
Thank you very much for the suggesstons, Christopher .
But my doubts remain:, following my observations:

Christopher Lenz wrote:
> Luca Zago wrote:
> 
>>
>> Hi,
>> - has somebody ever created a template to associate to webDav servlet?
>> In my opinion it's a tricky..because it does only a forward....then the
>> only solution for the template is building
>> another servlet..with different html format..inside.
> 
> 
> I don't understand. Could you try to explain why it's a problem that the 
> webdav-servlet forwards to the template? You can forward to a JSP-page 
> that uses the Slide taglib as a template, for example.
---> Sure I can do it, but I wonder in that case what is the utility of 
the webDav servlet. In the sense that all the permissions checking must 
be done by taglib in the page. Instead using the standard servlet these 
cheking is done by the servlet itself..and the result are the files you 
really can access.
I am evaluating the possibility to rewrite this servlet to templatize 
the static HTML code hard coded inside.
> 
>> - And what about creating new roles? when I create a user with a new
>> role I got the error:
>>
>> Sep 2002 19:34:25 - org.apache.slide.common.Domain - WARNING - Service 
>> slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
>> mypackage.acl.slide.roles.SlideEditorImpl
>> org.apache.slide.common.ServiceAccessException: Service 
>> slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
>> mypackage.acl.slide.roles.
>> SlideEditorImpl
> 
> 
> Make sure that class (SlideEditorImpl) is public and not abstract, i.e. 
> it must be instantiatable from outside the mypackage.acl.slide.riles 
> package.
> 
> In addition, it needs to extend ObjectNode, and have a constructor that 
> matches the one in ObjectNode. I.e. it should look like:
> 
> public class SlideEditorImpl extends SubjectNode {
> 
>   public SlideEditorImpl(String uri, Vector children, Vector links) {
>     super(uri, children, links);
>   }
> 
>   [...]
> 
> }

My class is exactly as you wrote :)
then in the Domain.xml I added:

<role name="editor">mypackage.acl.slide.roles.SlideEditorImpl </role>

the code to create the user is:

  ObjectNode object = (ObjectNode)(Class.forName(ROLE_PACKAGE + 
info.getRole())).newInstance();
                       structure.create(slideToken, object, strUri);
                       NodeRevisionDescriptor revision =  new 
NodeRevisionDescriptor(0);
                       revision.setProperty(new 
NodeProperty("resourcetype", "<collection/>",true));
                       revision.setCreationDate(new Date());
                       revision.setLastModified(new Date());
                       revision.setProperty(
         new NodeProperty("getcontentlength", "0", true));
                       revision.setProperty(
			new NodeProperty("source", "", true));
                       revision.setProperty(
                          new NodeProperty("password",info.getPassword(),
                                          NodeProperty.SLIDE_NAMESPACE));

	content.create(getSlideToken(), strUri, revision,null);


The Errror is thrown by the last method call..at the content creation.
Thank you again,

Luca




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Template for directory browsing + creating new roles

Posted by Christopher Lenz <cm...@gmx.de>.
Luca Zago wrote:
> 
> Hi,
> - has somebody ever created a template to associate to webDav servlet?
> In my opinion it's a tricky..because it does only a forward....then the
> only solution for the template is building
> another servlet..with different html format..inside.

I don't understand. Could you try to explain why it's a problem that the 
webdav-servlet forwards to the template? You can forward to a JSP-page 
that uses the Slide taglib as a template, for example.

> - And what about creating new roles? when I create a user with a new
> role I got the error:
> 
> Sep 2002 19:34:25 - org.apache.slide.common.Domain - WARNING - Service 
> slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
> mypackage.acl.slide.roles.SlideEditorImpl
> org.apache.slide.common.ServiceAccessException: Service 
> slidestore.reference.JDBCDescriptorsStore@88df60 access error : 
> mypackage.acl.slide.roles.
> SlideEditorImpl

Make sure that class (SlideEditorImpl) is public and not abstract, i.e. 
it must be instantiatable from outside the mypackage.acl.slide.riles 
package.

In addition, it needs to extend ObjectNode, and have a constructor that 
matches the one in ObjectNode. I.e. it should look like:

public class SlideEditorImpl extends SubjectNode {

   public SlideEditorImpl(String uri, Vector children, Vector links) {
     super(uri, children, links);
   }

   [...]

}

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>