example.stateless.hello
Class HelloServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--example.stateless.hello.HelloServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class HelloServlet
- extends javax.servlet.http.HttpServlet
Client servlet querying a server about a greeting.
JNDI client configuration
<jndi-link>
<jndi-name>java:comp/env/ejb</jndi-name>
<jndi-factory>com.caucho.ejb.BurlapContextFactory</jndi-factory>
<init-param java.naming.provider.url="http://localhost:8080/cmp/example"/>
</jndi-link>
- See Also:
- Serialized Form
Field Summary |
private HelloHome |
helloHome
The servlet stores the home interface after the initial lookup. |
Fields inherited from class javax.servlet.GenericServlet |
config |
Method Summary |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Calls the hello method. |
void |
init()
The init method looks up the HelloHome interface using JNDI and
stores it in a servlet variable. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPost, doPut, doTrace, encodeBase64, generateETag, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
helloHome
private HelloHome helloHome
- The servlet stores the home interface after the initial lookup.
Since the home interface never changes, caching the lookup will save
some performance.
HelloServlet
public HelloServlet()
init
public void init()
throws javax.servlet.ServletException
- The init method looks up the HelloHome interface using JNDI and
stores it in a servlet variable.
- Overrides:
init
in class javax.servlet.GenericServlet
doGet
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
- Calls the hello method. The Hello interface is created using the
create method.
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Parameters:
request
- the servlet request object.response
- the servlet response object.