I have a Non Action Class in my Struts2 application where I want to get the HttpServletRequest and HttpServletResponse.
The class is called by a scheduler and I want to execute the job based on what I receive from the from a session.
I ran into the issue while trying to use Async Supported.
Here is my block of code:
public void executeSync(HttpServletRequest req, HttpServletResponse res) {
final AsyncContext asyncContext = req.startAsync(req, res);
asyncContext.start(new Runnable() {
@Override
public void run() {
try {
// try doing the sync asynchronously ...
}catch(Exception ex){
ex.printStackTrace();
}
finally {
asyncContext.complete();
}
}
});
}
The Issue is how to get the request and response to parse.
I really need help.