Skip to content

Refactor JettyEmbeddedServletContainerFactory for better third-party gradle plugin integration #1056

@akhikhl

Description

@akhikhl

@philwebb, Gretty integration with spring-boot now works perfectly well (on Gretty dev branch). I am even able to start multiple webapp contexts, https, etc. etc. - all Gretty features!

I created new class org.akhikhl.gretty.springboot.ServletContainerFactory which extends from JettyEmbeddedServletContainerFactory and overrides getEmbeddedServletContainer. This class works, although there are some little problems.

Problem 1

addDefaultServlet and addJspServlet are private in JettyEmbeddedServletContainerFactory, but I need to call them in derived class in order to properly initialize webapp contexts.

Current solution

I copy-pasted the code of
addDefaultServlet and addJspServlet to a derived class.

Desired solution

It would be nice if addDefaultServlet and addJspServlet could be made protected in JettyEmbeddedServletContainerFactory, so that derived classes can call them.

Problem 2

JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer creates and configures only one webapp context, but I need to create and configure multiple webapp contexts.

Current solution

I've overriden getEmbeddedServletContainer and copy-pasted the code dealing with webapp context.

Desired solution

It would be nice to have getEmbeddedServletContainer refactored, so that code configuring webapp context is moved to a new protected method, something like configureWebappContext. Then both JettyEmbeddedServletContainerFactory and derived classes can call this method.

If I am allowed, I can contribute with Pull Request.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions