• 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

Adding and removing headers

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,
The request to my servlet, can have no HTTP headers. In this case I should add HTTP headers before sending it to the servlet. Also the response coming from the servlet should be stripped down of the HTTP header's before leaving the server. Heard that filters can be used for this purpose.
Someone please shed more light on how to do it.
Zafer
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's probably not a good idea to be dependent on the absence of HTTP headers either coming or going. They're there for a reason.
If your client is a Java client, you can do the next best thing - contact the server with an HttpURLRequest and simply ignore the headers - which you won't even see.
On the other hand, if you truly need a protocol that is like HTTP but without headers, you should write your servlet using the non-HTTP Servlet base class (which itself serves as the base class for HttpServlet). You'll also have to configure your container to use a non-HTTP conduit, and the details of this you'll need to get from the docs specific to your appserver.
Just as a reminder, you can't use this technique to attempt to wrench the servlet architecture into behaving like a client/server system. As long as it's a servlet, it's still contrained to strict request-response communications whether it uses HTTP or not.
 
reply
    Bookmark Topic Watch Topic
  • New Topic