tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Bremford" <mi...@paperx.com>
Subject RE: how to use jssi with tomcat
Date Mon, 18 Sep 2000 14:37:51 GMT
Well, I gave this a bash and got it most of the way there. However, I fear
that just adding the jar to the classpath and associating .jhtml files with
the servlet doesn't quite work (at least not with 3.2b3 it doesn't).


Here's what I did.

1. Got the ApacheJSSI source from
http://java.apache.org/jservssi/dist/ApacheJSSI-1.1.2.tar.gz


2. As ApacheJSSI.jar is a 2.0 servlet, so you need to, er, link (sorry - the
correct java buzzword escapes me) against the servlet-2.0.jar that comes
with Apache/Jserv. I had one lying around. You can probably get one from
java.apache.org/jserv somewhere.


3. Add the following line to httpd.conf:

AddHandler jserv-servlet .jhtml


4. Add the following block to web.xml under your WEB-INF directory (not the
one in tomcat/conf. But then I'm running through apache, so YMMV):

<web-app>
    <servlet>
        <servlet-name>
            jhtml
        </servlet-name>
        <servlet-class>
            org.apache.servlet.ssi.SSI
        </servlet-class>
        <load-on-startup>
            -2147483646
        </load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>
            jhtml
        </servlet-name>
        <url-pattern>
            *.jhtml
        </url-pattern>
    </servlet-mapping>
</web-app>

5. Now you need to tweak JSSI a bit to get it running with Tomcat (a 2.2
engine) rather than Jserv (a 2.0 engine).

5a. Modify the file src/java/org/apache/servlet/ssi/PageParserServlet.java,
and in the doGet() method replace the line:

String path = req.getPathTranslated();

with:

String path = getServletContext().getRealPath(req.getRequestURI());


This allows the servlet to find the original JSP. From there, I run out of
steam. Making the JAR, adding it to the tomcat classpath and running it gets
as far as parsing the pages, but when it hits a <servlet> tag it complains
about being unable to load the servlet.

A closer examination shows the call context.getServlet("SnoopServlet") in
ServletTagHandler.runServlet is returning null. I can call the servlet
directly, so it should be OK. But since getServlet() was deprecated in the
2.1 spec I don't know how to fix it to work with Tomcats environment.

Any thoughts?


Cheers... Mike



> -----Original Message-----
> From: Alex Chaffee [mailto:guru@edamame.stinky.com]
> Sent: 17 September 2000 14:24
> To: tomcat-user@jakarta.apache.org
> Subject: Re: how to use jssi with tomcat
>
>
> From the jGuru FAQ:
> http://www.jguru.com/jguru/faq/view.jsp?EID=98795
>
> http://java.apache.org/jservssi/ - the JServ JSSI servlet
> should do the trick.
>
> That is, you can set up a mapping from .jhtml to the exact same
> servlet (see the JSP mapping in server.xml for inspiration).
>
> If you get this working, please submit a feedback to the FAQ with your
> config file info.
>
>  - Alex
>
> On Fri, Sep 15, 2000 at 11:37:23AM -0700, Shilpa Kulkarni wrote:
> > hello all,
> >
> > i want to use <servlet> tag to include the contents of the
> servlet in my
> > page.
> > with apache server, u can use Apache JSSI to do this along
> with Apache
> > Jserv.
> >
> > with tomcat, how do i use JSSI to include <servlet> tags in my jsp.
> >
> > thanks in advance,
> > shilpa.
>
> --
> Alex Chaffee                       mailto:alex@jguru.com
> jGuru - Java News and FAQs         http://www.jguru.com/alex/
> Creator of Gamelan                 http://www.gamelan.com/
> Founder of Purple Technology       http://www.purpletech.com/
> Curator of Stinky Art Collective   http://www.stinky.com/
>


Mime
View raw message