Skip to content

Instantly share code, notes, and snippets.

@keesun
Created January 12, 2012 23:51
Show Gist options
  • Save keesun/1603893 to your computer and use it in GitHub Desktop.
Save keesun/1603893 to your computer and use it in GitHub Desktop.
Servlet 3.0's Annotation based Servlet registration sample
@WebServlet(urlPatterns = "/test")
public class TestServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType(MediaType.TEXT_PLAIN_VALUE);
PrintWriter out = res.getWriter();
out.write("Hello");
out.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment