Jason, Do you mean you want the servlet to run by itself? You could pass it a mock request and response. But then it would function as a regular class and not a servlet. What are you trying to accomplish?
>> Do you mean you want the servlet to run by itself? >> You could pass it a mock request and response.
Hi Jeanne, I'm actually cross-posting for a fellow developer from the Portland Java Users Group. Essentially, he is doing what you describe -- trying to treat a servlet as a class, but not as you would expect when using a mock req/res approach -- usally (my understanding) is that it is for testing.
He actually wants the servlet to do useful work (processing a some data or something via an Ant script -- it gets convoluted to my way of thinking.. ) anyway.. I was just wondering if there was any practical examples of this being done -- and hence my hammering a nail with a screwdriver analogy.
Servlets depend on the servlet container for a LOT of services, so faking the servlet container environment would be a waste of time. Instead, move all the functionality into a "helper" class that can run in both the servlet container and normal application environment. Incidently that is a great way to test and debug during servlet development. For example, the request getParameterMap() method returns all of the request parameter values in String keyed by parameter name. You can easily create an identical map as input to a method in a non-servlet environment. Bill
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com