Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic in doOptions()

 
Andy Jung
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
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2534
113
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic