Getting an array of formFields

40 views
Skip to first unread message

Jacobus

unread,
Dec 7, 2015, 5:24:50 PM12/7/15
to Akka User List
Hi guys,

I receive message content from a monitoring device in a formal like this:

POST /monitor/status HTTP/1.1              
Host: testingtesting.com                                                
Connection: Keep-Alive                                                         
Content-Type: application/x-www-form-urlencoded                                
Authorization: Basic cmVtb3RlX2
cmVtb3RlX2NsaWVudNsaWVud=                      
Content-Length: 78                                                           
                                                                               
&reading[0]=0004A38E5835;                                              
&
reading[1]=0004A3D3F18B;                                                          
&
reading[2]=0004A3D3F18B;                                                     

Now if there was only one reading, then I could just use:

formFields('reading) { reading =>
  complete {
    logger.debug("Monitoring data received: " + reading)
    ....
   }

But what is the best way to access an array of measurements like the ones above. Is there some sort of directive available for this?

Thanks in advance. I hope there is someone out there who had a little more coffee than me.

Kind regards,
Jacobus

André

unread,
Dec 8, 2015, 4:17:07 AM12/8/15
to Akka User List
Hi Jacobus,

it's currently not possible to extract a sequence of values with the formFields directive. See this post[1] on how to extract all form fileds.

FYI: akka-http recently added the * receptacle to extract sequences. [2]


Cheers
André

André

unread,
Dec 8, 2015, 11:15:10 AM12/8/15
to Akka User List

Jacobus

unread,
Dec 8, 2015, 7:28:34 PM12/8/15
to akka...@googlegroups.com
Thanks so much Andre!

This was exactly what I was looking for.

Kind regards,
Jacobus



--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/Wzd6MxAi1UI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages