Inheriting from AbstractVeriplaceServlet
Using the Web Tier Java SDK
Inheriting from AbstractVeriplaceServlet (back to all tutorials)
Java Server Pages (JSP) are simple and concise, but are often inappropriate for large applications with multiple layers of abstraction. For such cases, it is natural to use Java Servlets to process location data obtained from Veriplace before rendering a page.
-
Step 1: Writing PageServlet.java
The simplest way to write a Servlet to process location data is to inherit from the com.veriplace.web.servlet.AbstractVeriplaceServlet:
The UsesVeriplace annotation informs the AbstractVeriplaceServlet that location must be obtained, using the Zoom location mode, before passing control to doRequestInternal method.
The VeriplaceState parameter to doRequestInternal provides access to data obtained from Veriplace, including location.
-
Step 2: Writing page.jsp
PageServlet.java still renders HTML using a JSP file, which should look very similar to the JSP example above, except for the removal of the setup and require-* tags:
-
Step 3: Configuring web.xml
The AbstractVeriplaceServlet requires a few customizations of your application's web.xml:
This should look very similar to the JSP example above, except that the Page servlet is declared using the servlet-class declaration
-
Step 4: Done
You're now ready to deploy a servlet-based web application using the Veriplace API.