Skip to content

servlet invoked twice when use wildcard /* #5

@alexmao86

Description

@alexmao86

public class MainTest {
public static void main(String[] args) {
final Serve srv = new Serve();
java.util.Properties properties = new java.util.Properties();
properties.put("port", 80);
properties.setProperty(com.koogu.server.Serve.ARG_NOHUP, "nohup");

	//properties.setProperty("acceptorImpl", "Acme.Serve.SelectorAcceptor"); // this acceptor is requireed for websocket support.
	srv.arguments = properties;
	srv.addServlet("/*", new HttpServlet() {
		private static final long serialVersionUID = 1L;
		protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			System.out.println("test="+req.getParameter("test"));
		}
	}, null); // optional
	Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
		public void run() {
			srv.notifyStop();
			srv.destroyAllServlets();
		}
	}));
	srv.serve();
}

}

then doGet was invoked twice:
URL: http://localhost/a?test=123
output as:
test=123
test=null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions