0

I am a bit unclear, it seems request.getAttribute (or setAttribute) is for application scope i.e. shared accross all servlets in the application.

Is there something that I can get/set on a per request (not session, but per web request) scope?

Example, in a filter, I may want to add something for this request only that I get then retrieve in my servlet's doGet.

codecompleting
  • 9,251
  • 13
  • 61
  • 102

2 Answers2

3

it seems request.getAttribute (or setAttribute) is for application scope i.e. shared accross all servlets in the application.

This is not true. This is only applicable to those methods on ServletContext. You're apparently mixing it with HttpServletRequest or misinterpreting the concrete problem you're currently facing, but didn't tell anything about in your question. The HttpServletRequest instance and all of its attributes is definitely request scoped.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

"Application scope" mean normal java object and classes. Use static fields, singletons, e.t.c

korifey
  • 3,379
  • 17
  • 17