1

i am sending an ARABIC message as a parameter in the url fom angularjs as

 ` $http({    

                    method : "POST",
                    url : "./SendSMSBulk/"+message+","+lang, 
                    data :$scope.selected
                    }).success(function(data){
                        alert("Sms Sent");
                        $state.reload();

                    });`

and the URL is mapped to the Spring REST as

@RequestMapping(value="/SendSMSBulk/{message},{lang}")
public ApiResponse sendSmsBulk(@RequestBody List<CustomerData> data,@PathVariable("message") String message,@PathVariable("lang") String lang ) throws IOException{
}

when i am passing an english message the API is working fine but when i am passing an Arabic message i am getting 404 error http://localhost:8080/AIS/SendSMSBulk/%D8%B9%D9%85%D9%8A%D9%84%D9%86%D8%A7%20%D8%A7%D9%84%D8%B9%D8%B2%D9%8A%D8%B2%20%D9%8A%D8%B1%D8%AC%D9%89%20%D8%A7%D9%84%D8%AA%D9%83%D8%B1%D9%85%20%D8%A8%D9%85%D8%B1%D8%A7%D8%AC%D8%B9%D8%A9%20%D9%82%D8%B3%D9%85%20%D8%A7%D9%84%D8%B9%D9%82%D9%88%D8%AF%20%D9%88%D8%B0%D9%84%D9%83%20%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%B9%20%D9%88%20%D8%A7%D8%B3%D8%AA%D9%84%D8%A7%D9%85%20%D8%B9%D9%82%D8%AF%20%D8%A7%D9%84%D8%AA%D9%88%D8%B1%D9%8A%D8%AF%20%D8%A7%D9%84%D8%AE%D8%A7%D8%B5%20%D8%A8%D9%83%D9%85%20.%20%D8%A3%D9%88%D9%82%D8%A7%D8%AA%20%D8%A7%D9%84%D8%B9%D9%85%D9%84%20%D9%85%D9%86%20%D8%A7%D9%84%D8%B3%D8%A8%D8%AA%20%D8%A7%D9%84%D9%8A%20%D8%A7%D9%84%D8%AE%D9%85%D9%8A%D8%B3%20%D9%85%D9%86%208%20%D8%B5%D8%A8%D8%A7%D8%AD%D8%A7%20%D8%AD%D8%AA%D9%89%209%20%D9%85%D8%B3%D8%A7%D8%A1%D8%A7%20%D9%85%D8%B1%D9%83%D8%B2%20%D8%AE%D8%AF%D9%85%D8%A9%20%D8%A7%D9%84%D8%B9%D9%85%D9%84%D8%A7%D8%A1%201800999%20%D8%B4%D8%B1%D9%83%D8%A9%20%D8%A7%D9%84%D8%B5%D8%B1%D8%A7%D9%81%20%D9%84%D9%84%D8%A3%D8%A8%D9%88%D8%A7%D8%A8%20%D8%A7%D9%84%D8%AE%D8%B4%D8%A8%D9%8A%D8%A9,arabic Request Method:POST Status Code:404 Not Found

how can i send the ARABIC in the url parameter ???

5
  • Please verify $scope.selected matches the fields of Class CustomerData fields
    – J-Mean
    Nov 23, 2016 at 10:39
  • @J-Mean verified it matches all the fields , when i am sending the message in ENGLISH its working perfectly fine but when i send the messsage in ARABIC its getting 404. Nov 23, 2016 at 10:55
  • It makes absolutely no sense to pass the message via the URL. It's also semantically wrong. You post data anyway, so add the message to the body. As for the error: The message contains a dot, so it doesn't match the request mapping. Nov 23, 2016 at 12:54
  • @zeroflagL it makes sense for me because the data i am sending is customer information and its a list of customers i cannot add a message to customer object and add it for every customer that will be a wrong approach i feel Dec 5, 2016 at 10:54
  • "i cannot add a message to customer object" Why should you? Dec 5, 2016 at 10:58

1 Answer 1

0

Maybe not a solution , but I would try to modify your solution.

  1. Remove the message from the url, you are posting, send message as parameter instead. Like { messageText: message, lang: lang }
  2. Change @RequestMapping(value="/SendSMSBulk")
  3. Read data from parameterd in Spring

public ApiResponse sendSmsBulk(@RequestBody List data,@RequestParam("message") String message,@RequestParam("lang") String lang )

Then see if you have encoding errors. Sending non ascii characters as url parameters can get you in all sorts or problems, at least that's my experience.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.