Question on Prototype usage for endpoint - Netkernel Frontend Fulcrum module

Poster Content
nk4um User
Posts: 4
October 5, 2012 20:33RE: Meta Resolution

Thanks Peter. This helps!

Like · Post Reply
nk4um Moderator
Posts: 901
October 5, 2012 17:09META Resolution

Hi Abhilash - wow very sorry for the slow response - I think because this was your first post it went to moderation and then didn't get handled. Apologies for not getting back sooner.

You ask a good question. The prototype resolution is done with a tail first match. So jetty.HTTPBridge and HTTPBridge match tail first.

The idea behind this is that it allows for alternative implementations of a similar technology to be provided. So for example perhaps in future there might be anotherProvider.HTTPBridge (were we to have an alternative HTTP transport).

The underlying model for prototypes is that they actually issue a META request for the specified endpoint id. It follows that any META request can be matched tail first too.

Hope this helps and thanks for raising this - I know its documented somewhere but it probably needs to have a better keywords to find it.

Cheers,

Peter

PS You can use the Request Resolution Trace tool to try META requests on prototype's reference in its instance space to see where it will resolve and hence where the prototype is being provided from.

Like · Post Reply
1 person likes this post
nk4um User
Posts: 4

I was going through the front-end module when i came across this. In the module 'urn:org:netkernel:fulcrum:frontend', i see that a prototype called 'HTTPBridge' is used to instantiate an end-point into the 'FrontEndFulcrum' space. Per the documentation, the prototype definition comes from urn:org:netkernel:tpt:http. However, when i looked at the source of the module 'urn:org:netkernel:tpt:http', there is no prototype defined with the id 'HTTPBridge'. The only prototype that is similar in naming is 'groovy.HTTPBridge'.

My question is - where is this prototype definition coming from? If it is indeed from urn:org:netkernel:tpt:http, the how is the name resolution occuring because the text between the prototype tags in urn:org:netkernelt:fulcrum:frontend does not match the id tag of the protype definition in 'urn:org:netkernel:tpt:http'

Summary:

Excerpt from module.xml in urn:org:netkernel:fulcrum:frontend

. . .

     <rootspace name="FrontEndFulcrum" public="false" private-filter="false">
             <endpoint>
                     <id>fulcrum.frontend.HTTPTransport</id>
                     <prototype>HTTPTransport</prototype>
                     <private/>
             </endpoint>
             <overlay>
                     <prototype>HTTPBridge</prototype>
                     <exceptionHandler>res:/introspect/exceptionhandler</exceptionHandler>
                     <config>
                             <rewrite>
                                     <match>https?://^/*/(^?*)(\?.*)?</match>
                                     <to>res:/$1</to>
                             </rewrite>
                             <rewrite>
                                     <match>ws://^/*/(^\?*)(\?.*)?</match>
                                     <to>ws:/$1</to>
                             </rewrite>
                     </config>
                     <space name="Frontend Fulcrum HTTP Bridge Overlay">

Excerpt from module.xml in urn:org:netkernel:tpt:http (urn.org.netkernel.tpt.http-2.24.1.jar)

               <prototype>
                       <class>org.netkernel.http.transport.HTTPBridgeOverlay</class>
                       <id>jetty.HTTPBridge</id>
                       <description>Adapts low-level HTTPRequest / HTTPResponse objects in the HTTP transport root request to an ROC address space</description>
                       <parameter name="config" type="identifier" default="null" desc="configuration of bridge" min="0"/>
                       <parameter name="exceptionHandler" type="string" min="0" desc="service to format unhandled exceptions" default="null"/>
                       <parameter name="space" type="space"/>
                       <parameter name="id" type="string" default="null"/>
               </prototype>

''Please Note : I am very new to netkernel. If the name resolution of prototype definition is explained in any documentation, please help me with the link to the same.. I did try to research this but didn't get anywhere. I apologize in advance if this is something very basic that I have missed in my purusal of the netkernel documentation. ''

Like · Post Reply