Forum Stats

  • 3,855,018 Users
  • 2,264,451 Discussions
  • 7,905,863 Comments

Discussions

Use of ORDS Plugin API to implement a filter

Hi All,

We have a simple requirement to slightly manipulate the inbound HTTP POST parameters that come into a ORDS standalone instance. The reason is that we have had to migrate from mod_plsql over to ORDS and found a specific scenario in our ageing application where a form post doesn't match the POST params the same way to the PLSQL function inputs... We are trying to avoid redeveloping the thousands of forms that use this type of post.

We identified that Oracle provide the ability to create and load a plugin in which we have successfully been able to add a java filter to intercept the request.

i.e. https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/21.1/ordjv/doc-files/developer-guide.html

BUT.. (I wouldn't be here if there wasn't a but... )... even though we are modifying the inbound POST variables they do not seem to be being passed through to the PLSQL modified.

I am wondering if anyone has ever done this before?? Oracle support say "the custom plugin and filter related issues are best addressed in community. If it is documented mean it should work".... so here I am.. I have SR 3-29801050661 raised.

=========================

Here are some more details:

In https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/21.1/ordjv/doc-files/developer-guide.html

the guide states under Extension points "Plugins can plug in additional logic at the following extension points: Manipulating HTTP requests and responses by implementing the servlet Filter interface."

I implemented a filter to alter the HttpServletRrequest to resolve the issue using the @Provides(Filter.class) and @Priority(ring = FilterOrder.STREAMING, value = 50) annotations.

The filter jar was built and installed with the "plugin" command and logging confirmed the filter was called and altered the request as expected.

Note: I tried altering the request in 3 different ways (HttpServletRequestWrapper, Proxy and introspection editing of immutable private request data), but none of the variants worked.

Eventually I debugged- to view the request entering ModApex.handleRequest() and despite my filter being executed and the order of calls being as expected the request passed to ModApex was a completely different (and unchanged) instance from that passed to and returned from the filter.

So the question: is there something else I need to configure so the pl/sql gateway gets the filtered request, or is there another supported way of doing this, or can they fix this behaviour.

1. why does the request object instance passed to the filter (and passed along by the filter) get seen by all other filters, but NOT by the ModApex pl/sql gateway which seems to get a completely separate instance without the changes?

2. is there some special config we are missing that would allow it to work?

Answers

  • sam.pipe
    sam.pipe Member Posts: 12 Blue Ribbon

    FYI.. Oracle REST Data Services version : 21.4.3.r1170405

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,774 Employee

    my developer said this smells like a bug. Can you contact MOS and open a SR?

  • sam.pipe
    sam.pipe Member Posts: 12 Blue Ribbon
    edited Jun 29, 2022 7:17PM

    Thanks Jeff... We agree that it feels like a bug.. I've been down the SR route and have a case open for 15 days now... but they keep pointing us back to this community page believing its a plugin issue... but from our prespective its how the plugin setup is implemented.. which is a bit frustrating..

    SR 3-29801050661 : ORDS Does not seem to be passing through parameters which are retrieved via owa_image.get_x(image)

    Happy to put the SR contents here is you are unable to see it. Maybe it's time I escalate this in the SR.. ?


    To give you some more background, we have had to migrated off mod_plsql due it being depreciated in OHS and us needing to keep this OHS layer under support for our customer. We've had to move to ORDS to replace this mod_plsql functionality.

    Sam

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,774 Employee

    I'm reaching out to your engineer now.

  • sam.pipe
    sam.pipe Member Posts: 12 Blue Ribbon

    Thanks Jeff.. much appreciated it....

  • sam.pipe
    sam.pipe Member Posts: 12 Blue Ribbon

    Hey Jeff,

    I've been informed that our SR has been raised as bug 34349917.

    I'm trying to get an idea on how long it takes to turn around a fix as our customer are having to make some decisions on how to proceed.. do these things usually take days/weeks/months?

    Happy to talk directly via email or teams or phone if easier..

    Thanks!

    Sam

  • sam.pipe
    sam.pipe Member Posts: 12 Blue Ribbon

    Hey Jeff,

    This is what I've been told by our Oracle support case engineer..

    • Patches are only released every quarter with the ORDS release cycle so the earliest it would be for the bug fix would be Sept this year at the earliest if our bug made the next release.

    As this is a going to massively impact our project timelines we have had to make some small modifications to the Oracle ORDS java code to make our initial bug scenario work... This obviously comes with support type ramifications ... our Oracle support engineer could not comment on these ramifications and kept pointing me back to this forum..

    So... we really need to understand if from Oracles perspective we run our locally modified ORDS until this bugfix comes through ... I seem to be bouncing from MOS engineer, to this forum, to our clients Oracle Senior support Account manager, and back again currently with each one saying to talk to the next.. :-(

    Happy to take any advise.. also happy to share what we have changed in teh ORDS code..

    Thanks,

    Sam

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,774 Employee

    Patches are only released every quarter with the ORDS release 

    Not true. We're working on 22.2.1 right now. There will probably be a 22.2.2 or a 22.2.3. Those are reserved for bug fixes.

    So now the path is to let the developer take a look, determine if there's actually a bug, and then get you a fix, or let you know it's already working in say the latest release (22.2)

  • sam.pipe
    sam.pipe Member Posts: 12 Blue Ribbon
    edited Jul 7, 2022 12:45AM

    Thanks Jeff..

    To ensure we are are ready for a fix I upgraded our ORDS from 21.4 to 22.2.0... but this now has opened up more questions as with the change of the CLI, the developer guide for 21.4 doesnt work now for 22.2.0..

    i..e installing plugin via this command doesn't work now as the 'plugin' option is not available.

    java -jar ords.war plugin built/plugin-demo.jar
    

    I cant seem to find any updated documentation on how to add plugins for 22.X versions.. is this still a documented and supported process?

    --- added comment ---

    We have worked around this missing 'plugin' option and just added the plugin filter manually to the war/web.xml. We can see it is being executed but from our test it still does not update the request values that are getting to the ModApex code.... therefore no change in the latest 22.2 version.

    --- end comment ---

    Thanks,

    Sam

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,774 Employee

    There's a bug open on our java plugin framework for ORDS in 22. 2