I am new (again, have not touched it in a while) to Java.
I have a simple (much more complex one is planned) HttpServlet class that I am tryng to call from a webpage either from a regular Notes form or csjs on an xPage.
package com.pnc.cld;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloWorld extends HttpServlet
{
private static final long serialVersionUID = -2950148158748149L;
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("doGet: Hello World!");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("doPost: Hello World!");
}
}
I found this article here.
Which is orginally in Chinese so it makes it a bit hard to follow but from what I have been able to glean from it, you need a add a IServletFactory class which maps the servlet to your a url so it can be called in your browser.
But I am getting errors. This article fixed some of them
But I still still get a number of errors. One of them:
The type ServletFactory must implement the inherited abstract method IServletFactory.getServletMatch(String, String) ServletFactory.java
Also the article seems to say that you need to add com.ibm.xsp.adapter.servletFactory to the services directory but I can't find the file anywhere on my PC.
Are there any better articles or hopefully working example for calling an httpservlet out there?
java.poledit is required to give your NSF Java code some broader security privileges, edit yournotes.ini(or via Internet site) to allow PUT and DELETE methods, along with adding the lwpd jar to your DDE's build path as Sven Hasselbach points out (your link). My blog series on the subject: edm00se.io/servlet-series - Eric McCormick