Hi Sergey
I have the following setup, and want to know it's valid:
Two jaxrs:server, each with the same address, /service, one server with
serviceBean A, one with serviceBean B.
Now, serviceBean A has a @Path("/service1/") annotation, and one method with a
@Path("/testmethod1") annotation
ServiceBean has a @Path("/service2") annotation, and one method with a
@Path("/testmethod1") annotation
This configurations should give me the following service url's
/service/service1/testmethod1
/service/service2/testmethod2
But when I test this config, the runtime seems to randomly select either
jaxrs:server a and b for request processing,
Making one request to be processed, and the next to fail because the wrong
serviceBean is used.
The reason why I need different servers is that I need different
JAXBElementProvider for marshalling. I need to specify
The schemaLocations and noSchemaLocation for every serviceBean response.
Can you help me?
Thanks in advance
Mirko
-----Ursprüngliche Nachricht-----
Von: Sergey Beryozkin [mailto:[email protected]]
Gesendet: Dienstag, 26. Januar 2010 17:44
An: [email protected]
Betreff: Re: multiple raxrs:server with same address
Hi
You can definitely have multiple jaxrs:server endpoints with endpoint specific
providers. The issue is that you'd like to have all
of them to share the same address which is not possible.
Do server-specific service beans have root @Path values which would stay unique
even if you collapsed all the service beans under a
single jaxrs:server ?
Another question : given you'd like jaxrs:server endpoints share the same
address, what would actually act as a differentiator, as
far as client requests are concerned ?
If every service bean across all the jaxrs:server endpoints has a unique root
@Path and say every client request has, say, a
ClientId query header uniquely identifying a client then the simplest way to
solve the issue is to have a single jaxrs:server
including all the service beans and have a custom MessageBodyReader/Writer
implemented as follows :
@Context UriInfo uriInfo; // or HttpHeaders
// this map is initialized at startup,
Map<ClientHeaderValue, JAXBElementProvider> map...;
// get client id from a header/uri and delegate to appropriate
JAXBElementProvider in readFrom/writeTo
...
This assumes you know in advance what types of clients can access the service...
Will this work ?
If not then can you provide more details please ?
thanks, Sergey
----- Original Message -----
From: "Sertic Mirko, Bedag" <[email protected]>
To: <[email protected]>
Sent: Tuesday, January 26, 2010 3:39 PM
Subject: multiple raxrs:server with same address
h...@all
I'd like to know if it's valid to have multiple jaxrs:server elements
with the same address.
Every server has a set of different service beans. The reason why I want
to have multiple server configurations is to have different
JAXBElementProvider for each server.
Is this valid, and what are common pitfalls?
Thanks in advance
Mirko