Search code examples
sapui5hana

How to redirect a url to call a specific xsjs file?


If I have a url called https://hostname:port/service/session. How do I make it redirect to call my xsjs file called session.xsjs which returns session info in json format.

I was reading regarding SAP Hana XS configuration on below link:

https://help.sap.com/viewer/6b94445c94ae495c83a19646e7c3fd56/2.0.00/en-US/86c9d3762a6b47039346f8ef075f8a7a.html#loio86c9d3762a6b47039346f8ef075f8a7a__section_xxg_dlr_v4

But unable to find anything concrete. Any help is appreciated!


Solution

  • I found the solution.

    We can redirect the url to a specific xsjs file in the .xsaccess rewrite_rules property.

    Link for the documentation: https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.02/en-US/8067eabb21af4448b73895982ec394a4.html

    Solution for my example:

    `"rewrite_rules" : [{
                "source": "/service/session",
                "target": "session.xsjs"
         }],`