我的过滤器出了问题。我这样定义了它:
function time_elapsed_string($difference)
{
//Days
$days = round(($difference / 86400), 2);
//Hours
$hours = floor($difference / 3600);
if($hours >= 24) {
$remainderHours = fmod($hours, 24); // Get the remainder from the days.
if ($remainderHours < 10) {
$remainderHours = '0' . $remainderHours;
}
} else {
$remainderHours = $hours;
$days = 0;
if ($remainderHours < 10) {
$remainderHours = '0' . $hours;
}
}
//Minutes
$mins = floor($difference / 60);
if ($mins >= 60){
$remainderMins = fmod($mins, 60);
if ($remainderMins < 10) {
$remainderMins = '0' . $remainderMins;
}
} else {
$remainderMins = $mins;
if ($remainderMins < 10) {
$remainderMins = '0' . $remainderMins;
}
}
//Seconds
$seconds = floor($difference);
if($seconds >= 60) {
$remainderSeconds = fmod($seconds, 60);
if ($remainderSeconds < 10) {
$remainderSeconds = '0' . $remainderSeconds;
}
} else {
$remainderSeconds = $seconds;
if ($remainderSeconds < 10) {
$remainderSeconds = '0' . $remainderSeconds;
}
}
//Format day due to days being reset to 0 format in hours fuction
$days = (floor($days) < 10 ? ('0' . floor($days)) : floor($days));
return $days . ':' . $remainderHours . ':' . $remainderMins . ':' . $remainderSeconds;
}
在我的web-fragment.xml中,我有:
@WebFilter("springSecurityFilterChain")
public class JwtAuthenticationFilter extends AbstractAuthenticationProcessingFilter {...}
模式应该有效,但我一直得到这个例外:
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
我还尝试在XML和@WebFilter注释中使用“/”,“/ security / *”,“”来更改模式,但我一直得到这个例外。有人可以解释一下我做错了吗?
谢谢。
修改
这是Spring Security配置:
java.lang.IllegalArgumentException: Invalid <url-pattern> springSecurityFilterChain in filter mapping
答案 0 :(得分:1)
您的@WebFilter
注释存在问题。如果您未在@WebFilter
注释中指定任何内容,则默认情况下,它会将param作为网址格式,在您的情况下为springSecurityFilterChain
。
因此,对于您的情况,您可以使用
@WebFilter("/*")
public class JwtAuthenticationFilter extends AbstractAuthenticationProcessingFilter {...}
没有在xml文件中或下面指定任何内容:
@WebFilter(filterName = "abc")
public class JwtAuthenticationFilter extends AbstractAuthenticationProcessingFilter {...}
并在您的xml文件中,您可以指定URL模式,如下所示:
<filter-mapping>
<filter-name>abc</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>