• 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
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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
Bartender
Posts: 3143
276
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 is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!