Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1827 → Rev 1829

/branches/v3/impl/src/java/pt/estgp/estgweb/web/filters/FilterUtils.java
New file
0,0 → 1,38
package pt.estgp.estgweb.web.filters;
 
import pt.estgp.estgweb.utils.Globals;
 
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
 
/**
* Created by jorgemachado on 26/10/17.
*/
public class FilterUtils
{
public static final List<String> URL_STAT_IGNORE_EXTENSIONS = Globals.URL_STAT_IGNORE_EXTENSIONS;
 
public static boolean checkIfIsIgnoredExtension(ServletRequest request, HttpServletRequest hrequest) throws IOException, ServletException
{
String relativePath = hrequest.getServletPath();
if (relativePath == null)
relativePath = "";
 
if (hrequest.getPathInfo() != null && hrequest.getPathInfo().length() > 0)
{
relativePath += hrequest.getPathInfo();
}
 
for (String ignore : URL_STAT_IGNORE_EXTENSIONS)
{
if (relativePath.endsWith(ignore))
{
return true;
}
}
return false;
}
}