PASOE web transport: determining Handler URL in Handler class - Forum - OpenEdge Development - Progress Community

PASOE web transport: determining Handler URL in Handler class

 Forum

PASOE web transport: determining Handler URL in Handler class

This question is answered

Hi, 

I'm trying to figure out what the handler url is in the handler class or to be more precise add is added to the handler url. When I add a handler I create a mapping, for example:

/ping --> PingWebHandler

If I use  IWebRequest:PathInfo then the /ping part is included as well. But I'm interested in what is *added* to /ping, since within the Handler I cannot make any assumptions about what the "mount point" is.

thanks.

Verified Answer
  • Would it work for your use case to use URI_FINAL_MATCH_GROUP?
     
    request:GetContextValue("URI_FINAL_MATCH_GROUP")
     
    For a request like
     
    where the openedge.properties mapping is
     
      MyHandler: /open
     
    URI_FINAL_MATCH_GROUP returns
     
       /more/stuff
     
    -Mike
     
     
     
All Replies
  • I'm afraid it may not be documented.

    When a request is matched by the URI template in openedge.properties, the URI_FINAL_MATCH_GROUP contains the remaining parts of the URI that were not explicitly matched.

  • IMHO: the contents of URI_FINAL_MATCH_GROUP deserve a place in a) the documentation and b) IWebRequest.

    What I noticed the in the PathParameterNames is name of URI_FINAL_MATCH_GROUP appears as  URI_FINAL_MATCH_GROUPFINAL_MATCH_GROUP, for which I logged an issue with techsupport. In ContextNames the name correctly is URI_FINAL_MATCH_GROUP. Speaking of which, what is the difference between PathParameterNames and ContextNames? They appear to be the same (apart from URI_FINAL_MATCH_GROUP).

  • You should be able to get the path parameter without the URI prefix.  For example, GetPathParameter( "custnum" ) instead of GetContextValue( "URI_CUSTNUM" ).  The difference is that the path parameter names should be as defined in the URI template and the ones in the context have a URI prefix to set them apart from other context values.

  • PathParameterNames will give you a list of the substitution tokens that you've set up in the handler URI
     
    So if you have a handler for /Customers/{CustNum}/Orders/{ONum} then the PathParameterNames will return you CustNum,ONum.
     
    The ContextNames property contains a list of all the available context/variables, which includes those used for the param names (which are prefixed by URI_). So in the absence of any others, you'll get URI_CUSTNUM,URI_ONUM  in the above example.