You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (Created) (JIRA)" <ji...@apache.org> on 2012/01/21 15:58:40 UTC

[jira] [Created] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Add more programmatic support for web app construction via servlet 3.0 
-----------------------------------------------------------------------

                 Key: WICKET-4350
                 URL: https://issues.apache.org/jira/browse/WICKET-4350
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 6.0.0
            Reporter: Peter Ertl
            Assignee: Peter Ertl
            Priority: Minor
             Fix For: 6.0.0


Since servlet 3.0 web applications can be set up completely in code.

To support this kind of setup wicket should

- support the manual assignment of an web application instance to WicketFilter
- support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml

sample code for demonstrating the use case:

public class AppContextListener implements ServletContextListener
{
	private GuiceContext guiceContext;

	@Override
	public void contextInitialized(ServletContextEvent sce)
	{
		// create configuration
		final AppConfig configuration = new WebAppConfig();

		// setup guice
		guiceContext = new GuiceContext(configuration);

		// create injector
		final Injector injector = guiceContext.createInjector();

		// create wicket application
		WebApplication application = injector.getInstance(WebApplication.class);
		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);

		// create wicket filter
		WicketFilter filter = new WicketFilter(application);
		filter.setFilterPath("");

    // dynamically add wicket filter
		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);

		// add filter mapping for path '/'
		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
	}
	
  // ...
}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Ertl updated WICKET-4350:
-------------------------------

    Affects Version/s: 1.5.4
        Fix Version/s: 1.5.5
    
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246301#comment-13246301 ] 

Peter Ertl edited comment on WICKET-4350 at 4/4/12 2:38 PM:
------------------------------------------------------------

During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what variant the servers I tested in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)

Based on my current knowledge scanning for java service initializers in app servers seems unpredictable / broken to me.

For a platform independent startup you probably have to deploy a duplicate 'javax.servlet.ServletContainerInitializer' file supporting variant (a) and (b). I don't know if there exist even more variants.

Consider, if you have the choice, to use 'web.xml' with an <listener> entry and configure your application using ServletContextListener. This will be old-school but should work anywhere.
                
      was (Author: pete):
    During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what the servers used in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)

Based on my current knowledge scanning for java service initializers in app servers seems unpredictable / broken to me.

For a platform independent startup you probably have to deploy a duplicate 'javax.servlet.ServletContainerInitializer' file supporting variant (a) and (b). I don't know if there exist even more variants.

Consider, if you have the choice, to use 'web.xml' with an <listener> entry and configure your application using ServletContextListener. This will be old-school but should work anywhere.
                  
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190436#comment-13190436 ] 

Peter Ertl commented on WICKET-4350:
------------------------------------

done in master
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.0.0
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 6.0.0
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190657#comment-13190657 ] 

Peter Ertl commented on WICKET-4350:
------------------------------------

added to roadmap, thanks for pointing out, Igor
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.0.0
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 6.0.0
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246301#comment-13246301 ] 

Peter Ertl edited comment on WICKET-4350 at 4/4/12 4:57 PM:
------------------------------------------------------------

During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

I tested on OS X 10.7.3 running Java 1.6.0_29 (64 bit), this is what the servers supported:
 
jboss 7.1.1: (a)
tomcat 7.0.26: (a)
jetty 8.1.2: (a) + (b)
glassfish 3: (a) + (b)


So only (a) seems to work officially...

Feel free to paste the proper section of the JSR here :-)

In short:
To properly execute your service initializer it has to be located in a JAR file at location '/META-INF/services', it will not reliably work in a WAR file though some servers support it!
                
      was (Author: pete):
    During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what variant the servers I tested in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)


update:

I don't have enough time for testing but it seems that (a) works always and some servers support (b)
                  
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246301#comment-13246301 ] 

Peter Ertl edited comment on WICKET-4350 at 4/4/12 2:47 PM:
------------------------------------------------------------

During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what variant the servers I tested in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)


update:

I don't have enough time for testing but it seems that (a) works always and some servers support (b)
                
      was (Author: pete):
    During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what variant the servers I tested in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)
                  
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Ertl resolved WICKET-4350.
--------------------------------

    Resolution: Fixed
    
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.0.0
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 6.0.0
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190659#comment-13190659 ] 

Peter Ertl commented on WICKET-4350:
------------------------------------

Since the change does not break the api contract also applied to wicket-1.5.x
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246312#comment-13246312 ] 

Peter Ertl commented on WICKET-4350:
------------------------------------

To make your life easy you can use spring's

   org.springframework.web.WebApplicationInitializer

(see javadoc for details)
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246301#comment-13246301 ] 

Peter Ertl commented on WICKET-4350:
------------------------------------

During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what the servers used in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)

Based on my current knowledge scanning for java service initializers in app servers seems unpredictable / broken to me.

For a platform independent startup you probably have to deploy a duplicate 'javax.servlet.ServletContainerInitializer' file supporting variant (a) and (b). I don't know if there exist even more variants.

Consider, if you have the choice, to use 'web.xml' with an <listener> entry and configure your application using ServletContextListener. This will be old-school but should work anywhere.
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Igor Vaynberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190486#comment-13190486 ] 

Igor Vaynberg commented on WICKET-4350:
---------------------------------------

you should add this to the roadmap page
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.0.0
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 6.0.0
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Peter Ertl (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246301#comment-13246301 ] 

Peter Ertl edited comment on WICKET-4350 at 4/4/12 2:47 PM:
------------------------------------------------------------

During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what variant the servers I tested in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)
                
      was (Author: pete):
    During my tests with my local 'test.war' file I just found out that there are "subtle" differences in the way application servers are scanning for 'META-INF/services'. Depending on the app server it will look for either

(a) folder 'META-INF/services' inside 'test.jar' which is packaged in 'test.war' at package location 'WEB-INF/lib/test.jar'
(b) folder 'META-INF/services' residing in the root of 'test.war' (not to be confused with the web root in src/main/webapp), not needing a separate test.jar

This is what variant the servers I tested in my local setup on OS X 10.7.3 running Java 1.6.0_29 (64 bit) used:
 
jboss 7.1.1:   (a)
tomcat 7.0.26: (a)
jetty 8.1.2:   (b)
glassfish 3:   (b)

Based on my current knowledge scanning for java service initializers in app servers seems unpredictable / broken to me.

For a platform independent startup you probably have to deploy a duplicate 'javax.servlet.ServletContainerInitializer' file supporting variant (a) and (b). I don't know if there exist even more variants.

Consider, if you have the choice, to use 'web.xml' with an <listener> entry and configure your application using ServletContextListener. This will be old-school but should work anywhere.
                  
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4350) Add more programmatic support for web app construction via servlet 3.0

Posted by "Martin Grigorov (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov updated WICKET-4350:
------------------------------------

    Attachment: javax.servlet.ServletContainerInitializer
                Start.java
                Initializer.java

Here is a set of files which make it working in Jetty. Start.java is only needed for embedded Jetty.
The key is that DefaultServlet needs to be registered as well. Otherwise WicketFilter has nothing to filter and there is no one to serve static resources.
                
> Add more programmatic support for web app construction via servlet 3.0 
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4350
>                 URL: https://issues.apache.org/jira/browse/WICKET-4350
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: Peter Ertl
>            Assignee: Peter Ertl
>            Priority: Minor
>             Fix For: 1.5.5, 6.0.0-beta1
>
>         Attachments: Initializer.java, Start.java, javax.servlet.ServletContainerInitializer
>
>
> Since servlet 3.0 web applications can be set up completely in code.
> To support this kind of setup wicket should
> - support the manual assignment of an web application instance to WicketFilter
> - support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml
> sample code for demonstrating the use case:
> public class AppContextListener implements ServletContextListener
> {
> 	private GuiceContext guiceContext;
> 	@Override
> 	public void contextInitialized(ServletContextEvent sce)
> 	{
> 		// create configuration
> 		final AppConfig configuration = new WebAppConfig();
> 		// setup guice
> 		guiceContext = new GuiceContext(configuration);
> 		// create injector
> 		final Injector injector = guiceContext.createInjector();
> 		// create wicket application
> 		WebApplication application = injector.getInstance(WebApplication.class);
> 		application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT);
> 		// create wicket filter
> 		WicketFilter filter = new WicketFilter(application);
> 		filter.setFilterPath("");
>     // dynamically add wicket filter
> 		final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter);
> 		// add filter mapping for path '/'
> 		wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
> 	}
> 	
>   // ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira