Jahia Dev Forum > Jahia module with...

0 (0 Good)
0 (0 Bad)

Jahia module with SpringMVC controller

by  wondermach »  2011/07/07 17:36

Hi,

I'm trying to build a module with a custom SpringMCV controller.

I've defined a new class which implements Controller and I've mapped in the module's spring configuration this way:

 

 

<bean name="dummyController" class="it.test.DummyController" init-method="startup">
<property name="success" value="dummy.jsp" />
</bean>
 
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/dummy=dummyController
</value>
</property>
</bean>
 
When I deploy the module, the controller is correctly loaded and mapped: "AbstractUrlHandlerMapping, org.springframework.web.servlet.handler.SimpleUrlHandlerMapping: Mapped URL path [/dummy] onto handler 'dummyController'".
Anyway, when i try to access the controller at http://localhost:8080/dummy it doesn't respond.
The log file reports "org.jahia.bin.errors.ErrorLoggingFilter: [Error code: 404]: Requested resource is not available: /dummy".
 
How is the controller mapped ? Is it really possibile to declare a custom controller inside a module ?
 
Thanks a lot,
 
Davide
  • Jahia module with SpringMVC controller
    2011/07/07 17:36

    wondermach <p> Hi,</p> <p> I&#39;m trying to build a module with a custom SpringMCV controller.</p> <p> I&#39;ve defined a new class which implements Controller and I&#39;ve mapped in the module&#39;s spring configuration this way:</p> <p> &nbsp;</p> <p> &nbsp;</p> <div> &lt;bean name=&quot;dummyController&quot; class=&quot;it.test.DummyController&quot; init-method=&quot;startup&quot;&gt;</div> <div> &lt;property name=&quot;success&quot; value=&quot;dummy.jsp&quot; /&gt;</div> <div> &lt;/bean&gt;</div> <div> &nbsp;</div> <div> &lt;bean class=&quot;org.springframework.web.servlet.handler.SimpleUrlHandlerMapping&quot;&gt;</div> <div> &lt;property name=&quot;mappings&quot;&gt;</div> <div> &lt;value&gt;</div> <div> /dummy=dummyController</div> <div> &lt;/value&gt;</div> <div> &lt;/property&gt;</div> <div> &lt;/bean&gt;</div> <div> &nbsp;</div> <div> When I deploy the module, the controller is correctly loaded and mapped: &quot;AbstractUrlHandlerMapping, org.springframework.web.servlet.handler.SimpleUrlHandlerMapping: Mapped URL path [/dummy] onto handler &#39;dummyController&#39;&quot;.</div> <div> Anyway, when i try to access the controller at http://localhost:8080/dummy it doesn&#39;t respond.</div> <div> The log file reports &quot;org.jahia.bin.errors.ErrorLoggingFilter: [Error code: 404]: Requested resource is not available: /dummy&quot;.</div> <div> &nbsp;</div> <div> How is the controller mapped ? Is it really possibile to declare a custom controller inside a module ?</div> <div> &nbsp;</div> <div> Thanks a lot,</div> <div> &nbsp;</div> <div> Davide</div>

  • Number of messages  1
    Registration date Jul 7, 2011
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page