Yes it is possible. the servlet specification nowhere prohibits a session from being destroyed during an active request. Thus, you risk a ViewExpiredException when such a load arrives at the bean.
If this bothers you, you have several options:
Allows you to download the asynchronous polling form on the server at intervals to save the session. You can use #{session.maxInactiveInterval} in EL to get the current timeout in seconds.
<p:fileUpload ... /> <p:poll interval="#{session.maxInactiveInterval - 10}" async="true" />
The difference of 10 seconds is only to prevent it from arriving too late for a few seconds, because the page itself may take some time to load all the HTML and initialize the survey. If necessary, you can conditionally start / display a poll at the start of the download.
Let the "onstart" event for download increase the session timeout to a certain limit (hour?) And allow the "oncomplete" event upload to return it.
<p:fileUpload ... onstart="increaseTimeout()" oncomplete="resetTimeout()" /> <p:remoteCommand name="increaseTimeout" listener="#{bean.increaseTimeout}" /> <p:remoteCommand name="resetTimeout" listener="#{bean.resetTimeout}" />
You can use ExternalContext#setSessionMaxInactiveInterval() in the bean to set the desired session timeout in seconds.
Use the stateless form of JSF. The view will never expire, no matter how the HTTP session behaves.
<f:view transient="true"> ... </f:view>
Note. Any view covered by beans tied to that kind will behave as query-bound areas. To avoid confusion, replace annotations if necessary.
source share