Java Reference
In-Depth Information
Note The servlet in Listing 4-8 describes code for interacting with Bigtable. We'll provide more
details on the PersistenceManager, JDO, and JDOQL in Chapter 7.
Deployment Descriptor
When the web server receives a request for your application, it uses the deployment
descriptor to map the URL of the request to the code handling the request. Modify the
web.xml file with the code in Listing 4-9 to use the TelesalesServlet class. The servlet
mapping specifies that all incoming requests to “telesales” be mapped to the newly
created servlet defined in the servlet definition.
Listing 4-9. The web.xml file
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
" http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns=" http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<servlet-name>telesales</servlet-name>
<servlet-class>com.appirio.TelesalesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>telesales</servlet-name>
<url-pattern>/telesales</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
PersistenceManager
The servlet utilizes Bigtable to store data for your application. Listing 4-10
displays how you obtain an instance of the PersistenceManager from the
PersistenceManagerFactory object. As with most datastores, obtaining a
connection is expensive so you should the wrap it in a singleton.
 
Search WWH ::




Custom Search