ResourceSet.createResource(URI) - what if 'uri' is not enough to create certain resource?

StackOverflow https://stackoverflow.com/questions/1206159

  •  05-07-2019
  •  | 
  •  

Question

There is a method in ResourceSet which can create resource:

public Resource createResource(URI uri)

The problem: 'uri' is not enough to create valid type of resource. For example, if the uri is like this: "http://host/file.wsdl" then createResource will understand that WSDLResource should be created. But what if I have a wsdl with, say, such url: "http://host/file?wsdl" How should I say ResourceSet that "WSDLResource" should be created?

Of course I can extract at runtime actual type of resource going to be created, but i don't know how to pass this type to ResourceSet.

Thanks

Was it helpful?

Solution

I think you are looking for ResourceSet.createResource(URI uri, String contentType). You just need to know the content type identifier for your particular resource type in the registry.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top