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

com.netgrif.application.engine.configuration.ForwardConfiguration Maven / Gradle / Ivy

Go to download

System provides workflow management functions including user, role and data management.

There is a newer version: 6.4.0
Show newest version
package com.netgrif.application.engine.configuration;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.NoHandlerFoundException;

import javax.servlet.http.HttpServletRequest;

@Controller
@ControllerAdvice
public class ForwardConfiguration {

    private static final Logger log = LoggerFactory.getLogger(SecurityConfigurationStaticEnabled.class);

    @RequestMapping(value = "/{path:[^api]*}")
    public String redirect(HttpServletRequest request) {
        log.info("Forwarding to root for request URI [" + request.getRequestURI() + "]");
        return "forward:/";
    }

    @RequestMapping(value = {"/signup/{token}", "/recover/{token}"})
    public String redirectWithToken(@PathVariable("token") String token, HttpServletRequest request) {
        log.info("Forwarding to root for URI [ " + request.getRequestURI() + " ] with token " + token);
        return "forward:/";
    }


    @RequestMapping("/**/{path:[^.]+}")
    public String forward() {
        return "forward:/";
    }

    @ExceptionHandler(NoHandlerFoundException.class)
    public String handle404Error() {
        log.info("No requested mapping found. Forwarding to index");
        return "forward:/";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy