module JavaServlet: sig .. end
Support for Java servlets.
In order to produce a class to be used as either a servlet or a
servlet listener, it is necessary to compile the module with one of
the following command-line switches:
- -servlet generic;
- -servlet http;
- -servlet context-listener;
- -servlet context-attribute-listener;
- -servlet session-listener;
- -servlet session-activation-listener;
- -servlet session-attribute-listener;
- -servlet session-binding-listener;
- -servlet session-id-listener.
The compiled module has to abide (respectively) the following module
type:
Generic
;
HTTP
;
ServletContextListener
;
ServletContextAttributeListener
;
HTTPSessionListener
;
HTTPSessionActivationListener
;
HTTPSessionAttributeListener
;
HTTPSessionBindingListener
;
HTTPSessionIdListener
.
When a module
M is compiled with a command-line switch
-servlet x, an additional class with name
MImpl is produced.
The
MImpl class implements (or extends) the interface (or class)
related to
x. As an example, compiling with
-servlet http
with result in a class extending
javax.servlet.http.HttpServlet.
Generic servlets
type generic = javax'servlet'GenericServlet java_instance
Shorthand for the type of generic servlets.
type request = javax'servlet'ServletRequest java_instance
Shorthand for the type of requests to generic servlets.
type response = javax'servlet'ServletResponse java_instance
Shorthand for the type of responses to generic servlets.
module type Generic = sig .. end
The module type for servlets compiled with -servlet generic.
HTTP servlets
type http = javax'servlet'http'HttpServlet java_instance
Shorthand for the type of HTTP servlets.
type http_request = javax'servlet'http'HttpServletRequest java_instance
Shorthand for the type of requests to HTTP servlets.
type http_response = javax'servlet'http'HttpServletResponse java_instance
Shorthand for the type of responses to HTTP servlets.
module type HTTP = sig .. end
The module type for servlets compiled with -servlet http.
val options : http_response ->
[ `DELETE | `GET | `HEAD | `OPTIONS | `POST | `PUT | `TRACE ] list -> unit
options resp l
is an implementation of do_options _ _ _ resp
where l
is the list of methods supported by the servlet.
Listeners
module type HTTPSessionListener = sig .. end
The module type for listeners compiled with -servlet session-listener.
module type HTTPSessionIdListener = sig .. end
The module type for listeners compiled with -servlet session-id-listener.