Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head tag in RichFaces Ajax response

 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try the Live Demo for Ajax Support, I can see a very compact Ajax response returned. In particular, the head section is completely empty:



When I deploy the example code into my environment, which is JSF 2.0, RichFaces 3.3.3, the Ajax header comes back with a large head section:



I see an issue was logged at: https://issues.jboss.org/browse/RF-3273, but closed without resolution. Clearly, the Live Demo has solved the problem, but I don't how. Our application is using quite a bit of Ajax, and the large responses of useless head tag information is killing performance. Usually, the head section is much larger than is showed in this example, and so can comprise 90% or more of the total response size.

I posted this question some time ago at https://community.jboss.org/thread/222923, but never received a response.>
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg,

What does the original JSF page look like which triggers this AJAX event? Are you sure this indeed is triggering a AJAX request on your environment?
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran,

I took the code directly from the Live Demo page:



I believe it's sending an Ajax request. I can post the request on Monday when I get back on my work machine, but the response I posted above is an Ajax response, right? Would it be possible to get that response to a non-Ajax request?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote:

I can post the request on Monday when I get back on my work machine, but the response I posted above is an Ajax response, right?


Yes that does look like a response to an AJAX request.

As for the JIRA you linked, looking at the changes that were done as part of that JIRA (you can see the changes by clicking on the "Source" tab of that JIRA), it appears that those changes were moved out to some place else or discarded in a later commit of that class. But that doesn't explain why/how it explains on that demo site which apparently has the same version as what you have been using.
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what I get in Firebug for the request:

AJAXREQUEST=_viewRoot&myform=myform&myform%3Amyinput=hi&javax.faces.ViewState=8938730120642889405%3A-1120414097832593093&myform%3Aj_id3=myform%3Aj_id3&


Yes, I saw the source changes, and also some proposed changes to BaseXMLFilter, but neither seems to have been part of any released version of RichFaces as far as I can tell. I'm also confused about how the Live Demo is working ... whether it's a simple configuration issue that I've messed up or they actually hacked in changes to the RichFaces code, which seems unlikely. It's a pretty big deal to our application performance though, so I can't just let it drop.

 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now that I'm looking at it more closely, maybe those changes did get applied to the release code, but they only take affect when the load strategy is ALL.

I added these settings to web.xml:



That reduced the header section of the Ajax response to just the <title> tag. It's not empty, like in the Live Demo case, but it's much better than it was.

The way it looks to me is "ALL" doesn't mean to load every possible script and style in the RichFaces universe, it just means all the scripts and styles that could apply to the page given the various Ajax updates that are possible. Does that sound right? If so, then the initial page loads might be marginally bigger, but the Ajax responses will be much, much smaller. That would make me very happy. It would deal with the performance issues and be unlikely to break anything.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote:

The way it looks to me is "ALL" doesn't mean to load every possible script and style in the RichFaces universe, it just means all the scripts and styles that could apply to the page given the various Ajax updates that are possible. Does that sound right? If so, then the initial page loads might be marginally bigger, but the Ajax responses will be much, much smaller. That would make me very happy. It would deal with the performance issues and be unlikely to break anything.


I am not very familiar with RichFaces and the documentation doesn't explain this in detail. So I can't really say what the expected behaviour is. Sorry.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FWIW - Here's what the web.xml which backs that demo instance looks like http://anonsvn.jboss.org/repos/richfaces/tags/3.3.3.Final/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaikiran! I don't think I would have found that file on my own. It does have those two "strategy" settings that I'm using now, but also a few other tunings I don't recognize. It'll be a good jumping off point for further research.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic