public class ClassNameURLResolver extends java.lang.Object implements URLResolver
The resolution is done by:(Page) Class.forName(url).newInstance()
If the class is not found or there is a problem during this instantiation or does not extends Page
, a
PageNotFoundException
is thrown.
It checks that URLs are equal to ensure it is the same one.
Constructor and Description |
---|
ClassNameURLResolver() |
Modifier and Type | Method and Description |
---|---|
boolean |
isSamePage(java.lang.String url1,
java.lang.String url2)
Gets whether or not two URLs refer to the same page.
|
Page |
resolve(java.lang.String url)
Gets a page from a URL.
|
public Page resolve(java.lang.String url) throws PageNotFoundException
URLResolver
resolve
in interface URLResolver
url
- the URL of the page.PageNotFoundException
- if no page can be created for this URL.public boolean isSamePage(java.lang.String url1, java.lang.String url2)
URLResolver
isSamePage
in interface URLResolver
url1
- the first URL.url2
- the second URL.true
if the given URLs refer to the same page, false
otherwise.