For example, HttpServletResponse
has the HTTP status codes as constants like
public static final int SC_OK = 200;
public static final int SC_CREATED = 201;
public static final int SC_BAD_REQUEST = 400;
public static final int SC_UNAUTHORIZED = 401;
public static final int SC_NOT_FOUND = 404;
Is there any such constants defined for HTTP methods like GET
, POST
, ..., anywhere in the Java EE API so that it could be referenced easily, rather than creating one on my own?
HttpServlet
class declares them but they areprivate
. Write your own, possibly as enums instead. – Bowerman