Code example for AbstractController

0
 
    static Pattern URI = Pattern.compile("/icon/(?:([^/]+)/)?([^/]+)/?"); 
     
    private final Catalog catalog; 
 
    public IconService(Catalog catalog) { 
        this.catalog = catalog; 
    } 
 
    @Override 
    protected ModelAndView handleRequestInternal( 
        HttpServletRequest request, HttpServletResponse response) throws Exception { 
 
        String path = request.getPathInfo(); 
        Matcher m = URI.matcher(path); 
        if (!m.matches()) { 
            response.sendError(400,  
                "Bad request, path must be of form: /icons/[<workspace>/]<style>"); 
            return null; 
        }