Hi,

as long as i know you have to tell your servelt engine e.g.
Jakarta about the other servlet. I think cocoon doesn't
really care about it. The servlet engine decides which
servlet get the request. To configure it with jakarta
you have to change the web.xml file within the WEB-INF
directory of your webapp. For exmaple like the example
web.xml file below. But if the mapping works like this
i don't know, but if think it should. I even think
that at the website of SUN you can find more information
about the structure of the web.xml file.

Max

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  This is the web-app configurations that allow Cocoon to work under
  Apache Tomcat. Please, follow the installation section of the
  documentation for more information about installing Cocoon on Tomcat
-->
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd";>
<web-app>
        <display-name>Cocoon2 Demo</display-name>
        <description>Demo application for Cocoon2</description>
        <servlet>
                <servlet-name>Cocoon2</servlet-name>
                <display-name>Cocoon2</display-name>
                <description>The main Cocoon2 servlet</description>
                <servlet-class>org.apache.cocoon.servlet.CocoonServlet</servlet-class>
                <init-param>
                        <param-name>configurations</param-name>
                        <param-value>/cocoon.xconf</param-value>
                </init-param>

                <init-param>
                        <param-name>log-level</param-name>
                        <param-value>DEBUG</param-value>
                </init-param>

                <init-param>
                        <param-name>allow-reload</param-name>
                        <param-value>yes</param-value>
                </init-param>
                <init-param>
                        <param-name>load-class</param-name>
                        <param-value> org.gjt.mm.mysql.Driver</param-value>
                </init-param>
        </servlet>
        <!-- HERE YOU'RE SERVLET -->
        <servlet>
                <servlet-name>Test</servlet-name>
                <display-name>Test</display-name>
                <description>The other servelt besides the Cocoon2 
servlet</description>
                <servlet-class>Test</servlet-class>
        </servlet>
        <!-- END -->
        <servlet-mapping>
                <servlet-name>Cocoon2</servlet-name>
                <url-pattern>/</url-pattern>
        </servlet-mapping>
        <!-- MAP YOUR SERVLET TO AN URI -->
        <servlet-mapping>
                <servlet-name>Test</servlet-name>
                <url-pattern>/test</url-pattern>
        </servlet-mapping>
        <!-- END -->
</web-app>

-----Ursprüngliche Nachricht-----
Von: Mamadou Bobo Sylla [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 24. Juli 2001 08:54
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: Help:Cocoon and servlet


Hello everyone,
I am trying to test some the code examples from Apache . When I call the xml
page countries.xml through bowser, it works fine being processd by page.xsl.
But I want countries.xml to be processed after a resquet to a servlet.
For that purpose I have writtent a servlet called Test which should now
output the xml  to be processed by a stylsheet called page.xsl.

How do I configure  Cocoon so that it becomes aware of my servlet.

The codes of Test.java:
============
public class Test extends HttpServlet {


 public void doGet( HttpServletRequest req,
                       HttpServletResponse res )
        throws ServletException, IOException
 {

  PrintWriter output = res.getWriter();
        res.setContentType( "text/xml" );

         StringBuffer xmlbuf =new StringBuffer("<?xml version=\"1.0\"
encoding = \"UTF-8\"?>");
  xmlbuf.append("<?cocoon-process type=\"xslt\"?>");
  xmlbuf.append("<?xml-stylesheet href=\"page.xsl\" type=\"text/xsl\"?>");
  xmlbuf.append("<page>");
  xmlbuf.append("<country code = \"ca\">Canada</country>");
  xmlbuf.append( "<country code = \"de\">Germany</country>");
  xmlbuf.append("<country code = \"fr\">France</country>") ;
  xmlbuf.append("<country code = \"uk\">United Kingdom</country>");
  xmlbuf.append("<country code = \"us\">United States</country>");
  xmlbuf.append("<country code = \"es\">Spain</country>");
  xmlbuf.append("</page>");

  output.println(xmlbuf.toString());

 }
==================

}
============



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to