2
I started a Rest application and have a java class createPost
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 by parameter this "value".
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 didn’t work.
Note: I am not currently able to pick up via @Pathparam since the url calls an external service.
Anyone who can help, thank you.
restored to me the following error: 204 - No Content. I believe I have solved in the sense of taking the parameter...
– Edmo
You debugged the java code to see if the method was executed and if the loopId parameter was filled in?
– Skywalker
yes! de qualquer forma consegui assim no JS
var data = '&idLoop=' + idLoop + '&title=' + title + '&folderID=' + folderID;
 return http.post(urlYapmo + '/post/' +
 hyatt.date.getParameterTimeStamp(), data);
– Edmo