Re: spring boot rest error
Marc Mamane <[email protected]> Wed, 29 Nov 2017 11:33:45 -0500
| Newsgroups | gmane.org.user-groups.ajug.members |
|---|---|
| Message-ID | <CAHw6ai2K-agMeFC08Ge4XqH-e3bV2PdqP2cizU=7e6zF4A8xeg@mail.gmail.com> |
--===============1444561818332677839== Content-Type: multipart/alternative; boundary="94eb2c06652e0cbcc2055f21b379" --94eb2c06652e0cbcc2055f21b379 Content-Type: text/plain; charset="UTF-8" You'll need to apply regex to the request mapping. See this stack overflow thread for one solution. https://www.google.com/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/16332092/spring-mvc-pathvariable-with-dot-is-getting-truncated&ved=0ahUKEwi88IrWmuTXAhUiSt8KHSP2BmQQFggoMAA&usg=AOvVaw1LKqwwHOyJyiIIVvL1UTkO Hope that helps! On Nov 29, 2017 11:29 AM, "Mike Barnes" <mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]> wrote: > Can someone help me understand why I am unable to find a record when the > string has periods in the string (.) > > > > Example: > > > > http://localhost:8080/v1/security/account/name/My.Company > > > > The Spring Boot rest api appears to be truncating the value when a period appears. > > > > In the rest log I see name=My > > Instead of name=My.Company > > > > This is how I have defined the function: > > > > @GetMapping(value = "/name/{name}") > > public ResponseEntity<?> getAccountByName(@PathVariable("name") String name) { > > > > Any help would be appreciated. > > > > Thanks > > Mike Barnes > > > > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows 10 > > > > _______________________________________________ > ajug-members mailing list > [email protected] > Manage your subscription and unsubscribe http://lists.ajug.org/mailman/ > listinfo/ajug-members > --94eb2c06652e0cbcc2055f21b379 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div dir=3D"auto">You'll need to apply regex to the r= equest mapping.=C2=A0 See this stack overflow thread for one solution.</div= ><div dir=3D"auto"><br></div><div dir=3D"auto"><a href=3D"https://www.googl= e.com/url?sa=3Dt&source=3Dweb&rct=3Dj&url=3Dhttps://stackoverfl= ow.com/questions/16332092/spring-mvc-pathvariable-with-dot-is-getting-trunc= ated&ved=3D0ahUKEwi88IrWmuTXAhUiSt8KHSP2BmQQFggoMAA&usg=3DAOvVaw1LK= qwwHOyJyiIIVvL1UTkO">https://www.google.com/url?sa=3Dt&source=3Dweb&= ;rct=3Dj&url=3Dhttps://stackoverflow.com/questions/16332092/spring-mvc-= pathvariable-with-dot-is-getting-truncated&ved=3D0ahUKEwi88IrWmuTXAhUiS= t8KHSP2BmQQFggoMAA&usg=3DAOvVaw1LKqwwHOyJyiIIVvL1UTkO</a><br></div><div= dir=3D"auto"><br></div><div dir=3D"auto">Hope that helps!</div></div><div = class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Nov 29, 2017 11:29 = AM, "Mike Barnes" <<a href=3D"mailto:mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]"= >mike.barnes-f9aWwpgOZj5Wk0Htik3J/[email protected]</a>> wrote:<br type=3D"attribution"><blockquot= e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol= id;padding-left:1ex"><div lang=3D"EN-US" link=3D"blue" vlink=3D"#954F72"><d= iv class=3D"m_-5964630333516401507WordSection1"><p class=3D"MsoNormal">Can = someone help me understand why I am unable to find a record when the string= has periods in the string (.)</p><p class=3D"MsoNormal"><u></u>=C2=A0<u></= u></p><p class=3D"MsoNormal">Example:</p><p class=3D"MsoNormal"><u></u>=C2= =A0<u></u></p><div><pre><a href=3D"http://localhost:8080/v1/security/accoun= t/name/My.Company" target=3D"_blank">http://localhost:8080/v1/<wbr>security= /account/name/My.<wbr>Company</a></pre><pre><u></u>=C2=A0<u></u></pre><pre>= The Spring Boot rest api appears to be truncating the value when a period a= ppears.</pre><pre><u></u>=C2=A0<u></u></pre><pre>In the rest log I see name= =3DMy</pre><pre>Instead of name=3DMy.Company</pre><pre><u></u>=C2=A0<u></u>= </pre><pre>This is how I have defined the function:</pre><pre><u></u>=C2=A0= <u></u></pre><pre>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 @GetMapping(va= lue =3D "/name/{name}")</pre><pre>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 public ResponseEntity<?> getAccountByName(@<wbr>PathVari= able("name") String name) {</pre><pre><u></u>=C2=A0<u></u></pre><= pre>Any help would be appreciated.</pre><pre><u></u>=C2=A0<u></u></pre><pre= >Thanks</pre><pre>Mike Barnes</pre></div><p class=3D"MsoNormal"><u></u>=C2= =A0<u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"Ms= oNormal">Sent from <a href=3D"https://go.microsoft.com/fwlink/?LinkId=3D550= 986" target=3D"_blank">Mail</a> for Windows 10</p><p class=3D"MsoNormal"><u= ></u>=C2=A0<u></u></p></div></div><br>______________________________<wbr>__= _______________<br> ajug-members mailing list<br> <a href=3D"mailto:[email protected]">[email protected]<= /a><br> Manage your subscription and unsubscribe <a href=3D"http://lists.ajug.org/m= ailman/listinfo/ajug-members" rel=3D"noreferrer" target=3D"_blank">http://l= ists.ajug.org/mailman/<wbr>listinfo/ajug-members</a><br></blockquote></div>= </div> --94eb2c06652e0cbcc2055f21b379-- --===============1444561818332677839== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYWp1Zy1tZW1i ZXJzIG1haWxpbmcgbGlzdAphanVnLW1lbWJlcnNAbGlzdHMuYWp1Zy5vcmcKTWFuYWdlIHlvdXIg c3Vic2NyaXB0aW9uIGFuZCB1bnN1YnNjcmliZSBodHRwOi8vbGlzdHMuYWp1Zy5vcmcvbWFpbG1h bi9saXN0aW5mby9hanVnLW1lbWJlcnM= --===============1444561818332677839==--