java - Magnolia doesnt see custom servlet -
i'm having big trouble magnolia servlet, far i've tried can think of.
regarding magnolia documentation can set servlet definition in module definition instead of web.xml (which sounds more neat idea expanding)
so placed code in xml module
<servlets> <servlet> <name>jcaptcha</name> <class>com.octo.captcha.module.servlet.image.simpleimagecaptchaservlet</class> <mappings> <mapping>/jcaptcha.jpg</mapping> </mappings> </servlet> </servlets>
and created bypass node (config.server.filters.bypasses.jcaptcha.xml) filter
<?xml version="1.0" encoding="utf-8"?> <sv:node sv:name="jcaptcha" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <sv:property sv:name="jcr:primarytype" sv:type="name"> <sv:value>mgnl:contentnode</sv:value> </sv:property> <sv:property sv:name="jcr:uuid" sv:type="string"> <sv:value>f845ae89-a537-4e9f-b074-57d812fd92a6</sv:value> </sv:property> <sv:property sv:name="class" sv:type="string"> <sv:value>info.magnolia.voting.voters.uristartswithvoter</sv:value> </sv:property> <sv:property sv:name="pattern" sv:type="string"> <sv:value>/jcaptcha.jpg</sv:value> </sv:property> <sv:node sv:name="metadata"> <sv:property sv:name="jcr:primarytype" sv:type="name"> <sv:value>mgnl:metadata</sv:value> </sv:property> <sv:property sv:name="mgnl:activated" sv:type="boolean"> <sv:value>false</sv:value> </sv:property> <sv:property sv:name="mgnl:activatorid" sv:type="string"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:authorid" sv:type="string"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:creationdate" sv:type="date"> <sv:value>2007-04-25t18:23:31.784+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastaction" sv:type="date"> <sv:value>2007-05-02t17:00:15.025+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="date"> <sv:value>2012-06-07t05:41:25.275-05:00</sv:value> </sv:property> </sv:node> </sv:node>
still when request localhost/magnolia/jcaptcha.jpg gives me 404 error. "but" when put servlet definition in web.xml , gives right result.
can tell me missing?
here answer got magnolia forum
<servlets> <servlet> <name>jcaptcha</name> <class>com.octo.captcha.module.servlet.image.simpleimagecaptchaservlet</class> <mappings> <mapping>/jcaptcha.jpg</mapping> </mappings> </servlet> </servlets>
doing tells magnolia run servlet you. can verify servlet installed when install module in config:/server/filters/servlets/jcaptcha.
and created bypass node (config.server.filters.bypasses.jcaptcha.xml) filter
doing tell magnolia not treat said bypass url, instead let servlet container handler request. since magnolia knows servlet, not container 404. once make container aware of servlet (by adding web.xml) result.
you have 2 options - either keep bypass , definition in web.xml or keep servlet definition in module. can't have both. please remember magnolia read servlet definition module descriptor during installation of module, if module installed, need invoke info.magnolia.module.delta.registermoduleservletstask part of update.
hth, jan
Comments
Post a Comment