Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
Reality V15.0 ()
Description of the Example Servlet (JReal) (exampleservletdesc.htm)
The example servlet, rwdemo
, makes a connection to
a Reality database and calls a DataBasic subroutine that returns its own input
parameters to the browser. The example servlet:
HttpServlet
.HttpServlet
init()
method, then calls init()
from the
RealWeb classto start a thread to
timeout connections.doPost()
to handle any post requests.doPost()
is to work in
exactly the same way as doGet(), so it simply calls
doGet()
.
doGet()
, which is the usual entry point to the
servlet.Whenever the web server receives a GET request for this servlet, the server
invokes doGet()
, passing it an HttpServletRequest
parameter and an
HttpServletResponse
parameter.
Overrides getServletInfo()
to return the string "Sample RealWeb Servlet".
rwdemo
.The comments describe how the subroutine, which simply returns
its input parameters, must be created, compiled, catalogued, then enabled.
Remote Basic subroutines can be enabled for remote access by user-ids with a
specified security profile (see
Securing the Database Using
SSM). The
URL used to call the subroutine via rwdemo
is shown.
When the RealWebUrl
object is created, the subroutine name is placed
in URL.command
. HttpServletRequest
provides methods to extract the query string and the servlet path, which are
used as the two input parameters to RW.SAMPLE. When executed, RW.SAMPLE returns
these two parameters to the browser, displaying, for example:
First parameter is a query
Second parameter is /servlet/rwdemo
doGet()
does the following:
HttpServletResponse
to set the content type for the
response and to get an output stream.RealWeb Demo Servlet
.
In addition to building the HTML page header, the servlet could use methods
provided by HttpServletRequest
to build an HTML form
requesting input from the user and append this input to the URL, to be passed as
parameters to RW.SAMPLE. In this example, parameters to be passed to the
subroutine are entered as part of the URL.pathInfo the rest of the path after the servlet name;
debug set to true if the first path component contains
Debug
(see Debugging);
section the first path component following servlet name, or the
Debug
keyword;
command the second path component following servlet name, or the
Debug
keyword;
page the third path component following servlet
name, or the Debug
keyword
RealWeb.getConnection
to get a
connection to the database. This will return a current connection or create
a new one. The RealWeb
class extends
RSCConnection
, so making available the methods within
RSCConnection
.execute()
method (see later
code) to execute the Remote Basic subroutine.