I need to create a quartz job in my grails application which should call a servlet of another application. And in the servlet doGet() method i need to receive the message that is passed and do the process and once it is over need to send a response back to the service. I am new to this can anyone help me out. will create a job in the grails application and call a service method from this method how do I call the servlet doGet() of another application.
This is my quartz job
class DBCleanUpJob {
def concurrent = false
def miscBillService
static triggers = {
cron name : 'myTrigger', cronExpression : "0 0 2 * 1 ?"
}
def execute() {
miscBillService.miscBillCall()
}
}
And this is my service
@Transactional
class MiscBillService {
def miscBillCall() {
String line;
try
{
URL url = new URL("http://127.0.0.1/MServlet?value=run start");
BufferedReader ins = new BufferedReader(new InputStreamReader(url.openStream()));
line = ins.readLine();
System.out.println(line);
ins.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Does the above code call the servlet doGet()
method?