RESTful Web Services: How to read the header - Get request

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

RESTful Web Services: How to read the header - Get request

Postby marco.rossi » Tue Mar 15, 2016 12:18 pm

Hi all,

I'm working to manage a webservice with Servoy.

The IT division of my client is asking me to read an information (HTTP accept-language ) within the header part of a Get Request instead to specify it as an argument/query_param.

My question is:

1 - Can I intercept the HTTP-Header of a Get Request in some way?
2 - Is a good practice to use the restfull in that way (using http header param instead argument/query_param).

Thank you

Marco
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
marco.rossi
 
Posts: 42
Joined: Sun Apr 12, 2015 9:33 pm

Re: RESTful Web Services: How to read the header - Get reque

Postby ptalbot » Wed Mar 16, 2016 6:55 am

Use Velocity for this, you will then do:
function vr_getContext(request) {
var headers = request.headers;
// headers will be an object key value pairs for each header.
}
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
http://www.servoy-stuff.net
https://www.servoyforge.net
--------------------------------------------
Servoy 5.2.16 / 6.0.9 / 6.1.6 / 7.3.1
All OSes / Java 5 & 6 & 7
User avatar
ptalbot
 
Posts: 1612
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: RESTful Web Services: How to read the header - Get reque

Postby marco.rossi » Wed Mar 16, 2016 2:25 pm

Thank you for your reply Patrick.

Velocity can also manage a client pool to manage incoming requests?
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
marco.rossi
 
Posts: 42
Joined: Sun Apr 12, 2015 9:33 pm

Re: RESTful Web Services: How to read the header - Get reque

Postby Gordon McLean » Thu Mar 17, 2016 7:15 pm

Yes it can there are various options

Cheers
Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 214
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 3 guests