@ServletComponentScan
@WebFilter(urlPatterns = {"/page/pc/*"},filterName = "urlRewriteFilter")
public class UrlRewriteFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest req, ServletResponse rep, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest)req;
if(request.getServletPath().contains(".html"))
{
request.getRequestDispatcher(request.getServletPath().replace(".html",".jsp"))
.forward(req, rep);
}
else
{
chain.doFilter(req,rep);
}
}
@Override
public void destroy() {
}
}