I'm trying to use a zimlet that will send an http request to my server extension.
But, I don't know the endpoint !
Can someone explain me how I'm gonna call this endpoint ?
I know that it will be something like com_objectifpi_tasks/Tasks because of getName in TasksExtension and the getPath in the HttpHandler.
And can I have access to the server console to debug with System.out.println ?
Here is my code :
Code: Select all
public class TasksExtension implements ZimbraExtension {
public void init() throws ServiceException {
ExtensionDispatcherServlet.register(this, new HttpHandler());
}
public void destroy() {
ExtensionDispatcherServlet.unregister(this);
}
public String getName() {
return "com_objectifpi_tasks";
}
}
Code: Select all
public class HttpHandler extends ExtensionHttpHandler {
// the path under which MyHandler is registered
public String getPath() {
return super.getPath() + "/Tasks";
}
// override doGet or doPost or both as needed
// it's your responsibility to authenticate/authorize the requests
// sent to the handler
public void init(ZimbraExtension ext) throws ServiceException {
super.init(ext); // make sure you call superclass's init method.
// your initialization
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
resp.sendError(200);
resp.getWriter().write("it works :) ");
resp.getWriter().flush();
resp.getWriter().close();
}
}
Thx for your help.