JBoss Community

Re: Can I modify the HandlerChain at deploy time?

created by Alessio Soldano in JBoss Web Services Development - View the full discussion

Hi Paul,

sorry for the late reply, I've been busy with the 4.0.1 release.

I'm glad you've a pretty much working prototype now :-)

 

Anyway, this is what I have now:

 

  1. A DeploymentActivator with a Phase priority that comes imediatly after PARSE_JAXWS_HANDLER_CHAIN_ANNOTATION.
  2. A DeploymentUnitProcessor that...
    1. Obtains the desired annotation from the Web service impl
    2. Creates a new instance of WebservicesMetaData
    3. Adds the handler to the portComponent of the WebservicesMetaData
    4. Attaches the WebservicesMetaData to the DeploymentUnit with key WEBSERVICES_METADATA_KEY

 

Just few comments:

  • in 4) you should check if there's a WebServicesMetaData attachment; if that's the case, you need to update the existing one, otherwsise the data in it would be lost
  • regarding your logic for updating the WS_ENDPOINT_HANDLERS_MAPPING_KEY instead, I believe you should have that run after Phase.PARSE_JAXWS_HANDLER_CHAIN_ANNOTATION but before Phase.PARSE_JAXWS_HANDLER_CREATE_COMPONENT_DESCRIPTIONS, as there's a DUP registered at that phase which should be reading the data. You might need to shift Phase.PARSE_JAXWS_ENDPOINT_CREATE_COMPONENT_DESCRIPTIONS and Phase.PARSE_JAXWS_HANDLER_CREATE_COMPONENT_DESCRIPTIONS values down a bit, just be sure to keep the rest of the ordering.
  • to answer your question on the actual need for populating WS_ENDPOINT_HANDLERS_MAPPING_KEY attachment, yeah, that's required for having the AS7 components properly created for your handlers too.
  • on the contents of WebServicesMetaData and the possible changes on that, consider that it basically maps the JSR109 stuff, so the minimal data you're providing should be fine and the classes are not likely to change frequently, I believe they're pretty much still the same since they were written years ago.

 

Cheers

Reply to this message by going to Community

Start a new discussion in JBoss Web Services Development at Community