ExecuteAndWait Interceptor

100 %
0 %
Information about ExecuteAndWait Interceptor
Technology

Published on September 17, 2014

Author: SeoTrainee1

Source: slideshare.net

Description

The ExecuteAndWaitInterceptor is used for running long-lived actions in the background while showing the user a progress meter(loader image using JavaScript) .

Struts Framework ExecuteAndWait Interceptor Introduction Apex T. G. India Pvt. Ltd

1 execAndWait  The ExecuteAndWaitInterceptor is used for running long-lived actions in the background while showing the user a progress meter(loader image using JavaScript) .  This also prevents the HTTP request from timing out when the action takes more than 5 or 10 minutes.

1 execAndWait  Using this interceptor is pretty straight forward.  Assuming that you are including struts-default.xml, and this interceptor is already configured but is not part of any of the default stacks then it wont work.  Because of the nature of this interceptor, it must be the last interceptor in the stack.

1 execAndWait  This interceptor works on a per-session basis.  It means, same action name ( DemoAction.class ) cannot be run more than once at a time in a given session. On the initial request or any subsequent requests (before the action has completed), the wait result will be returned.  The wait result is responsible for issuing a subsequent request back to the action, giving the effect of a self-updating progress meter.

1 execAndWait  If no "wait" result is found, Struts will automatically generate a wait result on the fly.  But this result is written in FreeMarker and cannot run unless FreeMarker is installed.  If you don't want to use it with FreeMarker then must provide a wait page as a result.

1 execAndWait  Whenever the wait result is returned, the action that is currently running in the background will be placed on top of the stack.  This allows you to display progress data, such as a count, in the wait page. By making the wait page automatically reload the request to the action (which will be short-circuited by the interceptor), can give the appearance of an automatic progress meter.

1 execAndWait  Whenever the wait result is returned, the action that is currently running in the background will be placed on top of the stack.  This allows you to display progress data, such as a count, in the wait page. By making the wait page automatically reload the request to the action (which will be short-circuited by the interceptor), can give the appearance of an automatic progress meter.

1 execAndWait  This interceptor also supports using an initial wait delay. An initial delay is a time in milliseconds let the server wait before the wait page is shown to the user.  During the wait this interceptor will wake every 100 milii second to check if the background process is done premature, thus if the job for some reason doesn't take to long the wait page is not shown to the user.

1 execAndWait  This is useful for e.g. search actions that have a wide span of execution time. Using a delay time of 2000 millis we ensure the user is presented fast search results immediately and for the slow results a wait page is used.  Important: Because the action will be running in a separate thread, We can't use ActionContext because it is a ThreadLocal.

1 execAndWait  The thread kicked off by this interceptor will be named in the form actionNameBackgroundProcess.  This means if we need to access session data, we need to implement SessionAware rather than calling ActionContext.getSession().

1 execAndWait  Parameters:threadPriority (optional) - the priority to assign the thread. Default is Thread.NORM_PRIORITY.  delay (optional) - an initial delay in millis to wait before the wait page is shown (returning wait as result code). Default is no initial delay.  delaySleepInterval (optional) - only used with delay. Used for waking up at certain intervals to check if the background process is already done. Default is 100 millis.

1 execAndWait <action name=“abc" class="com.abc.DemoAction <interceptor-ref name="execAndWait"/> <result name="wait">wait.jsp</result> <result name="success">success.jsp</result> </action>

Thanks Stay Connected with us for more chapters on JAVA facebook.com/apex.tgi twitter.com/ApextgiNoida pinterest.com/apextgi

Add a comment

Related presentations

Related pages

[Struts-user] ExecuteAndWait interceptor position? - Grokbase

Hello. In Struts Documentation i found that "Because of the nature of this interceptor, it must be the last interceptor in the stack." and in struts ...
Read more

Struts2 execAndWait interceptor example for long running ...

Struts2 execAndWait interceptor example for long running Actions Pankaj Last Updated: October 6, 2013 Struts 2.
Read more

java - Multiple file upload using execandwait interceptor ...

I'm trying to upload multiple files using the ExecuteAndWait Interceptor. I've done the file uploading part that works fine, but when I use execAndwait, I ...
Read more

Execute and Wait Interceptor - Apache Struts

The ExecuteAndWaitInterceptor is great for running long-lived actions in the background while showing the user a nice progress meter. This also prevents ...
Read more

Struts2 - execAndWait Interceptor (Struts forum at Coderanch)

... execAndWait Interceptor . ... Here you are configured executeAndWait interceptor explicitly so it's not going execute your default interceptor that's ...
Read more

org.apache.struts2.interceptor: ExecuteAndWaitInterceptor.java

20 */ 21 22 package org.apache.struts2.interceptor; 23 ... { 266 LOG.warn("ExecuteAndWait interceptor has detected that no result named ...
Read more

ExecuteAndWaitInterceptor org.apache.struts2.interceptor ...

ExecuteAndWaitInterceptor org.apache.struts2.interceptor.ExecuteAndWaitInterceptor ... ("ExecuteAndWait interceptor has detected that no result ...
Read more

Newest 'struts2-interceptors' Questions - Stack Overflow

I implemented executeAndWait Interceptor in Struts2 application and it is running fine. ... newest struts2-interceptors questions feed 105.
Read more

Interceptor | LinkedIn

View 7879 Interceptor posts, presentations, experts, and more. Get the professional knowledge you need on LinkedIn.
Read more