Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

SAP HANA XS Server - REST Web Services - How to get parameter from URL

$
0
0

Hi all,

 

we have a REST web services based on an Hana XSJS Project.

 

The URL of call Http POST is as follows:

 

http://localhost:8080/Project/prova@xxxx.it/3.50/

 

We have problemswithreading parameters as there isthe presence of thecharacter @in the first parameterand the pointin the second.

The file .xsaccess has beenpopulatedin the following way:

 

 

{     "exposed": true,

"default_file" : "post_url.xsjs",

    "authentication": {

    "method": "Basic"    },

        "rewrite_rules" :     [

    { 

    "source": "/(\\w+)/(\\d+)/",

    "target": "/post_url.xsjs?id=$1&poiid=$2"

    }    ]

}

 

while the file xsjs is as follows:

 

$.response.contentType = "text/html";
try{
if($.request.method === $.net.http.POST) {
var id = $.request.parameters.get("id");
var poid = $.request.parameters.get("poiid");
var output = id + poid ;

$.response.setBody(output);
$.Response = $.net.http.OK;}
} catch(e){
result =  e.toString();
$.response.setBody(output + result);
}

 

How can I solve this issue ?

 

Thanks in advance,

 

Luigi


Viewing all articles
Browse latest Browse all 5653

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>