Hi,
It is a bug - it's probably trying to get the UriInfo from the wrong message
object when it's used on the client side. I have to investigate. I'm about
to sign off but I'll get back to you on Monday at the latest.
If you don't mind, you might want to copy that provider source and have a
client-side version which does not attempt to inject UriInfo details.
thanks for posting a test case - it will help me to get started fast
cheers, Sergey
Paul Wilton wrote:
>
> Hi
>
> I am trying to use the new XSLTJaxbProvider as a provider for the JAX-RS
> WebClient.
>
> I am getting some null pointer exceptions thrown inside the
> createTemplates() method of the provider , due to the
>
> ui.getPathParameters() and the ui.getQueryParameters() both
> returning null
>
>
>
> Below is some test code (not spring wired) - is there something I am
> missing, that would ensure the MessageContext creates a UriInfo object
> correctly? - or is this simply a bug... if possible do you have an
> example of using XSLTJaxbProvider with WebClient (HttpCentric) to
> consume a webservice.
>
>
>
> Thanks, Paul
>
>
>
> WebClient webClient;
>
>
>
> @Before
>
> public void setup(){
>
>
>
> Map<String,String> mediaTemplates = new
> HashMap<String,String>();
>
> mediaTemplates.put("text/xml","classpath:/story-transform.xsl");
>
>
>
> XSLTJaxbProvider xsltJaxbProvider = new XSLTJaxbProvider();
>
> xsltJaxbProvider.setConsumeMediaTypes(new
> ArrayList<String>(Arrays.asList("text/xml")));
>
> xsltJaxbProvider.setInMediaTemplates(mediaTemplates);
>
> xsltJaxbProvider.setInParameters(new HashMap<String,Object>());
>
>
>
> List providers = new ArrayList();
>
> providers.add(xsltJaxbProvider);
>
>
>
> webClient = WebClient.create(STORY_SERVICE_URL, providers); //
> = URL to RESTful webservice to consume
>
> StoryClient = new StoryClient();
>
> StoryClient.setWebClient(webClient);
>
> }
>
>
>
>
>
> @Test
>
> public void getStory() {
>
> // assume Story object is annotated to be unmarshalled with JAXB
> on the transofrmed XML
>
>
>
> webClient.path("/story").type("text/xml").accept("text/xml");
>
> webClient.query("story","storyId");
>
> Story story = webClient.get(Story.class);
>
>
>
> assertTrue(Story!=null);
>
> // assert more stuff
>
>
>
> }
> This e-mail (and any attachments) is confidential and may contain personal
> views which are not the views of the BBC unless specifically stated. If
> you have received it in error, please delete it from your system. Do not
> use, copy or disclose the information in any way nor act in reliance on it
> and notify the sender immediately.
>
> Please note that the BBC monitors e-mails sent or received. Further
> communication will signify your consent to this
>
> This e-mail has been sent by one of the following wholly-owned
> subsidiaries of the BBC:
>
> BBC Worldwide Limited, Registration Number: 1420028 England, Registered
> Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
> BBC World News Limited, Registration Number: 04514407 England, Registered
> Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
> BBC World Distribution Limited, Registration Number: 04514408, Registered
> Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
>
>
--
View this message in context:
http://www.nabble.com/trying-to-use-XSLTJaxbProvider-with-WebClient--%28JAX_RS%29-tp24324012p24325370.html
Sent from the cxf-user mailing list archive at Nabble.com.