Hi Ed,
as pointed by Michal, if you register your feature, the application listener should
work just fine. Please see the log attached bellow.
I suppose something goes wrong before the listener class gets registered
in your feature. You may try to comment out everything except the following two lines
from your configure method and see how it works…
>> context.register(MyApplicationEventListener.class);
>> return true;
Have you checked your log file? Anything suspicious there?
What container do you use?
Thanks,
~Jakub
P.S. Here is the log:
[2014-01-06T15:58:40.458+0100] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.server.ApplicationHandler] [tid: _ThreadID=44 _ThreadName=admin-listener(4)] [timeMillis: 1389020320458] [levelValue: 800] [[
Initiating Jersey application, version Jersey: 2.5-SNAPSHOT 2013-12-06 15:03:50...]]
[2014-01-06T15:58:40.676+0100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=44 _ThreadName=Thread-8] [timeMillis: 1389020320676] [levelValue: 800] [[
debug: edburns: INITIALIZATION_START]]
[2014-01-06T15:58:40.792+0100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=44 _ThreadName=Thread-8] [timeMillis: 1389020320792] [levelValue: 800] [[
debug: edburns: INITIALIZATION_FINISHED]]
[2014-01-06T15:58:40.796+0100] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=44 _ThreadName=admin-listener(4)] [timeMillis: 1389020320796] [levelValue: 800] [[
Loading application [helloworld-webapp] at [/helloworld-webapp]]]
[2014-01-06T15:58:41.096+0100] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=44 _ThreadName=admin-listener(4)] [timeMillis: 1389020321096] [levelValue: 800] [[
helloworld-webapp was successfully deployed in 7,970 milliseconds.]]
On 06 Jan 2014, at 15:46, Michal Gajdos <michal.gajdos_at_oracle.com> wrote:
> Hi Ed,
>
> are you registering your FaceletMvcFeature in your application and it's still not invoked?
>
> Thanks,
> Michal
>
> On 03.01.2014, 21:39 , Edward Burns wrote:
>> Hello Jersey Users,
>>
>> I'm trying to hack upon the jersey-mvc-jsp module and produce a
>> jersey-mvc-facelets module. My intent is to make it possible to return
>> a Viewable that references a Facelets page so that users can take
>> advantage of Facelets just as they would JSP, Freemarker, or Mustache.
>>
>> I'm having trouble with auto bootstrapping, however.
>>
>> The existing usage contract for pulling in a specific incarnation of the
>> jersey-mvc-* feature seems to be to say:
>>
>> register([TemplateTechnology]MvcFeature.class);
>>
>> from your application class that extends ResourceConfig, where
>> [TemplateTechnology] is Jsp, Freemarker, or Mustache. I'm trying to add
>> Facelets to that set.
>>
>> Given that usage contract alone, I'd like to know how to make it so code
>> specific to Facelets is executed at deployment time.
>>
>> I tried modifying my javax.ws.rs.core.Feature implementation to attempt
>> to add an ApplicationEventListener implementation, but find that it is
>> not called.
>>
>> @ConstrainedTo(RuntimeType.SERVER)
>> public final class FaceletsMvcFeature implements Feature {
>>
>> @Override
>> public boolean configure(final FeatureContext context) {
>> if (!context.getConfiguration().isRegistered(MvcFeature.class)) {
>> context.register(MvcFeature.class);
>> }
>>
>> context.register(FaceletsTemplateProcessor.class);
>> context.register(MyApplicationEventListener.class);
>> return true;
>> }
>> public static class MyApplicationEventListener implements ApplicationEventListener {
>>
>> @Override
>> public void onEvent(ApplicationEvent event) {
>> System.out.println("debug: edburns: " + event.getType().name());
>> }
>>
>> @Override
>> public RequestEventListener onRequest(RequestEvent requestEvent) {
>> return null;
>> }
>> }
>> }
>>
>> What am I doing wrong? Any pointers?
>>
>> Thanks,
>>
>> Ed
>