I started a Rest application and I have a createPost java class
POST
@Path("/post/")
@Produces(MediaType.APPLICATION_JSON)
public static String createPost(@FormParam("loopID") String loopID) throws IOException {
ConnectDAO dao = ConnectDAO();
Post post = new Post();
post.setLoopId(loopID);
}
Where it will receive this value by parameter.
In javascript I have to create a service since I use angular called createPost, and it will do the "POST".
createPost: function(loopID) {
if (!loopID) {
hyatt.ui.view.alert('There is no file to upload. Please choose a file.');
} else {
return http({
method: 'POST',
url: url + '/post/',
headers: {
'Content-Type': undefined
},
transformRequest: formData
});
}
// This forces the break of execution.
throw new Error('The UploadService service needs a file and this file cannot be a video');
},
Above I'm getting by parameter the value I want to pass to JAVA. How can I be doing this? I tried with @FormParam but it did not work out.
Note: I can not currently get via @PathParam since the url calls an external service.
Who can help thank you.