java - Jersey REST: Importing headers from a Map into a WebResource instance -


i trying take in arbitrary set of http headers , dump webresource instance. webresource interface allows 1 query parameters offers both

        webresource.queryparam(key, value) 

and

        webresource.queryparams(multivaluedmap<string, string> querymap) 

the api however, not allow same done headers. there 1 function,

            webresource.header(key, value) 

which allows 1 enter key-value pair http header, no function

 webresource.headers(multivaluedmap<string, string> headersmap) 

to solve problem, tried retrieve builder webresource , iterate on it, adding headers 1 one

        webresource.builder builder = webresource.getrequestbuilder();     for(map.entry<string, string> headersmapentry : headersmap.entryset()){         builder = builder.header(                        headersmapentry.getkey(), headersmapentry.getvalue());     } 

but doesn't seem solve problem.

does have idea how can workaround jersey can dump arbitrary map headers of webresource?

thanks, david

it turned out way around first extract requestbuilder webresource using getrequestbuilder(), , using requestbuilder build , execute rest of request.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -