protected void logReferenceInfo() { Reference reference = getReference(); getLiberecoResourceLogger() .debug( "Reference, path [" + reference.getPath() + "], identifier: " + reference.getIdentifier() + ", last segment: " + reference.getLastSegment() + ", path: " + reference.getPath() + ", relative part: " + reference.getRelativePart() + ", remaining part: " + reference.getRemainingPart() + ", fragment: " + reference.getFragment() + ", segments: " + reference.getSegments()); List<String> segments = reference.getSegments(); if (segments != null) { for (String segment : segments) { getLiberecoResourceLogger().debug("Segment: " + segment); } } }
public void testGetLastSegment() { Reference reference = new Reference("http://hostname"); assertNull(reference.getLastSegment()); reference = new Reference("http://hostname/"); assertNull("", reference.getLastSegment()); reference = new Reference("http://hostname/abc"); assertEquals("abc", reference.getLastSegment()); reference = new Reference("http://hostname/abc/"); assertEquals("abc", reference.getLastSegment()); reference = new Reference("http://hostname/123/abc/"); assertEquals("abc", reference.getLastSegment()); reference = new Reference("http://hostname/123/abc"); assertEquals("abc", reference.getLastSegment()); }