Public Sub Filter(req As ServletRequest, resp As ServletResponse) As Boolean
Log("filter : " & req.FullRequestURI)
Dim fp1 As Boolean=req.FullRequestURI.IndexOf("/param")>=0
Dim fp2 As Boolean=req.FullRequestURI.IndexOf("logoutHelper")>=0
Dim fp3 As Boolean=req.FullRequestURI.IndexOf("/ws")>=0
If fp1 And Not(fp2) Then
Dim registered As Boolean=req.GetSession.GetAttribute2("registered",False)
Dim username As String=req.GetSession.GetAttribute2("name", "")
Log("registered:"&b4jlib.IIF(registered,"true","false")&" , name:"&username)
If registered=True Then
'check that no more than 30 minutes passed since last activity
If req.GetSession.LastAccessedTime + DateTime.TicksPerMinute * 30 > DateTime.Now Then
Return True 'allow request to continue
End If
Log("user have login")
End If
resp.SendRedirect("/login/") <<<--- problem in here
Return False
Log("Redirect to /login/")
else If fp2 Then
resp.ContentType = "application/json"
Dim jg As JSONGenerator
Dim responeMap As Map
responeMap.Initialize
responeMap.Put("success",True)
responeMap.Put("goto","/monitor/index.html")
responeMap.Put("errorMessage", "")
jg.Initialize(responeMap)
resp.Write(jg.ToString)
req.GetSession.RemoveAttribute("registered")
req.GetSession.RemoveAttribute("name")
Log("=== logout ===")
Return False
Else
Return True
End If
End Sub