Spring POST multipart/form-data Request empty body

2019-08-04 13:22发布

I need your help. I am implementing the server part of an RESTful WebService with Spring 3. Unfortunately I have no influence on how the requests were sent, so no way to change that.

I want to receive an http post request as multipart/form-data. I've an @RestController and did a @RequestMapping .. the request arrives in my method

@RequestMapping(value = BASE_URL, method = RequestMethod.POST, params = {"create"}, consumes = "multipart/form-data")
    @ResponseStatus(HttpStatus.CREATED)
public void post HttpServletRequestWrapper request) throws Exception

I hoped that I can use the request.getParts() method to retrieve all parts. This is not possible, there are always no parts available. I think I figured out why: from the client no name attribute is specified for that part. I tried this with a RestClient on my Mac (Paw). When I leave the Part Name field blank, the getParts() method always returns an empty collection even if a file is set as value.

My first question is there any possibility to use these Parts without a Part Name?


Then, when the Spring PartResolver cannot handle the job I'll do it on my own. So I thought I can parse the RequestBody myself. The problem is that the request.getInputStream() is not "accessible". Meaning, that read() always returns -1. When debugging I see that the Stream has a size, so I guess that the stream has been already read by Spring.

My second question is, how can I access the post request body to parse it myself?


Here is an example HTTP Request. This request only contains one part. As you can see the header "name" for the part is missing. That's why Spring doesn't make is accessible via the getParts() method of the request.

Host: localhost:8080
Connection: close
User-Agent: Paw/2.2.5 (Macintosh; OS X/10.11.1) GCDHTTPRequest
Content-Length: 19691

--__X_PAW_BOUNDARY__
Content-Disposition: form-data; filename="Invoice.pdf"
Content-Type: application/pdf

%PDF-1.2
%Çì¢
6 0 obj
<</Length 7 0 R/Filter /FlateDecode>>
stream
x5A
0ïyEÎb¶i½ûûQñ ¢þlYY&»abCvýË|À}¸= ¸µÙA% $.ÑÜ«æH    ïÖ¸]_Î3ïrW1²/©ÿÑ×ã   SÓÌXendstream
endobj
7 0 obj
105
endobj
9 0 obj
<</R4
4 0 R>>
endobj
10 0 obj
<</R8
8 0 R>>
endobj
5 0 obj
<</Type/Page/MediaBox [0 0 595 842]
/Rotate 0/Parent 3 0 R
/Resources<</ProcSet[/PDF /ImageB]
/ExtGState 9 0 R
/XObject 10 0 R
>>
/Contents 6 0 R
>>
endobj
3 0 obj
<< /Type /Pages /Kids [
5 0 R
] /Count 1
>>
endobj
1 0 obj
<</Type /Catalog /Pages 3 0 R
>>
endobj
4 0 obj
<</Type/ExtGState/Name/R4/TR/Identity>>
endobj
8 0 obj
<</Subtype /Image
/ImageMask true
/Width 2366
/Height 3069
/BitsPerComponent 1
/Filter /CCITTFaxDecode
/DecodeParms <</K -1
/Columns 2366
>>
/Length 18410>>stream
ÿòÕòÝ£Æn?£¹FyB1Ñ:!ç!GDHDr0!´{6ò:8Ì"N#äp0G0Ü
ÅÄ/Ñæ^=©c0!HÃ(ÌDDDJÓ#(3Hàt! °VdÔ k¹FëHlã.aÈ-XåRâÑ,¨økEÑ)Ë£ ´GEÑ!Ñ~/"è¾mÑ|Â&qp<Hñ¸DDáHèÈDUFÂ.ñ9â>"[§
ÄDDDDDDDDDDDDI°²þZ£ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿËYZ<£ÊZÕÈ4h3q·µ´ï_ú§ïö±pG¹!ɱ÷º{ùïÅÜZL¼K"Yfãyf©eѲ£¥×NóùféÁ¨'@yf,áG$8a¦LÛBõ'ºÍ§ D °2âäÈ%ä&r¾..Èþe#hù«4
r-_xDv0`×Uñ¬!A"$AË)a¸AyøkÈAʪ£¤$ð=a  5N$(  QN
dAÊ«=¹ÈR(¡ÞÕF>ý÷!K«þkB">¶¬5S°A"Payqú~¾EÞàèi0Ð;Ò´DÙ+hØA§{!Ä]Ù)!f6`Ö[Dà6ÉcDµ¢bÎ@ÛmIwÊz3.f À94"æ³@´èMðA¸A´¬Ýá%
¿KÃ`°Á¸=$H@xxM¨0Ûum/nß 
ùrnAÇ»Wr,ì6óÂH7m«ÐmÛ§ômëH ßÐÇtOG}z &߯nÿIöÛô¾!°è0Ûð}$ÿí·¥þÛ~7ä#¡"=Óa¿ô    ×ý¶ßÿ
¿Tðß@8   Â2
¿
xaágÿ¶m¿Òol0üI¿  !¸iÝÁ=ÿ$ÿ½ÿô½úI¿
#*$ý²á}¶ý#úßþÕÿþÚáU¿&?i.8lÿõOÿÛéíü*üPNcS°ÿö·ßÚ·÷þߪWpÄUºû¿ú¥{ÿ¿ïýý+IÁ!)òÇ×Ýüu»ýߧÿÚ×ãX·÷ýÕ+ÿÝ__Mô½ð~÷ÿÛÿóiÿÿ¶þ]S_×õÞ¿û¿ÿí¿÷¢CÑlûkKßõÛýÛú_©Âl3yÈçO¾5Mÿúl?ÿí·õìEñqØ&÷þ¿ý«¿ÿý®<22ä`6A$Lp×¥Lï
÷ÿ^?Kad6Ç¡qßÿ¥ÿüã¶ÿûñ¡¤¿¥þ¾Ûÿí·õT÷ÿ9-ÿkÛoÿý»ÿÈ
þ¿ÿ~Ûÿí·v¾?ÒûKÿmý×ý·ê½úþ¿ÿ÷ÿîÿ¥
ýÿÿßÕÿÛnµ|àaÃõKÕRþ¿oõÿÛú\XäHäßô«õÿ~íÿÿ·wýÚ ~_ÿÿ¶÷íÿ·oBMÉF:BLr1þ>ÿþÜ>Ý/öÛZü@é   rCÀã½Kë_ÿÛz¥ÿí¿ò,
V"""!"?¡ù]%úûl;ÿü6ߪ§dÇ   |$¿áÕm¾ûÿ¶ÞþBWÈãü.¿â#þÛëöÛëú§öaÂìÿ^oÛÿá·¯Á¸¢ÄB4¹Ua_íׯý°ïèäüÌ."E§ðÏânF:õvïëýß¾Ãu(ì·(pPZþ?vï÷ÿî¸Ðë¿õýÝWÿ¶ßNíÕô7ærW¿ÿý»ÿü;¯¯ßM¾A¿ùí¿ÿûnÿé~Lr·íÿïûo·ÿöß{ÿá{ûÿÒý»¥×ýïÿáwmýÿýÛ¿ÿö×ÿúÝÿÿÿm׿ûÿÿöa¿}¿ÿ
ßÿøm¾¿¾ïÿÿ¶ßZÿí÷ÿ}+vÿÿ¶ûÛÿa¶×¿ÿ{ÿÿý·ëÿÛ~»ÿì0ß×þÛ¾¿Ý»¶ÿbPPdãýÿ}ÿþßûÿ¶Ö¿åUÑ¢$³þßÅ¿ÿÃÝ×_íßíü²-!¶æd
ÎPå9C©78å97$äË°®÷oÿÿ[oÿý¶;¿äØ0×[    â""""""?»ÿû¶Å}¥ûµ÷ùI»0á~ïîÿý·ÿýõoøuÿÛýßßöÛßÿm»vÿL ï÷oïÿ÷ûoýÚÛÿwÒ}í¿ Ûÿöi¿Òöÿë5m¿   ¶ÙUþ⾿¶;ïïõnÿ¿ÿö÷ÿÛÝ¿Þ©ÿÛý;kÿí÷ëíí¿ýpávÛo×Òõýþúÿïÿhßô÷êÛkÿöû¥ýöÿ½4Ca$×í¿Ón¿ÿuú^ÞÝßïa<® Èdpxl!£:Ûöõí§é~ÞÛÁwêÜDa;{õ߯¿o¿K¶öÛý«ûmú,tÛ$þÞíÿ¾Ûÿ}Rþíþ¶í/ÿwnÒý½úûúWÿ»mý+Ú×þÚ¶áRööØßZ|>¾íúUl4¿þë¸I}í°ÿçiÇ@ä(wÕV¾Þ¸^m:ô¿owJ»oa¶¿È@ÎDÃFt
a°
ÀíȨÞþàÎ`H0Á!ý,7°ÃA%pÝ"èá~xNe®a¡ï¶ÝíXa°ÁR_¾Û¶Ø0H$ݶÈB   }z    ý¨Ñ°MÉÁ1ÄkÜ>    ØdAÊð«þï¶ÔU
Ûá3aBÐM=S'¢¿ÌDDim+»"GiXaXa&Þlá "=B.©øIÿÆ°ö%0Á `ÂPd1ÈNØa 00má4Õ4ô¤ÔÄ&¸FC(4ÙOà2Th0máAü$·AØ_I§ª¤d·hHÇ"@ðZ¦v¤1CH §I¶0ÃE@#ÂG14\*~©ûz zr9äãÞC`ä4Ü|p®ÁjACA\xb%¸¸1
«¤/ÄDDDDDhlDDS!H­ bNuÖâOKëÙÁ¬ îTÓ Ø"LÅÔÏoJA~ûòCPrNMÔrn@ð.9(&9är1Èw#rcRrPqÎ9!Èl¡È®Så¬  ½Y¨A´~Òò 3dIÄÇïílØÿzúýÚ~CÄDDDDIQÒAá7¥OÿÄEÊdsq:§®Ò¦äô·é2æ`Ì2äG"àx0\ÈáG"9.dp7#ÁÆG
tÝ<BI¸CMü·&äàÙ7.ËrwpîáÃ[Y8.p\¡Ë{@ÍfÃZø\ÜÜ&°ÓL~ë¦}/ìF×ÖÆ"""-$
ÐE8úp+A!hDDDC´aá àÃqÄEaíò-_ëöBº#³Øl;¢;l2Án#
¤ÈéZk.Úo1J `Á&%Õfß]Eªþýz×Syìæ{9G¼_oñÎg3Úgìæ{Læs=±öôÍÿ¿Ò^·ÿwwßÿßwÚ÷ÿ¯þÿ®«Þ©§ßýý~!¡hDDDZDZÈ4F8hî/_ÄDD¬"Z謨qÿç&ÞeD{9G³ìæz7G³ìæ{9Îg³¸än9g#ös=ÎJyÎg³fãÈæs9ÎG$Óï÷ñïk}ݧßÿýÿÿýý¿}ÿÿûî×
¯k§°^úi ÕÐätлTÐnAà\WÀ\Vp!wB j¥ïûý;1Hðá#ÂGÄ  8Ì3¸KÇ#È0ÄÌ0Â;>$vÃ;ah4Ðvi¦rAç ÍeÀ!#³
4¼Û7}¿µíõ»O´ÓMu]S]WMª½ªé®ëwÝÝÿï×ï]Wÿßwøï¿wÚ}ýúÿÿÐÝ®ØZpðDDP!øl>˳X0b"%!á a0aeÀ0a`Ã0b"9Ö1G
]ÉO9ä²wä4HrNHq&äI¦zj#GHDzÞªª¶ýÉ*ïMoðDG5wxéßñÿ÷ýñüôCÞרPDaÂA
ø:ÿ"$$Ç!Dcúå<ý6Ù¨}°ÂÒ$äÇ#u   q&9î¡"nF98ROAUuprïÈpè<Î>²C²9hqDE§!uÐwUv¢.ØPiqST«Jÿ¶ÿ«F@ñ\`þ·ëNÚþÁ¶AònIÉ<$9äÇ#r1ɹCmÖÈÀo
XuðÒéØÙàó<9S)@â$QÏB¸§)AÒCÔ$ªIa(5Ý[ÄDDXÄDE/ãb»ÛvÝôÂkaµ¥þ½ÝjÛ    uÿ»þÒ_ØMvÂý÷è;[mi8`®¼&[ºÃý¶½°aSµh5¸auA«.ÊNPåá[+ªN9à²ÒÝ0ÓAÐ0BF"""""""0dÇ!ÎäÊH`¤Ù©Ò"1ZÄF<ÑGÿÿùjC#òÍ0!&ÈZ(Â&Ã5vC!ED
D)îÓ  ®«U ÚUZ­/¿ÿÒÿú¯ÚׯUúú¥¯¢r+ßq×ý®8i¡ê5XÒ̸r0e )PµjDKHêÌÌ!ó¦4 cÈ=f°À\ØB!)89Ô@3ãá4E0L õð¡©3DCAPh@´ÁºhXB½
5PÐi®ºú^Âë­Ri× ïÒMt>½z    úaz¦úzëþÿÿ­Ûô«¥]¥éH|¾8ùv¿ªuÈ8ÿ{¢¹8bAy§:£éHOÂ~=ÑnC´Ò½Î9Ç@ëAë^é>AºzúO!4½i=$,%áöëIëÕ$ZOUUZP®»úWOIZ__×Mt*Ha:õOÒO¯ÿJúúð°¡.ízZ°Uú¥ú×TÖB°q×ñ¥u¨ëÿ¾ºÀº[ÿK×_®©kþuÈ]kúN._ªJ«!ì§0Ä©aõþ_ê½}t#­PzõÿÈ?Zú®¿­`xK
×õªö«×ÿ¯ÖCÿPò#k¿¥úä áWþª¿ZAaý­uC­iköT©QHÿW­wêëÿýÕ%ÙAU4Þ²F«ÚÒ_aVµKA¾ôêðþ½÷õµKÿµU¾Â×ÒÒ_i´ëᮾÚÿ Ë¾ÖþÖÖ[
ºÁ­Òë
U(Ð{Å}Â_U/#øÿÒIE1ÿ±\ú«ÖÿMui«M5^õ[J
B®ÓûízM}=oí¾ÕUu[îÕo» ïéÖ© ÿTV¾AãÔ:jA Âh4_&TÓ ­ Èi¦0A Î8!ÂÈCÇi¦a0A¦wAÍXhÑ
",¡ÊpDDb!! qt!&KAå²vvc)0XiÀy%A    IpáÆZf¨¯PCXYÁÓ>Y¡R"/GhA¦©§jA§cØL'¦°¡÷Á Â(Aí_}¦«~ß­®Wý¦ªqòð¿äÊ!Ï÷

Âãÿ' IÂÓ¤"hûéÒM­?|¿z¿Òº~äd;¡cò ]ëÝwÿBóa¤|)ÔgA"8g¼ÌDý&×Ü Â    i¦a4þìÂj¾Õþiè=?Â
øõÄVB÷þN.!ük}kðºÿ¨AßÚ߶GÍ°_­Ë iwëôkPZÿ,wÆVE)R
UÁdzò?äò·íj;ÿ&Áa0A â¡6{rò   ÿõÈëK] geäðAOA<'§§ýÒ¿!ûZ_þOÂ
4¨=ß¿ ßíô0z_þ¯i¦mÓÿÓÿ^ÿµôÓTá~ÁW_µþßÃ×ÿêiÚýãÿë¥÷¯ÿ¾DÙëÝÂAÑt¿ÿ×ýÕHg¡ß_þúä$4BãD?j"?ÿÿ}ïºõßü­à·ÿÿÿcè²^A~õ oúé´'ÿÿÿýýKÿï÷¾û×°úÿÿý¯øh.ÿîj
:!3)áéÕ÷_ÿÿÿW´Â^¯Áa\
<'ëÿ{µÿö»ú·¥ÿêÓN4N/ýo|7"¤ÿÿÿÛþÒ®ûýNAqݧ×ë¯ïD_ÿ¿µûa$·KK÷~©í¯ûyïÿþ×ûVÕ#æµµøM8Õ;þ×| v¿ÿúïÂÁ¢/´5úòOb½¿öí?×ð¾Ã[oNCã]?Útò22î¿ÿ¶öÒÿµøkÿK»[TBæG8dCh6v]uíÕ_ÛìtÿM}|$Ãþý­ÿ¼Sÿÿý5îÖÊé½­ëI­ûí[]½ÿúߧ^¾×´ôõiá[k·TëýïºôÕí0½\1k
{ÓadnÒÿ× ÀÿúaVÓX[È:w-
R!q±±±íiÿï¼0^öC0h.A»¬"¬!V=VÈ1¢R ^Ð&ß}à  »áíS]M­¢èÂ#Â" Ïp¾¹¨66áݦ  aû¡0F¤$bÄDDDDG^ÃkúíH0=ÄA B"Dùåû~¿îÈ<C[ ÄEò(ß5×úÃkþü/û)õÞ ×øÿñQÇ`ÈáàÝè¡ù¯ý?â«yäDmÿ¬Ño}Aý%{þzþy½-zýéê½5[ }w_­­®W½ö¶ìI°aL(`»`°ÂßaX4½X0V*(
ЬlTwÅ1[CéþÚ÷z®õýU?i¯pÂö
5v}궦a5»!·¦= Ó;M4í0A`¢L'ÂÁ2bADDDGÿÿå¡/d¢6de È°(;9TC!¾wL(A¦wýAáýSAÚwõMl'Tí>ö«ª§!)Æ
´h6³h;£¨^&ÒzMï×}µn½ÍgC­]=uøD=EÙLÙ9©¶ÿÐh=;?é:í?§h^Dýb¯ ÿ½{}þ©'ý࿯¤ëøakÿu_øÿþ¶¸ä8ëÙï·ëè~ÿÿIªzôÿøI4õÿÿJëýÿÿé0Ó.¿Ò¿ÿé\Gþ×ÿõD)ÿ¿ÿÿV¨'ëÿÿÐXoúÿ_[ÿëßפ¿ý_ëþ^¾õÿ{ª_"þ¿éÿ÷§«Ð_ÿÿí}öj¿ïßjÚIjØ@ÿÿi:V©júÿöÖØIlÂ_ÿa&
d3¿üqÅ'±]ÚߧûþîÒÂiúþÓUõÿö®ký®ÓA­ÂÝÚíB&`A¦a`¢!DGÿÿå$E¤ìH!P)H!T"H¹`XI7gj"¤!&)Èø"´
° ahN0jªeL)¥ ÈÀnk Ða
¡0A×A Ða¡4NÓON×áTÐzié¦i­¦Ó¸a4õO[»ONÓúa0¯kV÷§k}PiÓÂ!aÈä]©fÑ   ôEDt
"E¦E rl1Âè!3!3"sD'äG5ah&ô¥tûi$ûjñ
tðM¤îôÝtëïUÓtü'¦Õéá^Óz]=>ëû¤éIºuz½ê½òT]×ß×µÓï}_êÿ÷t¼9*ËÜ>_á¯ëå tûÿ¨küµñ÷ûñû_¶
-}~+Þkëí«úý_?ÇWþ«ým%ÕoõRè×ÿ ÿKïµSdúmûi}¥¥¿ý=&Ö­ûâþiVNÚM¬0Kÿßé{$ØJVÒðKãb%íý?Íaþ8ì¹4)n¾½®ÒÿèwøK°Â
 u|D:
¶þÂ
C»[_OÿÓM}}<WÃôÂr÷al/I¿ïÓNAÝø}¯¿AÜ{om}?÷é§"Mßá­ýþ©Ó²¢Ã
ØOÿíöÐvxux«^!¿04DÇMn8úÿa=4B»§ÝòÀõáýr
»^/öúDIº>#MþE)µíù°]Ý6.pwÿøo³a8îpü÷ôðêßmÈ0<?ÿM{nûÖ
ÿÿ]>®ÖÈaÿÿÿt¿ð¿¿ÚÚÿ°°Âÿû}^û{ÿªßoôÿ~
a¿ÿÿëÿý7^Ö¿ê±Ã*Öÿõÿÿèúý¯¯}Gò0=¤íÐdÇKþxñuÑD õ<TÝ
íçcëÿçÏñüóU^¸Kië¯Úª5>KÿÕm~ôé?ÿDAíýtõúWÝZUs[ÛJÒ×]+[«^&V¶·ÚW¶­þÐûu­ú¶·]­=¥kkjý«am-/k°Ö×[Ý&ë
Ø^­°ÖL:aØJÂÚM«kí}&Mm(al%iCK°Z¸ØeÂÃ#    A ã¨ã#ì0hpÂØXiA`ÁY
öDZ¤í1±Lllm5X¦****)¯Jþ©¦ívôí;Óí«m4í5M4×kݪzi¦¾¦jUOÿi í Ó[ Ä4­¦M®×µL&M;NÂi Ó4 ÐiÁ¢¦a¨¤sÛ5Á$XD/#â"#ÿÿÿÿÿÿÿÿÿü¶TSÙËá?鬷/®«ÓÙ@d]ö9ó¢'r:­îÓ4"FgÉLÐA¢)Â!Ð8ëäL а!aa|^T]0°@ÉËïN-tì&S@côôþî×#iü¶¤qîE©åÑò1è÷¤ÝþpÂJä_ðO#ô/=UPà¿"C¯MxèBïQpc!è1Ý;üEúêôºØ_ý®ÿüÖÿ·õ¿ÿÿúm¿ÿ×!ÿ   ÞAÇ_ùVGV
ÿú:(  "úßß~púõôÏs| Ì×ýtÚw¬5VÂ
<&öDlÙßÈhËØV76;ÿuk]ª~+÷û}®¿"Óëím»N×I¾úÃ

; Âký¦N
4¾L¡ÍÁ8aræNqÁo§ïü2&
"#ÿùLÉ`å¶i¤o.D Ïs e@ï¹dZ+FUÐiÃÓ^ù7#àAÔ2
4Óáêÿpô¿½;þ°õ ÿÞõøxMu÷Hv·ÿ½4ÿä^r#2¨¨Èÿï¹þ¡IÊxç¯ò,d#~¾ýû` dpè$!Þõïäè4X¿ø}]':xLÀ¿ÿc  wÿ¿tá&ï²»__5ÝþöGF"9A¯qû}{ÿâ"Ø?ã¿ýÈa"»ÿaò%·¯ÜyÓ¿ï¼z{ÿp{! ϯ·ßMïú}¼¤ÓÂ
ëøo_ëýûxD1¯ÿöÿëþ
ëÓÓÖõ"þîFCÿA¿ÿä(çù  ¿ÿÿäA¿¯üþIá¶ÎoÿßZ
»¿ÿúàáÿÿ¯ä¤Kÿýuvï_ÿÕeA¾jÿþû×íoÿÿÿïúínûªý®»ö¿Ø[Õ¯Ø[ÿ÷·ÿñRVÁ)ñ_ô·[ý¯õ±±úÿìðy9Ç*aײ8ÿëüqX)~+úÚÒÿûêµÿµ^ïþ
5»×¼áMS'`kÖÂaU°Ç@Â`DAÎ[ÂÝÿ#;B"!rf´Âp   Ða""1:!2(DËlÐW(
LÈÔY.ìì.!Ä¢5 ɸ¼_;"²))¨R @ï
Wº    ºðPAþ*aS Âiá=NÔ.º®UíBwªªÞ×PÚ§n¿"Ä*õKÕSïþdXíakò$Sÿ:¢:Ê|åæ¡tþÕmÓȼ)R#@¥ÂsBÂkL,Gï"GÃý~f4ØÓA
~z#¦ªñîC2\_!5¯ßÃ÷ ïÕ5´ÆTWs@à@ÁaÃZÿ_øÂ~ª÷$û0ë!`а1×õ¡è?¤ÐN©=S±"²ôïTõ^Ø ùÿHwMHHÔ)>¸Ç»®ºøY!þÒ­è&þBøAØ&
¨0¡_¥éô¤(îÞB=d8ôKµªvÿú¦ß]ß¿t4 ä[RA<   ¾¶7ÿPÿTÿ|A{×õMí4ï{´ö§{ð×ÿêCqòß®kÃJµö¾ïÅÿ¿lPZ¿®Ò·4¢\wWu)ÄïþúaÞ»wmÕp{@¿¡}ä[mì÷û~zë×ÁøUöÒMÕߪÿëo×¾¾Ý¿ÿ`­SýÿýíümÈqÌ9C_ÈAÉéVý_ô!3c¿ÞBYC9SÿÕ²ð]ïÂÃ~¿¾=~Õî­âéiù¥ÿÕû¿#ÿ8?óǯzçÍ¿ýíÛ_x#{øWaVÌ
nÓUm¸8k°Â] ÃW°ÂåÉXklW´=úÚ~Úµ
t­]ØkWmoÿt£Õx§¶®ÿ¿jßßkÁ~Ackߪö½úkk±QPþ?iÿ^½¯i×Ú®½¿ûMW´û[µ»{MS^}Ú÷馷iðáÚi­¦Úí~Û^ÖÓA§h0"GaSAíi Â
9øh0Úé¦A¦Mè¾A# Á,"!àÌ8B!hDG´ÓT->ÃA!´`MAa¡ÿÿÿÿÿÿþS¤c#²SVF³%Ȩ"L
xd ÊÈIg[ÉGÉB ÁL0ØOü',YT"dB2!¢(1¬Aè4î×þMÅ8"%D@l0AéÞºv=4ÿ

[Generated code truncated to 10k characters, "Export" or "Open With" to get all code.]

1条回答
迷人小祖宗
2楼-- · 2019-08-04 13:38

Parts without a name parameter are not being parsed by Tomcat (question author is using Spring Boot with embedded Tomcat). In fact, the whole body gets discarded if there is no name.

I see no easy or good solution. As a workaround you can override Tomcat's FileUploadBase class and implement a custom getFieldName method that will always return a non-null value. Since Tomcat is in your classpath, being embedded in Spring Boot, you will be able to override this class.

查看更多
登录 后发表回答