• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actions are instantiated per-request.
 
anand kumarblr
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks i think that solves the problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic