The actual question is how can i provide a "do nothing" struts 2 action for the error message described below.
I want to embed a Vaadin application in a JSP used by Struts 2.
While the Vaadin part is sound, beeing a separate servlet, Struts 2 goes into an endless loop saying:
it can't find a There is no Action mapped for action name VaadinvizApplication/UIDL/
so, whatever communication Vaadin is doing, i don't want struts 2 meddling with it if i can. How do i configure struts 2 for that in this case?
I'm not sure what you're asking--what do you need a Struts 2 action for if it's a servlet?
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
While displaying the web page, it goes in an infinite loop, displaying this error:
There is no Action mapped for action name VaadinvizApplication/UIDL/
VaadinvizApplication beeing my Vaadin servlet mapped path. Vaadin communicates through UIDL a lot asynchronously.
Struts 2 catches every request / response like an action and wants to do something about it since it filters everything with /*
UIDL is a Vaadin class that gets called asynchronously often, but i don't want Struts 2 to be doing anything about it.
That's why i asked "how can i provide a 'do nothing' struts 2 action".
I want to know how to map VaadinvizApplication/UIDL/ so i can just return "success" or nothing to the same page because i don't want to do nothing with the Struts 2 action.
P.S. I suspect the communication starts from Vaadin through UIDL, and sometime, Struts 2 gets in the way filtering the response by not beeing mapped, and it doesn't get to Vaadin.
If Struts 2 would just forward or ignore the Vaadin comms, i believe there wouldn't be a problem.
Are you in development mode? I guess I thought if S2 didn't see an action suffix (whatever you have that defined as--if you have a blank this could be causing the problem) it'd just pass it on without giving an error.
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
How would that action look?
I made this experiment sending the result to the test2.jsp (simplified example - link below),
and i noticed this: struts 2 loads the jsp that embeds the Vaadin app, which communicates with its server counterpart for syncronization or something. Struts 2 catches this as an action, and since i send the response back to the page, the embedded vaadin app gets loaded again, which instead sends the UIDL communication again, which creates the infinite loop. How would i get out of this endless loop by configuring struts 2 properly. I want Struts 2 to ignore anything that contains "UIDL" for instance. war here:
http://vaadin.com/forum/-/message_boards/message/99801
I'm saying that you shouldn't have an action defined if you don't want Struts 2 to process a URL.
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
With no action defined, i get:
There is no Action mapped for namespace / and action name . - [unknown location]
when trying to acces the JSP i get:
There is no Action mapped for action name VaadinStruts2Application/UIDL/. - [unknown location]
still in the infinite loop too.
Doesn't seem to matter what i map (except i don't get the errors now):
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
Ok, seems i've done it, the struts 2 just needs to send the intercepted UIDL to 'there be dragons', since it isn't suppose to do anything to it. I wish i knew how to ignore 'UIDL' requests. I'll update the war in the other forum with a working war.
What version of S2 are you using? You never answered what your action extension is--if it's S2.1 the default includes extension-less actions, which could be the problem.
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
2.1.8.1
Vaadin framework has a client - server communication set up over a wrapper on top of JSON. Struts 2 hooks into that, although i don't understand perfectly well how i ended up in the infinite loop. As i observed, every time Vaadin gets embedded into the page, it sends a communication to its server side to be rendered. My guess is because i was responding with the same page, the embedding happened again, the communication happened again, and so on and so forth, an infinite loop.
No didn't quite get that, you mean the classes that don't need to subclass ActionSupport?
I knew this. Don't they need their name to end in Action?
I can't relate to my problem with that.
No, I mean that in Struts 2.0, the action extension was ".action". URLs not ending in ".action" were ignored.
In Struts 2.1 the action extension is ".action,,". URLs without an extension are *NOT* ignored by Struts. If you change the action extension to ".action" your problem will go away and you won't need to map an "empty" action to the servlet URL.
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
Ok, sorry but i still don't get it, how would i call my page?
When calling: http://localhost:8080/VaadinStruts2/test.action i receive: There is no Action mapped for namespace / and action name test. - [unknown location]
I even wrote a test class, still doesn't work.
which embeds Vaadin. At this point i suspect a UIDL communication starts from AJAX, triggering the struts2 filter, which messes things up.
i even tried <url-pattern>/VaadinStruts2Application/*.action</url-pattern>, because the UIDL is the culprit i think, although it appends a '/' as you can see above and i can't guess what the mapping should look like.
I'm saying that if you fix the action extension configuration you shouldn't have a problem.
Tudor Raneti
Ranch Hand
Joined: Nov 29, 2009
Posts: 145
posted
0
I understood that, thank you. However, i don't know how to apply that in my case other than downgrading to an older Struts 2. I tried appending .action everywhere it seemed logical.
EDIT: although this seems to work too, perhaps because it's sending the UIDL object nowhere again:
Found struts2-core-2.1.8.1.jar\org\apache\struts2\default.properties
struts.action.extension=action,,
...so it should be ignored by default because the action .../UIDL/ ends in / ?
Lost again here, what should i write in:
<constant name="struts.action.extension" value="action,," /> in my struts.xml ?
Tried a couple of things, didn't work.