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 "Doug Reeder, aka Skapti" <re...@osu.edu> on 2004/11/12 21:21:11 UTC

ContentInterceptor doesn't seem to work.

I'm trying to understand how to program a ContentInterceptor.

I have set up the Slide 2.0/Tomcat 5 bundle on a system running Red Hat 
9 Linux (kernel 2.4.20).  I can read and write to the repository 
successfully using several different WebDAV clients, including the Slide 
client.  I have even added a few extra users.

I have written a simple ContentInterceptor, which is just supposed to 
show it is working.  The source code is attached.  I have installed the 
class file in 
$CATALINA_HOME/common/classes/edu/osu/music/csml/EmrContentInterceptor.class


Following the directions on the ContentInterceptor JavaDoc page 
(http://jakarta.apache.org/slide/javadoc-2.1/javadoc/index.html), I 
added the following lines to my Domain.xml file, just before 
</configuration>:

  <content-interceptor class="edu.osu.music.csml.EmrContentInterceptor">
                 <parameter name="myParam1">someValue</parameter>
                 <parameter name="myParam2">anotherValue</parameter>
  </content-interceptor>

My Domain.xml is also attached.

I have some indication that Slide knows about my ContentInterceptor, 
because if I delete the class file, it complains about the entry in 
Domain.xml.

With all this in place, Slide starts up normally, however, no mention of 
  EmrContentInterceptor shows up in catalina.out, and I'm not getting 
any form of output from my class.

1) is there something else I need to do to make Slide actually use my class?

2) What should I be doing in my class to get a "Hello World!" output?




-- 
Well-groomed and washed       go to the Assembly,
though your clothes be not the best;
of your shoes and pants       be not ashamed,
and still less of your horse
-Hávamál

P. Douglas Reeder   Systems Specialist, CSML, Dept. Music, OSU
reeder.29@osu.edu                           aka Skapti Herjolfsson
GE/S d- s+:- a C++@$ U++++ P+ L++ E W++ N+ o? K? w !O M+ V PS+() PE
Y+ PGP- t 5+ X- R>+ tv+ b+++>$ DI+ D- G e+++ h r+>+++ y+>++


Re: ContentInterceptor doesn't seem to work.

Posted by James Mason <ma...@apache.org>.
Well, by default I don't think it will log anything. Try adding some
code to write to the log. If you can't get it working then maybe there's
something wrong with your configuration (although I can't imagine what
at this point).

-James

On Tue, 2004-11-16 at 12:07 -0500, Doug Reeder, a.k.a. Skapti wrote:
> James Mason wrote:
> 
> > Doug,
> > 
> > I'm not sure what the problem is. Here's a link to one I know worked
> > with Slide 2.0:
> > http://www.mail-archive.com/slide-user@jakarta.apache.org/msg06513.html
> > 
> > The only differences I see are mine didn't include parameters and I
> > implemented the setNamespace() method. Maybe this will give you a place
> > to start looking.
> 
> Thanks for the suggestion!  I tried using WebFolderContentInterceptor, 
> and it behaved identically to mine - I cannot determine whether it is 
> doing anything or not, as nothing shows up in the logs.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: ContentInterceptor doesn't seem to work.

Posted by "Doug Reeder, a.k.a. Skapti" <re...@osu.edu>.
James Mason wrote:

> Doug,
> 
> I'm not sure what the problem is. Here's a link to one I know worked
> with Slide 2.0:
> http://www.mail-archive.com/slide-user@jakarta.apache.org/msg06513.html
> 
> The only differences I see are mine didn't include parameters and I
> implemented the setNamespace() method. Maybe this will give you a place
> to start looking.

Thanks for the suggestion!  I tried using WebFolderContentInterceptor, 
and it behaved identically to mine - I cannot determine whether it is 
doing anything or not, as nothing shows up in the logs.


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: ContentInterceptor doesn't seem to work.

Posted by James Mason <ma...@apache.org>.
Doug,

I'm not sure what the problem is. Here's a link to one I know worked
with Slide 2.0:
http://www.mail-archive.com/slide-user@jakarta.apache.org/msg06513.html

The only differences I see are mine didn't include parameters and I
implemented the setNamespace() method. Maybe this will give you a place
to start looking.

-James

On Fri, 2004-11-12 at 15:21 -0500, Doug Reeder, aka Skapti wrote:
> I'm trying to understand how to program a ContentInterceptor.
> 
> I have set up the Slide 2.0/Tomcat 5 bundle on a system running Red Hat 
> 9 Linux (kernel 2.4.20).  I can read and write to the repository 
> successfully using several different WebDAV clients, including the Slide 
> client.  I have even added a few extra users.
> 
> I have written a simple ContentInterceptor, which is just supposed to 
> show it is working.  The source code is attached.  I have installed the 
> class file in 
> $CATALINA_HOME/common/classes/edu/osu/music/csml/EmrContentInterceptor.class
> 
> 
> Following the directions on the ContentInterceptor JavaDoc page 
> (http://jakarta.apache.org/slide/javadoc-2.1/javadoc/index.html), I 
> added the following lines to my Domain.xml file, just before 
> </configuration>:
> 
>   <content-interceptor class="edu.osu.music.csml.EmrContentInterceptor">
>                  <parameter name="myParam1">someValue</parameter>
>                  <parameter name="myParam2">anotherValue</parameter>
>   </content-interceptor>
> 
> My Domain.xml is also attached.
> 
> I have some indication that Slide knows about my ContentInterceptor, 
> because if I delete the class file, it complains about the entry in 
> Domain.xml.
> 
> With all this in place, Slide starts up normally, however, no mention of 
>   EmrContentInterceptor shows up in catalina.out, and I'm not getting 
> any form of output from my class.
> 
> 1) is there something else I need to do to make Slide actually use my class?
> 
> 2) What should I be doing in my class to get a "Hello World!" output?
> 
> 
> 
> 
> Plain text document attachment (EmrContentInterceptor.java)
> /*
>  * EmrContentInterceptor.java
>  *
>  * Created on November 10, 2004, 7:30 PM
>  */
> 
> package edu.osu.music.csml;
> 
> import java.io.*;
> import java.util.*;
> import javax.transaction.*;
> import org.apache.slide.common.*;
> import org.apache.slide.content.*;
> import org.apache.slide.util.logger.*;
> 
> /**
>  *
>  * @author  reeder
>  */
> public class EmrContentInterceptor extends AbstractContentInterceptor {
>     private Hashtable parameters;
>     
>     /** Creates a new instance of EmrContentInterceptor */
>     public EmrContentInterceptor() {
>     }
>     
>     public void preRetrieveContent(SlideToken token, 
>             NodeRevisionDescriptors revisionDescriptors, 
>             NodeRevisionNumber revisionNumber, 
>             NodeRevisionDescriptor revisionDescriptor) {
>         
>         NamespaceAccessToken namespace = getNamespace();
>         String message = "EmrContentInterceptor preRetrieveContent: " + namespace.getName();
>         try {
>             PrintWriter out = new PrintWriter(new FileWriter(
>                     File.createTempFile("emrci", ".log", new File("/tmp")) ));
>             out.println(message);
>             out.close();
>         } catch (Exception ex) {
>         }
>         Logger logger = namespace.getLogger();
>         logger.log(message);
>         System.out.println(message);
>     }
>     
> }
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org