}
private boolean matches(final Request request)
{
boolean matches = false;
Url url = request.getUrl();
Url baseUrl = request.getClientUrl();
String namespace = getContext().getNamespace();
String bookmarkableIdentifier = getContext().getBookmarkableIdentifier();
String pageIdentifier = getContext().getPageIdentifier();
List<String> segments = url.getSegments();
int segmentsSize = segments.size();
if (segmentsSize >= 3 && urlStartsWithAndHasPageClass(url, namespace, bookmarkableIdentifier))
{
matches = true;
}
// baseUrl = 'wicket/bookmarkable/com.example.SomePage[?...]', requestUrl = 'bookmarkable/com.example.SomePage'
else if (baseUrl.getSegments().size() == 3 && urlStartsWith(baseUrl, namespace, bookmarkableIdentifier)
&& segmentsSize >= 2 && urlStartsWithAndHasPageClass(url, bookmarkableIdentifier))
{
matches = true;
}
// baseUrl = 'bookmarkable/com.example.SomePage', requestUrl = 'bookmarkable/com.example.SomePage'
else if (baseUrl.getSegments().size() == 2 && urlStartsWith(baseUrl, bookmarkableIdentifier)
&& segmentsSize == 2 && urlStartsWithAndHasPageClass(url, bookmarkableIdentifier))
{
matches = true;
}
// baseUrl = 'wicket/page[?...]', requestUrl = 'bookmarkable/com.example.SomePage'
else if (baseUrl.getSegments().size() == 2 && urlStartsWith(baseUrl, namespace, pageIdentifier)
&& segmentsSize >= 2 && urlStartsWithAndHasPageClass(url, bookmarkableIdentifier))
{
matches = true;
}