The servletengine can't call doPost directly because it's a protected
method of HttpServlet. The Servlet Engine should call the service() method
of the servlet. The HttpServlet's implementation of service() will look at
the method to decide if it should call doGet() or doPost().
Notice: the cast to HttpServlet should not be necessary. You should only
need to cast the object to the javax.servlet.Servlet interface. It is not
necessary for the servlet engine to distinguish between HTTP-based Servlets
and non-HTTP based servlets. A servlet writer could write a class that
implements Servlet and you can still invoke it by passing in your
HttpServlet[Request/Response] objects.
-Spike
-----
Spike Washburn
IBM WebSphere Application Server
Internet E-mail: [EMAIL PROTECTED]
Omar Eljumaily <[EMAIL PROTECTED]> on 04/29/99 03:30:40 PM
Please respond to "A mailing list for discussion about Sun Microsystem's
Java Servlet API Technology."
<[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Donald Washburn/Raleigh/IBM)
Subject: Simple servlet engine, how?
Hi,
Sorry if this question has been asked a bunch of times. I tried to
search the archives and couldn't find any thing. I'm trying to
implement a simple servlet engine mainly so major parts of my
application remain portable to different web serving environments. I
thought the way I would, for instance, forward a post request would be
the following:
HttpServlet servlet = (HttpServlet)
server.classLoader.loadClass("MyPackage.Servlet1").newInstance();
MyServletRequest request = new MyServletRequest();
MyServletResponse response = new MyServletResponse();
servlet.doPost(request, response);
However, the last line of course will not compile because doPost is
protected. What is the standard way of doing this. I noticed the
service method, but service is also protected except for "client"
requests. Am I to consider myself a client in this instance? I can
probably put something together with "duct tape", but I'd like to follow
some kind of convention.
Thanks,
Omar
--
Omar Eljumaily
Omnicode
707 573-1814
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html