• 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

Struts using ServletConfigInterceptor for accessing the HttpServletRequest.

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

First of all hi to all Ranchers ,



Is implementing the ServletRequestAware is not sufficient for accessing the ServleRequest .

why do we need a ServletConfigInterceptor interceptor to associate with the action ??
 
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
The interceptor is what calls setServletRequest() to actually set the servlet request.

Note that directly accessing the servlet request ties your class to the servlet spec and makes it less testable--in general you rarely need to do this.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David ,

After refering to the some sites i saw that implementing Aware interfaces in for access resources is a bad approach , and the best would be use the Spring Framework IOC for getting all these things to be done .

Is this would be the right approach ??
 
David Newton
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
That would depend on what resources you're trying to access.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Generally these resources like Request ,Response , Context , and Config are sufficient know to work (Correct me please if i am wrong).

And also i want to use Hibernate as ORM , so i will mention all these like in a ApplicationContext XML file.

Will this be a correct approach ??
 
David Newton
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
Again: it should be rare that you need to access the request (or response) directly in S2.

"Context" means nothing by itself; I don't know what context you're talking about. Same with "Config".

If you have Spring questions, ask them in the Spring forum.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Again: it should be rare that you need to access the request (or response) directly in S2."


This is waht i am looking for.
Thanks once again.
 
David Newton
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
Okay, but that doesn't really have anything to do with Spring or the original question regarding the interceptor.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic