You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gintare Ragaisiene <gi...@gmail.com> on 2009/11/24 13:50:38 UTC
Add custom servlet on cocoon 2.2.0 startup
Hi,
I need to initialize a servlet like
public class TestServlet extends HttpServlet{
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
System.out.println("TestServlet");
}
}
on cocoon 2.2 startup.
Some servlets is set up in cocoon_home/target/rct/webapp/WEB-INF/web.xml. If
I edit that web.xml to add servlet, after server restart input disappear.
Thanks,
Gintare
Re: Add custom servlet on cocoon 2.2.0 startup
Posted by Dominic Mitchell <do...@happygiraffe.net>.
2009/11/24 Gintare Ragaisiene <gi...@gmail.com>
> Hi,
>
> I need to initialize a servlet like
>
> public class TestServlet extends HttpServlet{
>
> @Override
> public void init(ServletConfig config) throws ServletException {
> super.init(config);
>
> System.out.println("TestServlet");
> }
>
> }
>
> on cocoon 2.2 startup.
>
> Some servlets is set up in cocoon_home/target/rct/webapp/WEB-INF/web.xml.
> If I edit that web.xml to add servlet, after server restart input disappear.
>
>
I *think* that you need to make your servlet into a Spring bean. If you add
to your existing META-INF/cocoon/spring/servlet-service-framework.xml file:
<bean name="myservlet" class="com.example.MyServlet">
<servlet:context mount-path="/myBlock1"
context-path="blockcontext:/myBlock1/"/>
</bean>
It may work. I'm not too familiar with the servlet service framework, and I
haven't tested this. :-(
-Dom