5 Replies Latest reply on Jan 9, 2003 6:29 AM by Jochen Cordes

    Where to put xsl file for Cactus?

    Siegfried Heintze Newbie

      The TOMCAT directions for cactus tell me I can use an XSL file specified on the URL thusly: http://10.0.0.4:8080/SampleServlet/servlet/ServletTestRunner?suite=TestSampleServlet&xsl=junit-noframes.xsl

      Where, exactly, can I put the file "http://10.0.0.4:8080/SampleServlet/servlet/ServletTestRunner?suite=TestSampleServlet&xsl=junit-noframes.xsl"? In the ear or war? what directory?

        • 1. Re: Where to put xsl file for Cactus?
          Joel Vogt Master

          from the looks of it, put the xsl in the same directory that is the root of your html/jsp. This will be in your war file.

          • 2. Re: Where to put xsl file for Cactus?
            Siegfried Heintze Newbie

            I've put the xsl file everywhere I can think of: in the top level of the war, in the classes directory etc... and it still cannot find it.

            Does JBoss unpack this in some temporary directory that I can look at and verify?

            What is the default directory in the WAR file where JBoss is executing? The classes directory? above classes in the WEB-INF? above WEB-INF?

            thanks,

            Siegfried

            • 3. Re: Where to put xsl file for Cactus?
              Jochen Cordes Novice

              Hi Siegfried !

              Did you specify a servlet-mapping for the ServletTestRunner in web.xml (as pointed out in the cactus setup instructions) ?. The URL should look like this http://localhost:8080/yourapp/ServletTestRunner?suite=your-fully-qualified-testcase&xsl=junit-noframes.xsl. Then you just have to put the stylesheet to the context-root of your application.

              Hope it helps,

              Jochen.

              • 4. Re: Where to put xsl file for Cactus?
                Siegfried Heintze Newbie

                Jochen,
                Could you elaborate please? I don't understand "Then you just have to put the stylesheet to the context-root of your application". I've put a copy in every directory of the ear and war file and JBoss just cannot seem to find it. After deploying I perform a search of the JBoss directory and I cannot find any files: no jsp, no html. Apparently they are all compiled! What does it do with the XSL file? Does it try to compile it too?
                Thanks,
                Siegfried
                -------------------------------------------------


                Here are the mappings in g:/jboss-3.0.0_tomcat-4.0.3/catalina/conf/web.xml as per my copy of the documentation. I assume it would not work at all if I did not have these right. Ignore the line numbers, they are not in the actual file (just in the documentation I write for myself).

                <!-- Cactus -->
                290 <servlet-mapping>
                291 <servlet-name>ServletRedirector</servlet-name>
                292 <url-pattern>/ServletRedirector</url-pattern>
                293 </servlet-mapping>
                294
                295 <!-- Cactus -->
                296 <servlet-mapping>
                297 <servlet-name>ServletTestRunner</servlet-name>
                298 <url-pattern>/ServletTestRunner</url-pattern>
                299 </servlet-mapping>
                300

                • 5. Re: Where to put xsl file for Cactus?
                  Jochen Cordes Novice

                  Hi Siegfried !

                  Sorry for the very, very late answer. I've been quite busy lately. Hope that it's not to late. I'm trying to explain it a bit clearer. You have to put the configuration part for web.xml into the web.xml of the web-part of the application you're trying to test. It should look like this

                  <servlet-name>ServletRedirector</servlet-name>
                  <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>


                  <servlet-name>JspRedirector</servlet-name>
                  <jsp-file>/jspRedirector.jsp</jsp-file>


                  <servlet-name>ServletTestRunner</servlet-name>
                  <servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-class>


                  <servlet-name>ImageServlet</servlet-name>
                  <servlet-class>com.nevarsa.catalog.web.servlet.ImageServlet</servlet-class>

                  <servlet-mapping>
                  <servlet-name>ServletTestRunner</servlet-name>
                  <url-pattern>/ServletTestRunner</url-pattern>
                  </servlet-mapping>
                  <servlet-mapping>
                  <servlet-name>ServletRedirector</servlet-name>
                  <url-pattern>/ServletRedirector</url-pattern>
                  </servlet-mapping>
                  <servlet-mapping>
                  <servlet-name>JspRedirector</servlet-name>
                  <url-pattern>/JspRedirector</url-pattern>
                  </servlet-mapping>

                  (sorry for the formatting)

                  Then put the XSL file and jspRedirector.jsp to jboss/server/default/deploy/yourapp.ear/yourapp.war (assuming you're using an expanded ear). All should work now. I don't think Cactus is using XSLTC to speed up things, but who knows ? Although I'm using XSLTC, I never noticed the disappearing of any files ;-).

                  Hope it helps,

                  Jochen.