Servlet

Servlet support in MINERVA follows the Java servlet standard.

See below for the list of servlet predicates defined in the package servlet. The meaning of these predicates corresponds one-to-one to their Java counterparts.

For a servlet usage example see Servlet

For a multipart/form-data servlet usage example see servlet/WEB-INF/minerva/test.min

For multipart data upload support, MINERVA offers a compact set of convenience predicates:

multipart_has_more_elements/1
multipart_next_element/2
multipart_get_content/2
multipart_get_content/3
multipart_get_stream/2
multipart_copyfile/2
multipart_create/2
multipart_create/3

multipart_create(+HttpServletRequest, -MultiPartFilter)

The predicate returns for a multipart/form-data request a multipart filter, which can from then on be used to extract the individual user data.

multipart_create(+HttpServletRequest, +Encoding, -MultiPartFilter)

The predicate returns for a multipart/form-data request with expected encoding a multipart filter, which can from then on be used to extract the individual user data.

multipart_has_more_elements(+MultiPartFilter)

The predicate returns true if there exist other not yet processed multipart/form-data sections. Otherwise, the predicate fails.

multipart_next_element(+MultiPartFilter, -HeaderList)

The predicate switches the filter to the next part and returns in 'HeaderList' the HttpParameters of that part. 'HeaderList' is a list of terms like [http(HttpHeaderName,HttpHeaderValue,[OptionName=OptionValue,...]),...] . In 'HeaderName' and 'OptionsName' all capital letters are converted to small letters. e.g. [http('content-disposition','form-data', [name = 'File', filename = 'test.html']), http('content-type', 'text/html', [])]

multipart_get_content(+MultiPartFilter, -Content)

The predicate returns the content of a form-data part as an atom. (Assumed is that the characters are ISO-8859-1).

multipart_get_content(+MultiPartFilter, +Encoding, -Content)

The predicate returns the content of a form-data part as an atom. 'Encoding' is an atom that gives the character encoding.

multipart_get_stream(+MultiPartFilter, -InputStream)

The predicate returns an InputStream for the data of the next part. Usually this InputStream will be converted into a MinervaStream with open/4. e.g. open(InputStream,read,Stream,[stream,binary]) .

multipart_copyfile(+MultiPartFilter, +Filename)

The predicate copies the contents of a form-data part into a file named Filename.

List of servlet predicates

multipart_has_more_elements/1,
multipart_next_element/2,
multipart_get_content/2,
multipart_get_content/3,
multipart_get_stream/2,
multipart_copyfile/2,
multipart_create/2,

servlet_get_init_parameter/3, servlet_get_init_parameter_names/2, servlet_log/2, servlet_get_real_path/3, servlet_restart/1, servlet_get_mime_type/3,

request_get_parameter/3, request_get_parameter_names/2, request_get_parameter_values/3, request_get_character_encoding/2, request_get_content_length/2, request_get_content_type/2, request_get_remote_addr/2, request_get_remote_host/2, request_get_scheme/2, request_get_server_name/2, request_get_server_port/2, request_is_secure/1,

request_get_auth_type/2, request_get_context_path/2, request_get_cookies/2, request_get_date_header/3, request_get_header/3, request_get_header_names/2, request_get_headers/3, request_get_int_header/3, request_get_method/2, request_get_path_info/2, request_get_path_translated/2, request_get_query_string/2, request_get_remote_user/2, request_get_requested_session_id/2, request_get_request_uri/2, request_get_request_url/2, request_get_servlet_path/2, request_get_session/2, request_is_requested_session_id_from_cookie/1, request_is_requested_session_id_from_url/1, request_is_requested_session_id_valid/1, request_is_user_in_role/2,

response_get_writer/2, response_get_output_stream/2, response_add_cookie/2, response_add_date_header/3, response_add_header/3, response_add_int_header/3, response_contains_header/2, response_encode_redirect_url/3, response_encode_url/3, response_send_error/2, response_send_redirect/2, response_set_date_header/3, response_set_header/3, response_set_int_header/3, response_set_status/2, response_set_content_type/2,

session_get_attribute/3, session_get_attribute_names/2, session_get_creation_time/2, session_get_id/2, session_get_last_accessed_time/2, session_get_max_inactive_interval/2, session_invalidate/1, session_is_new/1, session_remove_attribute/2, session_set_attribute/3, session_set_max_inactive_interval/2,

cookie_create/3, cookie_get_comment/2, cookie_get_domain/2, cookie_get_max_age/2, cookie_get_name/2, cookie_get_path/2, cookie_get_secure/2, cookie_get_value/2, cookie_get_version/2, cookie_set_comment/2, cookie_set_domain/2, cookie_set_max_age/2, cookie_set_path/2, cookie_set_secure/2, cookie_set_value/2, cookie_set_version/2


Up read on...