[MAGNOLIA-8286] As a developer, I can add a servlet via annotation or web.xml Created: 21/Jan/22  Updated: 10/May/22  Resolved: 31/Mar/22

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0

Type: Story Priority: Neutral
Reporter: David Lopez Assignee: Fernando Cherchi
Resolution: Fixed Votes: 0
Labels: nucleus
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MAGNOLIA-8341 As a developer, I need a feature flag... Closed
Relates
relates to MAGNOLIA-8366 Create a list of all the modules that... Closed
dependency
is depended upon by MGNLREST-165 Re-enable scanning for providers Open
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Date of First Response:
Epic Link: Externalize user sensitive configuration
Sprint: Nucleus 4, Nucleus 5, Nucleus 6, Nucleus 7
Story Points: 3
Team: Nucleus

 Description   

Problem

Magnolia currently doesn't support proper servlet registration. Servlets are wrapped in filter chain as servlet. As consequence, developers can't easily register servlet in a standard way (annotation or web.xml).

Expected results

I can register servlets in a standard way.

I can override the servlet configuration (e.g. metadata-complete=false in web.xml and define explicitly in web.xml)

Actual results

Requests are terminated (404) before reaching the servlet.

Workaround

Cofigure a bypass in CMS filter so requests are not terminated before reaching the servlet.

Development notes

Termination can be prevent e.g. by introducing a default bypass voter on CMS filters which skips servlet requests (ServletContext#getServletRegistrations).



 Comments   
Comment by Roman Kovařík [ 22/Mar/22 ]

agomez QA steps (for MGNLUI-7038 as well) on a local cloud webapp:

  1. change metadata-complete="false" in magnolia-cloud/webapp/target/ROOT/WEB-INF/web.xml
  2. Start the webapp
  3. verify non JCR servlet mapping bypass is installed under /.magnolia/admincentral#app:configuration:browser;/server/filters/cms/bypasses:treeview:
  4. Set /.magnolia/admincentral#app:configuration:browser;/server/filters/servlets/Admincentral@enabled:treeview: to false
  5. You should get a session expired message but everything should work after reload and admincentral should be served from the servlet loaded via annotation from now on.
  6. Set /.magnolia/admincentral#app:configuration:browser;/server/filters/servlets/VaadinStatic@enabled:treeview: to false
  7. Reload to verify static resources are served from the servlet loaded via annotation as well.

(be aware that you wouldn't be able to access the admincentral if something goes wrong)

Comment by Roman Kovařík [ 23/Mar/22 ]

Reopened: see the suggestion on the PR.

Generated at Mon Feb 12 04:31:20 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.