Hello
*>> if you insist on GET, you need to correctly encode the json into a query parameter.* I still would like to use GET instead of POST ( Since the args submitted is Processing ,Filtering the data on return , It has nothing to persist Could u suggest on correcting to encode the Json into the Query Parameter Json fetched from UI { "searcharg": "jakarta.ws.rs.ext.Provider", "folderfilepatharg": "F:/TOOLS/APACHEMAVEN/MAVEN-REPO", "searchextnarg" : "jar", "searchstartno": 120, "searchendno": 150 } on the Controller the method defined is as follows used to prefilter args to process @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/SearchBeanGet") public SearchZipJarBean getSearchBean(SearchZipJarBean srchBean) { loggerlog.info("Pre Process " + srchBean.toString()); .... loggerlog.info("Post Process " + srchBean.toString()); return srchZpjra .getSrchBean(); } with regards N.S.Karthik On Thu, Apr 10, 2025 at 1:56 PM Richard Zowalla <r...@apache.org> wrote: > GET with a (JSON) payload is against the RFC; a GET with a payload has no > defined semantics: > https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 > > That being said, „data“ is appended to the URL as query parameters, the > content type is ignored and the JSON strings will appear (encoded) in the > URL. > > I would suggest to switch to POST here … if you insist on GET, you need to > correctly encode the json into a query parameter. > > > Am 10.04.2025 um 07:25 schrieb KARTHIK SHIVAKUMAR <nskarthi...@gmail.com > >: > > > > > > > > Hello > > > > Spec : > > Container : Apache TomEE PLUS -10.0.1 > > Java : 22 > > Ide : Eclipse IDE > > O/s : Win-10 > > Browser : Firefox > > RESTClient : PostMan > > > > a) Process > > A simple Web GET request to REST Web Service used top parse > Folder and return with results. > > The request fails thru the BROWSER but passes thru RESTClient > > > > > > b) Problem > > Ajax Submission of a JSON.Stringified on GET type is returning "HTTP > 400 Bad Request" ( Image attached for reference ) > > As suggested Added thy Relaxation char to the Server.xml > > Tomee/conf/Server.xml : <Connector connectionTimeout="20000" > maxParameterCount="1000" port="8080" protocol="HTTP/1.1" > redirectPort="8443" > > server="Apache TomEE" xpoweredBy="false" > relaxedPathChars=" [ ] { } ^ | " relaxedQueryChars=" [ ] { } ^ | " /> > > Ajax Script : > > function > ajaxProcessContentjson(urljspVal,dataValue,httStatus){ > > var InstMesg = ''; > > $.ajax({ > > type : "GET", > > url : urljspVal, > > data : > JSON.stringify(dataValue), > > async : false, > > global : false, > > cache : false, > > dataType : "json", > > contentType : > "application/json", > > success : > function(responseObject, textStatus, jqXHR) { > > console.log("AJAX > PASS" + jqXHR.status); > > }, > > error : > function(responseObject, textStatus, jqXHR) { > > > console.log("AJAX FAIL : " + JSON.stringify(responseObject)); > > } > > }); > > return InstMesg; > > } > > > > Browser O/p > > "{ \"searcharg\" : \"jakarta.ws.rs.ext.Provider\" , > \"folderfilepatharg\": \"F:/MAVEN-REPO\" , \"searchextnarg\": \"jar\" , > \"searchstartno\": 120 , \"searchendno\" : 150}" searchobjtest.js:17:21 < > http://localhost:8080/SearchWebZipJar/searchobjtest/searchobjtest.js> > > { "searcharg" : "jakarta.ws.rs.ext.Provider" , "folderfilepatharg": > "F:/MAVEN-REPO" , "searchextnarg": "jar" , "searchstartno": 120 , > "searchendno" : 150} > > > > > XHRGEThttp://localhost:8080/SearchWebZipJar/restapiview/cmpressapi/SearchBeanGet?"{ > \"searcharg\" : \"jakarta.ws.rs.ext.Provider\" , \"folderfilepatharg\": > \"F:/MAVEN-REPO\" , \"searchextnarg\": \"jar\" , \"searchstartno\": 120 , > \"searchendno\" : 150}"&_=1744261534750 < > http://localhost:8080/SearchWebZipJar/restapiview/cmpressapi/SearchBeanGet?%22%7B%20%5C%22searcharg%5C%22%20:%20%5C%22jakarta.ws.rs.ext.Provider%5C%22%20,%20%5C%22folderfilepatharg%5C%22:%20%5C%22F:/MAVEN-REPO%5C%22%20,%20%5C%22searchextnarg%5C%22:%20%5C%22jar%5C%22%20,%20%5C%22searchstartno%5C%22:%20120%20,%20%5C%22searchendno%5C%22%20:%20150%7D%22&_=1744261534750 > > > > > > Invalid character found in the request target > [/SearchWebZipJar/restapiview/cmpressapi/SearchBeanGet?%22{%20\\%22searcharg\\%22%20:%20\\%22jakarta.ws.rs.ext.Provider\\%22%20,%20\\%22folderfilepatharg\\%22:%20\\%22F:/TOOLS/APACHEMAVEN/MAVEN-REPO\\%22%20,%20\\%22searchextnarg\\%22:%20\\%22jar\\%22%20,%20\\%22searchstartno\\%22:%20120%20,%20\\%22searchendno\\%22%20:%20150}%22&_=1744256939455 > ]. > > The valid characters are defined in RFC 7230 and RFC 3986</p> > > > > Question : Chars used in json are . , { , } , / Error caused by > "Invalid character found in the request" > > > > Please Suggest > > -- > > with regards > > N.S.KARTHIK > > > > -- *with regards* *N.S.KARTHIK*