OK, what I managed so far is:
I have two EARs: one is core EAR (with WAR and jaxrs activator class and a
test REST method) and the other one contains just a test REST method. I
also wrote a web filter with the following code in doFilter:
Registry registry = (Registry)
request.getServletContext().getAttribute(Registry.class.getName());
registry.addJndiResource("java:global/rest1-ear-1.0.0/rest1-ejb-1.0.0/RestServiceImpl");
chain.doFilter(request, response);
This is very non optimized code, but it works. It adds the resource from my
other EAR. Of course, this snippet executes with every request, so this is
apparently not the right way to do it.
My idea is for every EAR (apart from the core EAR) to have a @StartUp
annotated singleton class, which would, at deploy time, somehow inform the
core EAR (maybe via jndi) that it wants to register its own REST resources
and providers (again, maybe via jndi names). Do you have any suggestions
how to accomplish this?
Thanks!
On Wed, Nov 23, 2011 at 16:52, <[email protected]> wrote:
> I tested it inside an EAR and it works ok. You can have resource classes
> in different JARs and the scanner registers them. But we're developing a
> large project, which consists of multiple EARs, but would like to have a
> single REST entry point, so when the "core" EAR (with WAR module and JAR
> with JAX-RS activator class) is deployed and another EAR is deployed, the
> scanner would also scan for newly deployed resource/provider classes. I
> don't know it the idea is reasonable, so any other suggestions are
> appreciated. For now, what I could do would be that every EAR would have
> its own WAR and REST resources, completely isolated from other EARs. That
> would mean that web roots would be different for every EAR/module, for
> example for first EAR it would be /module1/rest_method_x, for another EAR
> it would be /module_n/rest_method_y, etc.
>
> Thanks!
>
> On Wed, Nov 23, 2011 at 14:50, Bill Burke <[email protected]> wrote:
>
>> I don't think the jsr is specific on where providers should be scanned
>> from. You'll probably have to manually register them as I believe the
>> current AS7 integration only scans the WAR.
>>
>> On 11/23/11 3:46 AM, [email protected] wrote:
>> > Hi,
>> >
>> > I have the following scenario: multi EAR project, from which one of them
>> > also have a WAR inside. Is it possible to register resteasy providers
>> > and resources from different EARs into the servlet context of that WAR?
>> > I know I can register them from different JARs inside the EAR containing
>> > the WAR, but I don't know if I can do it from other EARs. I'm using
>> > JBoss AS 7.0.2.
>> >
>> > Thanks!
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > All the data continuously generated in your IT infrastructure
>> > contains a definitive record of customers, application performance,
>> > security threats, fraudulent activity, and more. Splunk takes this
>> > data and makes sense of it. IT sense. And common sense.
>> > http://p.sf.net/sfu/splunk-novd2d
>> >
>> >
>> >
>> > _______________________________________________
>> > Resteasy-users mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/resteasy-users
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> Resteasy-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>>
>>
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Resteasy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/resteasy-users