tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Heller" <th.hel...@mx4k.com>
Subject Re: Tomcat/Jasper: jsp page extends="myOwnJspBase"
Date Mon, 14 Oct 2002 14:33:20 GMT
hi again,

ok i looked into the sources of jasper and obviously it isnt possible what
i'm trying to do.

[snip]
    out.printin("public void ");
    out.print  (serviceMethodName);
    out.println("(HttpServletRequest request, HttpServletResponse
response)");
    out.println("        throws java.io.IOException, ServletException {");
[snip]

doesnt look very customizable. Anyway .. all i need to change is on line of
code, any jasper dev here that will hate me for doing it? :p

I know i might be destroying my option to move to another servlet container
but i why should the JspPage interface allow me to do that but the container
not?! Plz tell me if i'm violating the spec ... right now i feel its a good
idea what im going to do .. but however .. i'm maybe completly wrong.

bye,
thomas

----- Original Message -----
From: "Thomas Heller" <th.heller@mx4k.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Monday, October 14, 2002 3:53 PM
Subject: Tomcat/Jasper: jsp page extends="myOwnJspBase"


> hi all,
>
> i'm developing a little framework for some web applications i am going to
> do. I wanted to build my own JspBase Model by creating a abstract class
> (similar to HttpJspBase that comes with Jasper) implementing the
> javax.servlet.jsp.JspPage interface.
>
> all i wanted to do is to change the class from calling
> "_jspService(HttpServletRequest, HttpServletResponse)..." from the
> "service(ServletRequest, ServletResponse)" method to
> "_jspService(MyServletRequest, MyServletResponse)...".
>
> During the processing of the request i'll wrap a custom
> HttpServletRequestWrapper, ResponseWrapper over the current
request/response
> objects.
>
> currently i have a request, response object which are (if i do instanceof)
> instances of my wrapper objects in my jsp. Howoever i have to do
>
> MyServletRequest myrequest = (MyServletRequest)request;
> MyServletResponse myresponse = (MyServletResponse)response;
>
> in every Jsp to use any methods/object from my wrapped objects. im trying
to
> do that cause i don't want to use the "common" way [eg. put every object
> into request.setAttribute, instead i wanted to have
> request.getSomeInfoMyFrameworkHasForMe()]. All this works if i just cast
it
> in the jsp _but_ i wonder if there is a way to do it without casting and
> just through my JspBase class.
>
> if i try all this now i get
>
> HTTP Status 503 - [javax.servlet.ServletException:
> MyJspBase._jspService(LMyRequest;LMyResponse;)V]
>
> from tomcat because he translates the jsp to the "wrong"
> "_jspService(Http..., Http...)" and not "_jspService(My..., My...)"
>
> Am I violating any jsp/servlet specs with what im trying to do or am i
just
> on the wrong way or is it a limitation from tomcat/jasper im running into?
> Can i tell him somewhere that the variable request inside _jspService is
an
> instance of MyRequest not HttpServletRequest?
>
> I hope this was understandable (trying to explain an idea i have in mind
is
> pretty hard sometimes :) and someone read this far. I really would
> appreciate any comments/help on this. Maybe there is another way to do it
> and i'm just overlooking it.
>
> thanks in advance,
> thomas


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message