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*