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 ?
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)
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.
thanks, so I just rely on the container-implementors that they do it right, no matter how they achieve this (by reflection, etc. ... ).