You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Artur Matos <am...@jardimzen.f2s.com> on 2001/04/19 18:14:10 UTC
Mapping using servlets? RequestInterceptor ?
Hi,
I'm developing a web application where I need to map URIs like:
/enterprise/resource (a virtual path)
to
/resource (a real,existent path)
where enterprise is a any valid enterprise present in a database. In addition to
mapping to the correct page, it needs also to register the enterprise used to
session variables (so that I could use the current enterprise object from my
jsp page).
I've implemented this mapping using a servlet (mapping to /portal/*) that parses
the request (i.e. /portal/enterprise/resource ) and redirects to the correct
resource. Unfortunately this doesn't seems to work correctly with POST forms or
multi-part form-data: when the form is submited via POST, tomcat never finds the
action page (i.e enterprise/action.jsp); Acessing the same page directly from
the browser, or using GET, works ok. Is this the expected behavior or a tomcat
bug?
Because of this, I'm thinking of using RequestInterceptors to implement the
mapping behavior instead. Are there any examples of redirection and setting
session variables using RequestInterceptors? I was unable to find any
documentation on this.
Thanks for all,
Artur Matos (amatos@jardimzen.f2s.com)
-------------------------------------------------
Everyone should have http://www.freedom2surf.net/
Re: Mapping using servlets? RequestInterceptor ?
Posted by Ivan <iv...@abac.com>.
What are you using to redirect the page?
My understanding is if you use request dispatchers to redirect a POST
request, the request is sent to your JSP page as a POST and not as a GET.
The JSP page must have to be accessed via a GET. If you were to submit your
form as a GET request and then redirect it to the JSP it should work.
Are you using request dispatchers?
Ivan
----- Original Message -----
From: "Artur Matos" <am...@jardimzen.f2s.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, April 19, 2001 9:14 AM
Subject: Mapping using servlets? RequestInterceptor ?
> Hi,
>
> I'm developing a web application where I need to map URIs like:
>
> /enterprise/resource (a virtual path)
>
> to
>
> /resource (a real,existent path)
>
> where enterprise is a any valid enterprise present in a database. In
addition to
> mapping to the correct page, it needs also to register the enterprise used
to
> session variables (so that I could use the current enterprise object from
my
> jsp page).
>
> I've implemented this mapping using a servlet (mapping to /portal/*) that
parses
> the request (i.e. /portal/enterprise/resource ) and redirects to the
correct
> resource. Unfortunately this doesn't seems to work correctly with POST
forms or
> multi-part form-data: when the form is submited via POST, tomcat never
finds the
> action page (i.e enterprise/action.jsp); Acessing the same page directly
from
> the browser, or using GET, works ok. Is this the expected behavior or a
tomcat
> bug?
>
> Because of this, I'm thinking of using RequestInterceptors to implement
the
> mapping behavior instead. Are there any examples of redirection and
setting
> session variables using RequestInterceptors? I was unable to find any
> documentation on this.
>
> Thanks for all,
>
> Artur Matos (amatos@jardimzen.f2s.com)
>
> -------------------------------------------------
> Everyone should have http://www.freedom2surf.net/
Re: Mapping using servlets? RequestInterceptor ?
Posted by Dave Weis <dj...@businessolver.com>.
There isn't any documentation on writing these, I looked also. I managed
to get one working and put parts of it up for you at
http://www.sjdjweis.com/java/interceptor/
It probably won't compile, I removed some of the sensitive parts. There
are some bits of info on how to install it there also.
Good luck
dave
Artur Matos wrote:
>
> Hi,
>
> I'm developing a web application where I need to map URIs like:
>
> /enterprise/resource (a virtual path)
>
> to
>
> /resource (a real,existent path)
>
> where enterprise is a any valid enterprise present in a database. In addition to
> mapping to the correct page, it needs also to register the enterprise used to
> session variables (so that I could use the current enterprise object from my
> jsp page).
>
> I've implemented this mapping using a servlet (mapping to /portal/*) that parses
> the request (i.e. /portal/enterprise/resource ) and redirects to the correct
> resource. Unfortunately this doesn't seems to work correctly with POST forms or
> multi-part form-data: when the form is submited via POST, tomcat never finds the
> action page (i.e enterprise/action.jsp); Acessing the same page directly from
> the browser, or using GET, works ok. Is this the expected behavior or a tomcat
> bug?
>
> Because of this, I'm thinking of using RequestInterceptors to implement the
> mapping behavior instead. Are there any examples of redirection and setting
> session variables using RequestInterceptors? I was unable to find any
> documentation on this.
>
> Thanks for all,
>
> Artur Matos (amatos@jardimzen.f2s.com)
>
> -------------------------------------------------
> Everyone should have http://www.freedom2surf.net/
--
Dave Weis
businessolver, Inc.
djweis@businessolver.com
http://www.businessolver.com/