问题
I'm doing some development work in JSF with MyFaces and I got this warning.
*******************************************************************
*** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode. ***
*** ^^^^^^^^^^^ ***
*** Do NOT deploy to your live server(s) without changing this. ***
*** See Application#getProjectStage() for more information. ***
*******************************************************************
What is the difference between development and production mode? Are there security risks? Is it just performance enhancements?
回答1:
There are no security risks, there are however performance implications. When project stage is set to development, then there will more often be logged and less be cached.
With regard to logging, additional debug information about how components are built and rendered will be logged. For example, if you have a <h:inputText>
without any parent <h:form>
, then this will be logged and displayed as a faces message. All queued faces messages which are not displayed in any of <h:message(s)>
components will be displayed anyway in a separate message list at the bottom of the page, with an orange warning font, indicating "undisplayed" messages. Also, the exception handling is different, MyFaces will instead of the <error-page>
show a rich error page including detail about the component tree and scoped variables.
With regard to caching, the Facelet cache will refresh more regularly. So if you make changes in a Facelet file and press F5, then the changes will "immediately" be reflected. This is not true for production stage, you'd basically need to restart the whole server.
Also the jsf.js
JavaScript file will show up as the unminified version, allowing easier JS debugging in the webbrowser. In production stage, it's instead the minified version, which is thus smaller and faster to serve, but it is completely unreadable.
Mojarra has much similar behaviour, expect of the rich error page.
来源:https://stackoverflow.com/questions/13960829/whats-the-difference-between-development-and-production-in-myfaces