Re: post call handle for application/x-www-form-urlencoded type

658 views
Skip to first unread message
Message has been deleted

subhankar biswas

unread,
Jan 24, 2014, 6:33:43 AM1/24/14
to ve...@googlegroups.com
hi, 
  what is the proper way to handle application/x-www-form-urlencoded based post call. i tried with end handler and getting form attribute. i also set expectmultipart =true. but every time data is truncated from front.

header is Host=172.29.87.72:2003, Connection=keep-alive, Content-Length=26842, Origin=file://, Content-Type=application/x-www-form-urlencoded; charset=UTF-8, Accept=*/*, x-wap-profile=http://218.249.47.94/Xianghe/MTK_Athens15_UAProfile.xml, User-Agent=Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Micromax A110 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30, Accept-Encoding=gzip,deflate, Accept-Language=en-US, Accept-Charset=utf-8, utf-16, *;q=0.7

thanks,
subhankar.

subhankar biswas

unread,
Jan 24, 2014, 11:59:46 AM1/24/14
to ve...@googlegroups.com
hi,
  i am trying to get a post request from phonegap app using groovy(version 2+) verticle. have any one faced such problem with post http request.

thanks,
subhankar

Randall Richard

unread,
Jan 24, 2014, 12:47:28 PM1/24/14
to ve...@googlegroups.com

subhankar biswas

unread,
Jan 24, 2014, 12:58:29 PM1/24/14
to ve...@googlegroups.com
hi randall,
  thanks for ur reply. i am exactly doing what u told. but the problem is that vertx is not able to take the whole body in the buffer. a body handler should take the whole data into buffer. but what i am getting is truncated data from front part and it varies every time in the buffer. i tested the post call with simple java web servers and getting data right. is this is related to multipart request???

thanks,
subhankar 

Randall Richard

unread,
Jan 24, 2014, 1:42:39 PM1/24/14
to ve...@googlegroups.com

It's not a multipart/form-data post in my case, I'm calling that from a bodyHandler.

I recall there were a few discussions on how to handle multipart/form-data requests on this group.  Maybe this example will shed some light https://github.com/vert-x/vertx-examples/blob/master/src/raw/groovy/simpleformupload/SimpleFormUploadServer.groovy on how to handle.

subhankar biswas

unread,
Jan 24, 2014, 1:53:16 PM1/24/14
to ve...@googlegroups.com
hi,
 thanks for ur reply. any thoughts about data truncate. is there any limit for post request?

thanks,
subhankar

Rakesh choudhary

unread,
Jan 25, 2014, 12:53:21 AM1/25/14
to ve...@googlegroups.com
Hi,
    I am facing the same problem. I am using jQuery in client side for post request. I'm calling that from a bodyHandler. my body size varies randomly in each call, and the data is trimmed from front. Sometimes i get the whole data :) . what can i do to avoid random  nature and to get whole data.

Tim Fox

unread,
Jan 25, 2014, 1:12:00 AM1/25/14
to ve...@googlegroups.com
I don't really understand the question. Can you elaborate?
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Message has been deleted

Rakesh choudhary

unread,
Jan 25, 2014, 1:51:47 AM1/25/14
to ve...@googlegroups.com
Hi Tim
  I am using phoengap app at client side. every http get-call is fine but there is one api at server side which takes the phonebook from the client. client is sending post call which on average has 30-40kb of data. but every time this body i m getting is trimmed and data is trimmed from front-side(20-30% time i am getting full data). i checked at client side it is sending full data. is there any limit for size in post request.

my client side call is
                             
             var parameters =
                                           [
                                                {name:'mobiles',value:frndMobs},
                                                {name:'names',value:frndNms},
                                                {name:'name',value:name},
                                                {name:'mobile',value:mobile},
                                                {name:'mobtyp',value:'2'},
                                                {name:'source',value:'2'},
                                                {name:'wap',value:'1'},
                                                {name:'udid',value:lsS.getItem('androidId')}
                                              ];

        $.post(apiPathNeo+"UploadAddressBook", parameters, function(res) {
                ......................
            }

my vertx side post handler is


matcher.post('/:mod/:api' ,{ HttpServerRequest req ->
            def mod = req.params.get('mod')
            def api = req.params.get('api')
            logging(req)
            if(mod.contentEquals('tri')){
                if(api.contentEquals('UploadAddressBook')){
                    def body = new Buffer(0)
                    req.bodyHandler { buffer ->
                        body.appendBuffer(buffer as Buffer)
                        new AddrBookWrite().addrUpload(req,body.toString())
                    }
                }
            }
        })

my body size varies randomly in each call :( , and the data is trimmed from front. what can i do to avoid random  nature and to get whole data.


On Saturday, 25 January 2014 12:16:41 UTC+5:30, Rakesh choudhary wrote:

Hi Tim
  I am using phoengap app at client side. every http get-call is fine but there is one api at server side which takes the phonebook from the client. client is sending post call which on average has 30-40kb of data. but every time this body i m getting is trimmed and data is trimmed from front-side(20-30% time i am getting full data). i checked at client side it is sending full data. is there any limit for size in post request.

my client side call is
                             
             var parameters =
                                           [
                                                {name:'mobiles',value:frndMobs},
                                                {name:'names',value:frndNms},
                                                {name:'name',value:name},
                                                {name:'mobile',value:mobile},
                                                {name:'mobtyp',value:'2'},
                                                {name:'source',value:'2'},
                                                {name:'wap',value:'1'},
                                                {name:'udid',value:lsS.getItem('androidId')}
                                              ];

        $.post(apiPathNeo+"UploadAddressBook.php", parameters, function(res) {
                ......................
            }

my vertx side post handler is


matcher.post('/:mod/:api' ,{ HttpServerRequest req ->
            def mod = req.params.get('mod')
            def api = req.params.get('api')
            logging(req)
            if(mod.contentEquals('tri')){
                if(api.contentEquals('UploadAddressBook')){
                    def body = new Buffer(0)
                    req.bodyHandler { buffer ->
                        body.appendBuffer(buffer as Buffer)
                        new AddrBookWrite().addrUpload(req,body.toString())
                    }
                }
            }
        })

my body size varies randomly in each call :( , and the data is trimmed from front. what can i do to avoid random  nature and to get whole data.

Tim Fox

unread,
Jan 25, 2014, 1:57:18 AM1/25/14
to ve...@googlegroups.com
Vert.x will just give you whatever it receives, there is no size limit.

Do you have a working example that replicates this? If you know what the client sends, then you should be able to make a simple Vert.x client which sends the exact same thing, and therefore the same problem will manifest on the server.

Also, does this happen using the Java API? (trying to exclude the Groovy API as a possible source of error).

Rakesh choudhary

unread,
Jan 25, 2014, 2:13:21 AM1/25/14
to ve...@googlegroups.com
Hi Tim
         I will use java API and will revert you on monday , lab is closed due to weekend :( .
Message has been deleted

Rakesh choudhary

unread,
Jan 27, 2014, 2:48:16 AM1/27/14
to ve...@googlegroups.com
Hi Tim,
          I am getting exact same data after using JAVA API. There is some problem in groovy API :( . Thanx a lot.


Reply all
Reply to author
Forward
0 new messages