From tomcat-user-return-48065-apmail-jakarta-tomcat-user-archive=jakarta.apache.org@jakarta.apache.org Thu Sep 20 15:55:46 2001 Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 75700 invoked by uid 500); 20 Sep 2001 15:55:46 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 75687 invoked from network); 20 Sep 2001 15:55:46 -0000 Message-ID: <3BAA10D6.C16DF109@ncep.noaa.gov> Date: Thu, 20 Sep 2001 11:52:54 -0400 From: Matt Larson Organization: DOC/NOAA/National Weather Service/NCEP/NCO/USSB X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: tomcat-user@jakarta.apache.org Subject: Tomcat's non-polymorphic request handler. References: <025301c141e6$d61c0a90$04fea8c0@eg> Content-Type: multipart/mixed; boundary="------------90E4D9029B62AC6778CA175B" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --------------90E4D9029B62AC6778CA175B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm having some difficulty with the polymorphic behavior of Tomcat's request handler. Consider the following: package RMS; import java.lang.Integer; public class TestPolyMorph { int i; String s; public void setNumberVar(String i) { this.i = Integer.parseInt(i); } public void setNumberVar(int i) { this.i = i; } public int getNumber() { return(i); } public void setStringVar(String s) { this.s = s; } public String getStringVar(String s) { return(s); } public TestPolyMorph() { } } ... and the .JSP file: <%@ page language="java" import="RMS.*" %> Testing... Testing... Testing. Now... the passing a non-integer value for the property: numberVar will yield a stack trace: http://SERVER:PORT/CONTEXT/jsp/TestPolyMorph.jsp?numberVar=foobar org.apache.jasper.JasperException: 3.2 at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:204) at org.apache.jasper.runtime.JspRuntimeLibrary.introspect(JspRuntimeLibrary.java:152) at jsp._0002fjsp_0002fTestPolyMorph_00 02ejspTestPolyMorph_jsp_2._jspService(_0002fjsp_0002fTestPolyMorph_0002ejspTestPolyMorph_jsp_2.java:91) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org. apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) Root cause: org.apache.jasper.JasperException: 3.2 at org.apache.jasper.runtime.JspRuntimeLibrary.convert(JspRuntimeLibrary.java:138) at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:198) at org.apache.jasper.runtime.JspRuntimeLibrary.introspect(JspRuntimeLibrary.java:152) at jsp._0002fjsp_0002fTestPolyMorph_00 02ejspTestPolyMorph_jsp_2._jspService(_0002fjsp_0002fTestPolyMorph_0002ejspTestPolyMorph_jsp_2.java:91) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org. apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) Even though there is indeed a method signature: setNumberVar(String i); .... Tomcat prefers to use (through introspection): setNumberVar(int i); The beans I use to handle property settings must continue to use polymorphism. Any ideas? Thanks, matt --------------90E4D9029B62AC6778CA175B--