• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

logic in doOptions()  RSS feed

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

if I do a OPTIONS http-request to my specific HttpServlet, how does the standard doOptions()-method know, which HTTP-methods I support? Is this done by reflection ?

Kind regards,
Andy
 
Creator of Enthuware JWS+ V6
Posts: 3241
283
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andy,

The specifications do not say how that is suppose to be implemented, but the people writing the code of the servlet-container might do it by using reflection.

This is what is written in the specs (servlet2.4)

doOptions(HttpServletRequest, HttpServletResponse)
Called by the server (via the service method) to allow a servlet to handle a
OPTIONS request. The OPTIONS request determines which HTTP methods
the server supports and returns an appropriate header. For example, if a servlet
overrides doGet, this method returns the following header:
Allow: GET, HEAD, TRACE, OPTIONS

There’s no need to override this method unless the servlet implements new
HTTP methods, beyond those implemented by HTTP 1.1.



Regards,
Frits
 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,

thanks, so I just rely on the container-implementors that they do it right, no matter how they achieve this (by reflection, etc. ... ).

Kind regards,
Andy
 
It means our mission is in jeapordy! Quick, read this tiny ad!
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!