Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servlet invoked twice when use wildcard /* #5

Open
alexmao86 opened this issue Dec 12, 2016 · 0 comments
Open

servlet invoked twice when use wildcard /* #5

alexmao86 opened this issue Dec 12, 2016 · 0 comments

Comments

@alexmao86
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant