• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 - Using ServletRequestAware is ok if we have multiple methods in action class?

 
anand kumarblr
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam using struts2 Action.In single action class iam having 4 methods.
I have a separate action mapping names for all 4 methods and it works fine.

Before i was using HttpServletRequest request = ServletActionContext.getRequest();
in all 4 methods to get request object.

Now i changed the action class to implement ServletRequestAware interface.
and added in class..
private HttpServletRequest request;
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}

Now all 4 methods accessing the common request object.

I want know whether it will create concurrency problem when multiple Users try to access different methods at the same time
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actions are instantiated per-request.
 
anand kumarblr
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks i think that solves the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic