Reputation: 7076
I have one AngularJS project. it is using as front end, and I have a Java web application as a back end. From AngularJS project, I am redirecting to a URL which is outside of the applications(both Java and AngularJS). From that site, It is processing the request and returning to the AngularJS application, with some data as post.
My Java application runs on
http://localhost:8080/myjavaapp
AngularJS app runs on
http://localhost:8080/myangularapp
From AngularJS app, I am redirecting to a some URL
http://someotherwebsite.com/somepage?someparam=somevalue
After processing the request it sends back to AngularJS project.
http://localhost:8080/myangularapp/#/responsepage
But that is sending as a Post. And I want to get a request parameter in my AngularJS application. But when I return to the angularJS page, it shows error
Cannot POST /
If I used a JSP page, I could get the request parameter like
String responseString = (String) request.getParameter("response");
But its only HTML and JS controlers in AngularJS project. Is it possible to send as post? If so, How can I get the post parameter in the JS controller?
EDIT
From other site if it's redirecting like
http://localhost:8080/myangularapp/#/responsepage?response=somevalue
Then it's a GET request, and easily I can get the value of response using $routeParams
. it's like $http.get("someurl?response=value")
But in this usecase, It is sending as a POST request. Like $http.post("someurl")
. Parameters are POST and I am not able to get the value. How can I get it?
Thanks.
Upvotes: 1
Views: 164
Reputation: 3018
It sounds like you're trying to use an angular browser application like a server application. Can't you get the Java application to talk to the other application? Does the other application support JSONP? If so is there a payload you can send from the ng app and get the response back. AFAIK you can't post to a browser, so the architecture sounds wrong. There are too many question to answer this question but I couldn't put all this in a comment. Could you use this:
$http.jsonp('http://someotherwebsite.com/somepage?someparam=somevalue');
You are not post to the server you're using a GET (Querystring) and this will give you the other apps payload.
hope this helps
Upvotes: 2