L
lightning
Are there any differences between the normal servlet's deployment and
the comet servlet's?
Why do I still must implement a doGet method to avoid http405?
And the code in
public void event(CometEvent event) throws IOException,
ServletException
not executed at all??
code:
public class ChatServlet extends HttpServlet implements CometProcessor
{
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
System.out.println("getgetget");
}
public void event(CometEvent event) throws IOException,
ServletException {
log("fefefefefefe");
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<description>This is the description of my J2EE component</
description>
<display-name>This is the display name of my J2EE component</
display-name>
<servlet-name>ChatServlet</servlet-name>
<servlet-class>ChatServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ChatServlet</servlet-name>
<url-pattern>/cc</url-pattern>
</servlet-mapping>
</web-app>
server.xml:
<Connector port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" useComet="true"
redirectPort="8443" />
what do I miss??
the comet servlet's?
Why do I still must implement a doGet method to avoid http405?
And the code in
public void event(CometEvent event) throws IOException,
ServletException
not executed at all??
code:
public class ChatServlet extends HttpServlet implements CometProcessor
{
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
System.out.println("getgetget");
}
public void event(CometEvent event) throws IOException,
ServletException {
log("fefefefefefe");
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<description>This is the description of my J2EE component</
description>
<display-name>This is the display name of my J2EE component</
display-name>
<servlet-name>ChatServlet</servlet-name>
<servlet-class>ChatServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ChatServlet</servlet-name>
<url-pattern>/cc</url-pattern>
</servlet-mapping>
</web-app>
server.xml:
<Connector port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" useComet="true"
redirectPort="8443" />
what do I miss??