[MAGNOLIA-2909] POST requests to Magnolia fail if Struts filter chain is used before the Magnolia chain Created: 26/Oct/09  Updated: 23/May/13  Resolved: 23/May/13

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

Type: Bug Priority: Major
Reporter: Andreas Antener Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: post, struts, struts2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

struts 2.1.6, tomcat 6


Attachments: Text File stacktrace.txt     XML File web.xml    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

First, what are we trying to do:
We have already existing applications that are using Struts and we would like to integrate them in Magnolia. The idea is to use these existing applications as paragraphs, which can be placed anywhere on the site.

JSP templates came in handy to include pages that are using struts tags. We added the struts filter-dispacher and mapped him BEFORE magnolia (see attachement).

From now on, struts tags get executed and they work as expected. However, the thing that does not work anymore are POST requests that are directed to Magnolia itself (meaning every Magnolia dialog / input etc.). Magnolia terminates parsing those request with the following exception:

java.io.IOException: Corrupt form data: premature ending
com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:205)
com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
info.magnolia.cms.filters.CosMultipartRequestFilter.parseParameters(CosMultipartRequestFilter
.... (see attachement for full stacktrace)

I read that this could be an MultipartParser-library related incompatibility with Struts:
http://stackoverflow.com/questions/240163/corrupt-form-data-premature-ending-resolved

Any suggestions?



 Comments   
Comment by Danilo Ghirardelli [ 03/Nov/09 ]

In a similar project we used the opposite approach, having struts actions mapped as Magnolia paragraphs, and it worked out well (except that you should disable Magnolia cache for pages with struts content). If you are interested you can take a look at the code here:
http://lab.openmindonline.it/lab/products/mgnlstruts.html

Comment by Andreas Antener [ 04/Nov/09 ]

Thank you for the hint.

I had a short look into the code. Basically what you are doing is delegating the action to struts for processing in a renderer, right?

In the meanwhile I tried to do something similar with a filter in the Magnolia filter chain. My filter just delegates the request to the struts dispacher. It works with post-requests if the filter is positioned after "multipartRequest". Also it was necessary to check on loops because struts calls Magnolia sites as result pages, which is why I'm not quite sure if this is the correct approach to solve it..

Comment by Andreas Antener [ 23/May/13 ]

Closing this issue since I believe it isn't relevant anymore.

Generated at Mon Feb 12 03:41:19 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.