aspose file tools*
The moose likes JSF and the fly likes Head tag in RichFaces Ajax response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Head tag in RichFaces Ajax response" Watch "Head tag in RichFaces Ajax response" New topic
Author

Head tag in RichFaces Ajax response

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

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

Joined: Jul 20, 2005
Posts: 10210
    
166

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?

[My Blog] [JavaRanch Journal]
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

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

Joined: Jul 20, 2005
Posts: 10210
    
166

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

Joined: Oct 01, 2001
Posts: 2854
    
  11

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

Joined: Oct 01, 2001
Posts: 2854
    
  11

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

Joined: Jul 20, 2005
Posts: 10210
    
166

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

Joined: Jul 20, 2005
Posts: 10210
    
166

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

Joined: Oct 01, 2001
Posts: 2854
    
  11

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head tag in RichFaces Ajax response