• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Using filter, is it possible to insert name/value pair into header?

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking to put togeather a filter which would simulate the siteminder web agent. This web agent puts two variables into the header,
"sm-userid" & "sm-userdomain"; I would like to simulate this behavior but have not found any documentatio on adding header values. Can it be done?
Regards,
Joshua
 
author
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Joshua,
When you say "adding header values" do you mean "adding HTTP response hearder values"? If yes, then you can use the HttpServletResponse interface methods (addHeader, addIntHeader, addDataHeader) to modify or add headers to the response stream.
And, yes this can be done in a Filter becuase the response and request objectives are passed to the doFilter method.
Regards,
Bryan
 
Joshua White
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bryan,
Siteminder adds header values to the request. I would like to simulate this for our development environment. Unfortunately adding headers to the response will not help me here.
I have another filter which is looking for the siteminder information using request.getHeader("foo").
Any ideas?
Regards,
Joshua
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you can extend HttpServletRequestWrapper to create a class that will "wrap" a request to add your special functionality. Presumably you would then forward the wrapped request instead of the original one.
Have not tried this myself.
Bill
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic