NanoContainer
  1. NanoContainer
  2. NANO-72

make Dispatcher configurable from nanocontainer.groovy

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-beta-1
    • Component/s: nanowar
    • Labels:
      None
    • Number of attachments :
      1

      Description

      I made a patch to retrieve Dispatcher instance from application level PicoContainer (if not found, fall back to default ChainingDispatcher).

      Here is a sample configuration for using FreeMarker as view:

      [[nanocontainer.groovy]]
      if (assemblyScope instanceof javax.servlet.ServletContext) {
      pico = new org.picocontainer.defaults.DefaultPicoContainer(parent)
      pico.registerComponentInstance(new org.nanocontainer.nanoweb.ChainingDispatcher(".ftl"))
      return pico
      } else if (assemblyScope instanceof javax.servlet.http.HttpSession) {
      return new org.picocontainer.defaults.DefaultPicoContainer(parent)
      } else if (assemblyScope instanceof javax.servlet.ServletRequest) {
      return new org.picocontainer.defaults.DefaultPicoContainer(parent)
      }

      [[web.xml]]
      <servlet>
      <servlet-name>FreeMarker</servlet-name>
      <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>
      <init-param>
      <param-name>TemplatePath</param-name>
      <param-value>/</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>

      <servlet-mapping>
      <servlet-name>FreeMarker</servlet-name>
      <url-pattern>*.ftl</url-pattern>
      </servlet-mapping>

        Activity

        Kouhei Mori made changes -
        Field Original Value New Value
        Attachment configurable_dispatcher.patch [ 11976 ]
        Hide
        Aslak Hellesøy added a comment -

        Applied. Thanks!

        Show
        Aslak Hellesøy added a comment - Applied. Thanks!
        Aslak Hellesøy made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.0-beta-1 [ 10147 ]
        Assignee Aslak Hellesoy [ rinkrank ]

          People

          • Assignee:
            Aslak Hellesøy
            Reporter:
            Kouhei Mori
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: