|
|
|
|
|
|
Re: Custom scheme for import URIs [message #1836412 is a reply to message #640930] |
Sat, 02 January 2021 23:16 |
Mirko Raner Messages: 125 Registered: July 2009 Location: New York City, NY |
Senior Member |
|
|
It's doubtful that this is of any help to the original poster more than a decade later, but for anybody who might be struggling with the same problem (like myself), I'd like to add this little tidbit:
In my particular circumstances, just using
resourceSet.getURIConverter().getURIHandlers().add(uriHandler)
did also not have any effect, mainly because the new URIHandler will be added at the very end of the list, and the default list in URIHandler.DEFAULT_HANDLERS already contains a "catch all" handler:
List<URIHandler> DEFAULT_HANDLERS =
Collections.unmodifiableList
(Arrays.asList
(new URIHandler []
{
new PlatformResourceURIHandlerImpl(),
new FileURIHandlerImpl(),
new EFSURIHandlerImpl(),
new ArchiveURIHandlerImpl(),
new URIHandlerImpl()
}));
The canHandle(...) method of that last new URIHandlerImpl() entry looks like this:
public boolean canHandle(URI uri)
{
return true;
}
so it will intercept all URI handling before any other handlers that come after it.
Therefore, the solution, in my case at least, was to add the new handler at the beginning of the list (or at least somewhere before that final "catch all" handler):
resourceSet.getURIConverter().getURIHandlers().add(0, uriHandler)
|
|
|
Powered by
FUDForum. Page generated in 0.03214 seconds