Hi Oded,

The BlossomDispatcherServlet containing your @Template annotated controllers is 
not exposed to the outside. It is only used by the rendering engine to render 
content. The servlet container has no way to dispatch requests to this servlet. 
This is by design. Controllers that you want to expose should be in a separate 
servlet xml file and served by a standard DispatcherServlet.

Add dispatcher-servlet.xml to your module in src/main/resources

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:context="http://www.springframework.org/schema/context";
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd";>

  <context:component-scan base-package="--package of your choosing containing 
you controllers that you want to expose--" />

</beans>

In your module descriptor add a servlet

<servlets>
  <servlet>
    <name>dispatcher</name>
    <class>org.springframework.web.servlet.DispatcherServlet</class>
    <mappings>
      <mapping>/dispatcher/*</mapping>
    </mappings>
    <params>
      <param>
        <name>contextConfigLocation</name>
        <value>classpath:/dispatcher-servlet.xml</value>
      </param>
    </params>
  </servlet>
</servlets>

This controller will be accessible from outside at the URL /dispatcher/external

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ExternalController {

    @RequestMapping("/external")
    @ResponseBody
    public String external() {
        return "This is an externally accessible controller";
    }
}

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=b341dd37-b9bc-4a58-ac4b-ced783b652ea


----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to