WebSocket / Fixing pathmap matching when query parameters are provided
This commit is contained in:
parent
c49ba7bdcc
commit
dc59080fca
|
@ -78,6 +78,7 @@ public class WebSocketPathSpecTest
|
|||
assertEquals("Spec.group",PathSpecGroup.EXACT,spec.getGroup());
|
||||
|
||||
assertMatches(spec,"/a");
|
||||
assertMatches(spec,"/a?type=other");
|
||||
assertNotMatches(spec,"/a/b");
|
||||
assertNotMatches(spec,"/a/");
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class WebSocketUpgradeFilter extends ContainerLifeCycle implements Filter
|
|||
{
|
||||
HttpServletRequest httpreq = (HttpServletRequest)request;
|
||||
HttpServletResponse httpresp = (HttpServletResponse)response;
|
||||
String target = httpreq.getServletPath();
|
||||
String target = httpreq.getRequestURI();
|
||||
|
||||
if (factory.isUpgradeRequest(httpreq,httpresp))
|
||||
{
|
||||
|
|
|
@ -159,8 +159,18 @@ public class RegexPathSpec extends PathSpec
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(String path)
|
||||
public boolean matches(final String path)
|
||||
{
|
||||
return getMatcher(path).matches();
|
||||
int idx = path.indexOf('?');
|
||||
if (idx >= 0)
|
||||
{
|
||||
// match only non-query part
|
||||
return getMatcher(path.substring(0,idx)).matches();
|
||||
}
|
||||
else
|
||||
{
|
||||
// match entire path
|
||||
return getMatcher(path).matches();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue