All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.inigma.shared.webapp.ErrorPageController Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package org.inigma.shared.webapp;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Deprecated
@Controller
public class ErrorPageController {
    private static class ErrorPageResponse {
        private int code;
        private HttpServletRequest req;

        public ErrorPageResponse(int code, HttpServletRequest req) {
            this.code = code;
            this.req = req;
        }

        public int getCode() {
            return code;
        }

        public String getContextPath() {
            return req.getContextPath();
        }

        public Cookie[] getCookies() {
            return req.getCookies();
        }

        public String getMethod() {
            return req.getMethod();
        }
        
        public String getUri() {
            return (String) req.getAttribute("javax.servlet.forward.request_uri");
        }
    }

    @RequestMapping("/error/page/{code}")
    @ResponseBody
    public ErrorPageResponse handleErrorPage(@PathVariable int code, HttpServletRequest req) {
        return new ErrorPageResponse(code, req);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy