java - Spring:Can we create custom HTTP Status codes ?
怪我咯
怪我咯 2017-04-18 10:34:24
0
1
714

Can we create custom HTTP Status codes ?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
黄舟

Ofcourse, you can use raw servlet api HttpServletResponse,

@RequestMapping("test")
public void test(HttpServletResponse response) throws IOException {
    response.setStatus(10000); // http status code 10000(NOT EXISTS)
    response.flushBuffer();
}

But is's not recommend to use a HTTP status code that does not exists,
cause the clients don't know what it means

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template