I am working at developing a Java application that needs to verify through a callback URL (the user logs in, and then is redirected to a callback URL with the verification token included as a query argument). I have found some suggestions about setting up a tomcat server and developing a Java Servlet to intercept these variables, but I am looking for the absolute neatest solution (small amount of overhead from external programs) to implement. My question is: what process would be the simplest to implement to grab these values from, lets us say, localhost and use them in a Java application?
e.g. I want to get the variables x and y from the URL http://localhost:8080/my/path/?x=123.45&y=678.90 and use them in a Java application.
Some other information:
I have a home server that could be used for this process. (yes, it does have LAMP)
I am best with the Java programming language, but other options are not off the table, so long as I can somehow interface with Java in the end.
I would prefer to not store these variables externally (from the application(s)) if possible.
You could use a Java Servlet, but a more modern approach would be to use something like JAX-RS (Jersey) or Spring MVC.
@Path("my/path")
public class MyController {
@GET
public void myPath(@QueryParam float x, @QueryParam float y) {
//Your code here
}
}
or
@RestController("my/path")
public class MyController {
@RequestMapping(method = RequestMethod.GET)
public void myPath(@RequestParam(value = "x") float x, @RequestParam(value = "y") float y) {
//Your code here
}
}