I am trying to figure out how to encrypt the viewstate using JSF 1.2 and Mojarra. The odd thing is that it seems to be encrypted by default on some servers, but not on others. For example, on my localhost I see the following:
<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-40233784603124937:-3413182513789758151" autocomplete="off" />
But on our Test environment servers I get:
<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id4:j_id5" />
You'll notice two differences between those two:
- The first has autocomplete="off"
- The first has the viewState value encrypted, whereas the second does not
The problem is that I cannot figure out for the life of me why the two are different. The codebase is the same on my localhost as on the server. There are no configuration options specified in my web.xml, so I would have assumed that my localhost would not be encrypted (as that is the default, right?).
Per the Mojarra documentation I should add:
<env-entry>
<env-entry-name>com.sun.faces.ClientStateSavingPassword</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>[SOME VALUE]</env-entry-value>
</env-entry>
But that seems to be specifically for client state saving, not server side state saving. And unless I'm misunderstanding things, I'm using server side state saving (at least, I can't find anywhere that we have configured javax.faces.STATE_SAVING_METHOD.
So, my questions:
- Why would my configuration be different between localhost and the server? Is there somewhere else options could be specified other than web.xml?
- How do I enable viewState encryption (like on my localhost) on all our servers?
Configuration:
- Jboss 5.1.0.GA
- Mojarra 1.2_12-b01-FCS
- Seam 2.2.0.GA