You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ice96 <ic...@gmail.com> on 2008/05/03 16:00:04 UTC

groovy grails and tapestry 5 integration experiments

Hello,
 I' m traing to integrate tapestry 5 in grails. I read in this 
http://www.troymaxventures.com/search/label/grapestry this   blog how to
integrate tapestry 4. At the moment my problem that tapestry does not have
org.apache.tapestry.ApplicationServlet and I can't bind .tml files.

grails plugin looks like this:


class Tapestry5GrailsPlugin {
 def version = 0.1
 def dependsOn = [:]
 // This removes the Grails standard controllers plugin, which means that
standard Grails actions and such would not work anymore.
 def evicts=['controllers']

 def doWithSpring = {
  // TODO Implement runtime spring config (optional)
 }   
 def doWithApplicationContext = { applicationContext ->
  // TODO Implement post initialization spring config (optional)  
 }
 def doWithWebDescriptor = { xml ->
  

			/*
def servlets = xml.servlet[0]
   	        servlets + {
                servlet {
                   'servlet-name'('tapestryapplication')
                   'servlet-class'('org.apache.tapestry.ApplicationServlet')
                   'load-on-startup'(1)
               }
        }






		def mappings = xml.'servlet-mapping'[0]
               mappings + {
                 'servlet-mapping' {
                       'servlet-name'('tapestryapplication')
                       'url-pattern'('/app')
                  }
                   'servlet-mapping' {
                       'servlet-name'('tapestryapplication')
                       'url-pattern'('*.html')
                  }
                  'servlet-mapping' {
                       'servlet-name'('tapestryapplication')
                       'url-pattern'('*.direct')
                  }
                   'servlet-mapping' {
                       'servlet-name'('tapestryapplication')
                       'url-pattern'('*.sdirect')
                  }
                   'servlet-mapping' {
                       'servlet-name'('tapestryapplication')
                       'url-pattern'('*.svc')
                  }
                   'servlet-mapping' {
                       'servlet-name'('tapestryapplication')
                       'url-pattern'('/assets/*')
                  }
               }

*/

	 def contextParam = xml.'context-param'[0]
   	 contextParam + { 'context-param' {
        'param-name'('tapestry.app-package')
        'param-value'('org.tapestry.myapp')
    }}


           def filter = xml.filter[0]
    filter + {
        'filter-name'('app')
        'filter-class'('org.apache.tapestry.TapestryFilter')  
    }

    def filterMapping = xml.'filter-mapping'[0]
    filterMapping + {
        'filter-name'('app')
        'url-pattern'('/*')
    }



 }



		






 def doWithDynamicMethods = { ctx ->
  // TODO Implement additions to web.xml (optional)
 } 
 def onChange = { event ->
  // TODO Implement code that is executed when this class plugin class is
changed  
  // the event contains: event.application and event.applicationContext
objects
 }                                                                                  
 def onApplicationChange = { event ->
  // TODO Implement code that is executed when any class in a
GrailsApplication changes
  // the event contain: event.source, event.application and
event.applicationContext objects
 }
}



Has anyone ideas?

-- 
View this message in context: http://www.nabble.com/groovy-grails-and-tapestry-5-integration-experiments-tp17035475p17035475.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: groovy grails and tapestry 5 integration experiments

Posted by Howard Lewis Ship <hl...@gmail.com>.
Most of that is already there; however, there probably needs to be
other work to ensure that Tapestry generates the correct URL; right
now it includes the context part and the path from there; the servlet
needs to be injected into the middle of that.

On Sun, May 4, 2008 at 2:50 AM, ice96 <ic...@gmail.com> wrote:
>
>  As I understand, to make Tapestry more friendly with integration we need to
>  write a little chainge tappestry TapestryFilter:
>  1) Take out from TapestryFilter to more reusable class. Lets say
>  TapestryInit
>  2) Create class TapestryServlet which uses TapestryInit
>  3) Rewrite TapestryFilter to use TapestryInit
>  Am I right?
>  --
>  View this message in context: http://www.nabble.com/groovy-grails-and-tapestry-5-integration-experiments-tp17035475p17044538.html
>
>
> Sent from the Tapestry - Dev mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: dev-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: groovy grails and tapestry 5 integration experiments

Posted by ice96 <ic...@gmail.com>.
As I understand, to make Tapestry more friendly with integration we need to
write a little chainge tappestry TapestryFilter:
1) Take out from TapestryFilter to more reusable class. Lets say
TapestryInit
2) Create class TapestryServlet which uses TapestryInit
3) Rewrite TapestryFilter to use TapestryInit
Am I right?
-- 
View this message in context: http://www.nabble.com/groovy-grails-and-tapestry-5-integration-experiments-tp17035475p17044538.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: groovy grails and tapestry 5 integration experiments

Posted by Howard Lewis Ship <hl...@gmail.com>.
In case that wasn't coherent; a servlet mapping seems to be easier for
integration but isn't currently supported by T5.  It could be, if it
would make this style of integration easier.

On Sat, May 3, 2008 at 4:54 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> Very hard to follow without some understanding of Grails.
>
>  The question is: how hard would it be to change Tapestry to work as a
>  filter or as a servlet?  I think filter has advantages for many
>  applications (and is maximually concise), but servlet has advantages
>  when integrating Tapestry into other applications.
>
>
>
>  On Sat, May 3, 2008 at 7:00 AM, ice96 <ic...@gmail.com> wrote:
>  >
>  >  Hello,
>  >   I' m traing to integrate tapestry 5 in grails. I read in this
>  >  http://www.troymaxventures.com/search/label/grapestry this   blog how to
>  >  integrate tapestry 4. At the moment my problem that tapestry does not have
>  >  org.apache.tapestry.ApplicationServlet and I can't bind .tml files.
>  >
>  >  grails plugin looks like this:
>  >
>  >
>  >  class Tapestry5GrailsPlugin {
>  >   def version = 0.1
>  >   def dependsOn = [:]
>  >   // This removes the Grails standard controllers plugin, which means that
>  >  standard Grails actions and such would not work anymore.
>  >   def evicts=['controllers']
>  >
>  >   def doWithSpring = {
>  >   // TODO Implement runtime spring config (optional)
>  >   }
>  >   def doWithApplicationContext = { applicationContext ->
>  >   // TODO Implement post initialization spring config (optional)
>  >   }
>  >   def doWithWebDescriptor = { xml ->
>  >
>  >
>  >                         /*
>  >  def servlets = xml.servlet[0]
>  >                 servlets + {
>  >                 servlet {
>  >                    'servlet-name'('tapestryapplication')
>  >                    'servlet-class'('org.apache.tapestry.ApplicationServlet')
>  >                    'load-on-startup'(1)
>  >                }
>  >         }
>  >
>  >
>  >
>  >
>  >
>  >
>  >                 def mappings = xml.'servlet-mapping'[0]
>  >                mappings + {
>  >                  'servlet-mapping' {
>  >                        'servlet-name'('tapestryapplication')
>  >                        'url-pattern'('/app')
>  >                   }
>  >                    'servlet-mapping' {
>  >                        'servlet-name'('tapestryapplication')
>  >                        'url-pattern'('*.html')
>  >                   }
>  >                   'servlet-mapping' {
>  >                        'servlet-name'('tapestryapplication')
>  >                        'url-pattern'('*.direct')
>  >                   }
>  >                    'servlet-mapping' {
>  >                        'servlet-name'('tapestryapplication')
>  >                        'url-pattern'('*.sdirect')
>  >                   }
>  >                    'servlet-mapping' {
>  >                        'servlet-name'('tapestryapplication')
>  >                        'url-pattern'('*.svc')
>  >                   }
>  >                    'servlet-mapping' {
>  >                        'servlet-name'('tapestryapplication')
>  >                        'url-pattern'('/assets/*')
>  >                   }
>  >                }
>  >
>  >  */
>  >
>  >          def contextParam = xml.'context-param'[0]
>  >          contextParam + { 'context-param' {
>  >         'param-name'('tapestry.app-package')
>  >         'param-value'('org.tapestry.myapp')
>  >     }}
>  >
>  >
>  >            def filter = xml.filter[0]
>  >     filter + {
>  >         'filter-name'('app')
>  >         'filter-class'('org.apache.tapestry.TapestryFilter')
>  >     }
>  >
>  >     def filterMapping = xml.'filter-mapping'[0]
>  >     filterMapping + {
>  >         'filter-name'('app')
>  >         'url-pattern'('/*')
>  >     }
>  >
>  >
>  >
>  >   }
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >   def doWithDynamicMethods = { ctx ->
>  >   // TODO Implement additions to web.xml (optional)
>  >   }
>  >   def onChange = { event ->
>  >   // TODO Implement code that is executed when this class plugin class is
>  >  changed
>  >   // the event contains: event.application and event.applicationContext
>  >  objects
>  >   }
>  >   def onApplicationChange = { event ->
>  >   // TODO Implement code that is executed when any class in a
>  >  GrailsApplication changes
>  >   // the event contain: event.source, event.application and
>  >  event.applicationContext objects
>  >   }
>  >  }
>  >
>  >
>  >
>  >  Has anyone ideas?
>  >
>  >  --
>  >  View this message in context: http://www.nabble.com/groovy-grails-and-tapestry-5-integration-experiments-tp17035475p17035475.html
>  >  Sent from the Tapestry - Dev mailing list archive at Nabble.com.
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>  >  For additional commands, e-mail: dev-help@tapestry.apache.org
>  >
>  >
>
>
>
>  --
>  Howard M. Lewis Ship
>
>  Creator Apache Tapestry and Apache HiveMind
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: groovy grails and tapestry 5 integration experiments

Posted by Howard Lewis Ship <hl...@gmail.com>.
Very hard to follow without some understanding of Grails.

The question is: how hard would it be to change Tapestry to work as a
filter or as a servlet?  I think filter has advantages for many
applications (and is maximually concise), but servlet has advantages
when integrating Tapestry into other applications.

On Sat, May 3, 2008 at 7:00 AM, ice96 <ic...@gmail.com> wrote:
>
>  Hello,
>   I' m traing to integrate tapestry 5 in grails. I read in this
>  http://www.troymaxventures.com/search/label/grapestry this   blog how to
>  integrate tapestry 4. At the moment my problem that tapestry does not have
>  org.apache.tapestry.ApplicationServlet and I can't bind .tml files.
>
>  grails plugin looks like this:
>
>
>  class Tapestry5GrailsPlugin {
>   def version = 0.1
>   def dependsOn = [:]
>   // This removes the Grails standard controllers plugin, which means that
>  standard Grails actions and such would not work anymore.
>   def evicts=['controllers']
>
>   def doWithSpring = {
>   // TODO Implement runtime spring config (optional)
>   }
>   def doWithApplicationContext = { applicationContext ->
>   // TODO Implement post initialization spring config (optional)
>   }
>   def doWithWebDescriptor = { xml ->
>
>
>                         /*
>  def servlets = xml.servlet[0]
>                 servlets + {
>                 servlet {
>                    'servlet-name'('tapestryapplication')
>                    'servlet-class'('org.apache.tapestry.ApplicationServlet')
>                    'load-on-startup'(1)
>                }
>         }
>
>
>
>
>
>
>                 def mappings = xml.'servlet-mapping'[0]
>                mappings + {
>                  'servlet-mapping' {
>                        'servlet-name'('tapestryapplication')
>                        'url-pattern'('/app')
>                   }
>                    'servlet-mapping' {
>                        'servlet-name'('tapestryapplication')
>                        'url-pattern'('*.html')
>                   }
>                   'servlet-mapping' {
>                        'servlet-name'('tapestryapplication')
>                        'url-pattern'('*.direct')
>                   }
>                    'servlet-mapping' {
>                        'servlet-name'('tapestryapplication')
>                        'url-pattern'('*.sdirect')
>                   }
>                    'servlet-mapping' {
>                        'servlet-name'('tapestryapplication')
>                        'url-pattern'('*.svc')
>                   }
>                    'servlet-mapping' {
>                        'servlet-name'('tapestryapplication')
>                        'url-pattern'('/assets/*')
>                   }
>                }
>
>  */
>
>          def contextParam = xml.'context-param'[0]
>          contextParam + { 'context-param' {
>         'param-name'('tapestry.app-package')
>         'param-value'('org.tapestry.myapp')
>     }}
>
>
>            def filter = xml.filter[0]
>     filter + {
>         'filter-name'('app')
>         'filter-class'('org.apache.tapestry.TapestryFilter')
>     }
>
>     def filterMapping = xml.'filter-mapping'[0]
>     filterMapping + {
>         'filter-name'('app')
>         'url-pattern'('/*')
>     }
>
>
>
>   }
>
>
>
>
>
>
>
>
>
>
>   def doWithDynamicMethods = { ctx ->
>   // TODO Implement additions to web.xml (optional)
>   }
>   def onChange = { event ->
>   // TODO Implement code that is executed when this class plugin class is
>  changed
>   // the event contains: event.application and event.applicationContext
>  objects
>   }
>   def onApplicationChange = { event ->
>   // TODO Implement code that is executed when any class in a
>  GrailsApplication changes
>   // the event contain: event.source, event.application and
>  event.applicationContext objects
>   }
>  }
>
>
>
>  Has anyone ideas?
>
>  --
>  View this message in context: http://www.nabble.com/groovy-grails-and-tapestry-5-integration-experiments-tp17035475p17035475.html
>  Sent from the Tapestry - Dev mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: dev-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org