You can accomplish something that resembles what you're trying to do in the following manner (from a java action, you'll probably want to set this up as your startup event)
// BEGIN USER CODE
Core.addRequestHandler("bugter/", new CustomWSRequestHandler());
Core.getLogger("Bugter").info("Registered requesthandler for 'bugter/'");
return true;
// END USER CODE
For this to work you will also need a class "CustomWSRequestHandler" which should contain something like this:
public class CustomWSRequestHandler extends RequestHandler {
@Override
public void processRequest(IMxRuntimeRequest request, IMxRuntimeResponse response, String path) throws Exception {
Core.getLogger("Bugter").info("Received request for path: " + path);
String content = IOUtils.toString(request.getInputStream());
Core.getLogger("Bugter").info("Received content: " + content);
String answer = "ok!";
OutputStream outputStream = response.getOutputStream();
IOUtils.write(answer, outputStream);
IOUtils.closeQuietly(outputStream);
}
}
You can test this by using something like curl or Firefox Poster
PS: this is exemplifying code and should never be used in production.