1 Reply Latest reply on Mar 4, 2014 4:37 AM by Tomaz Cerar

    REST Servlet in WildFly submodule?

    czerny Newbie

      Hi,

      I'm developing WildFly extension to inspect CDI components.I'd like to provide collected data for further processing in JSON form. What are suitable ways to do so?

      I was thinking ...

      Can submodule run its own servlet container with own servlet? Or is it possible for a submodule to 'inject' a servlet into servlet container of running application? And how to do that?

      Thanks for advices.

      Jakub

        • 1. Re: REST Servlet in WildFly submodule?
          Tomaz Cerar Master

          Jakub Niedermertl wrote:

           

          Hi,

          I'm developing WildFly extension to inspect CDI components.I'd like to provide collected data for further processing in JSON form. What are suitable ways to do so?

          I was thinking ...

          Not sure what exactly do you mean, but our core mgmt data model is done with jboss-dmr which is interoperable with JSON.

           

          Can submodule run its own servlet container with own servlet? Or is it possible for a submodule to 'inject' a servlet into servlet container of running application? And how to do that?

          Yes you can inject servlet (bit more work), or even directly undertow's HttpHandler(easier) to any deployed application during deployment phase.

           

          You can just add your handler to outerhandler chain by adding it to list of handlers you can get from deployment unit attachment.

           

          List<HandlerWrapper> handlers = deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_OUTER_HANDLER_CHAIN_WRAPPERS)

          handlers.add(your handler);

          this must be done in DeploymentUnitProcessor

           

          For servlet you need to modify web metadata to include also your servlet.

           

          --

          tomaz