You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pierre Métras <ge...@sympatico.ca> on 2000/11/16 20:18:40 UTC

encodeURL tag

Hi all,

Here is a very simple tag. It's role is to add session encoding to its
parameter if the client browser doesn't support cookies.

In the majority of cases, you don't need it because <link> and <forward> do
it already. I had the need for it when my application opens a new window
from JavaScript to present messages to the user:

<script language="JavaScript" type="text/javascript">
    window.open('<s:encodeURL href="error.do?action=1243" />');
</script>

Add the following declaration to your struts.tld file:

    <tag>
        <name>encodeURL</name>
        <tagclass>org.apache.struts.taglib.EncodeURLTag</tagclass>
        <bodycontent>EMPTY</bodycontent>
        <info>Encodes the URL given as parameter, adding session information
if necessary</info>
        <attribute>
            <name>href</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>

Hope this helps.

Pierre Métras


Re: encodeURL tag

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Ray Power wrote:

> >         public java.lang.String encodeURL(java.lang.String url)
> >         // Encodes the specified URL by including the session ID
> > in it, or,
> > if encoding is not needed, returns the URL unchanged.
> >
>
> I'm playing with struts 0.5 on tomcat 3.1 with IE5 & cookies enabled.
> How do I get tomcat to return URLs unchanged?
>

Make a second request :-).

When a session is first created, Tomcat has no way to know if cookies are
enabled or not, so it sends the session ID both ways (as cookies and as
rewritten URLs) in that first response.  If the session ID comes back in as a
cookie, Tomcat says "aha, this user supports cookies so I will stop rewriting
the URL."  Otherwise, it continues using rewriting.

Note:  Tomcat 3.1 has a very large number of bugs (relative to the most recent
beta of Tomcat 3.2).  I would suggest you upgrade.

>
> Thanks,
> Ray

Craig



Re: Open source connection pool recommendations?

Posted by Joe Peer <jo...@wap-force.net>.
i've been using a connection pool which was published in a java book by
Wrox,
you can check it out at

http://www.wrox.com/Books/Book_down.asp?isbn=1861004656&sub_section=1&subjec
t=Java&subject_id=13

(download the whole code, chapter 9 should contain the connection pool)
i cant say if it is high quality or not, but for my purposes (low traffic
site without ejb) it worked without any problem

joe

----- Original Message -----
From: Ray Power <ra...@spc75.demon.co.uk>
To: <st...@jakarta.apache.org>
Sent: Saturday, November 18, 2000 12:03 PM
Subject: Open source connection pool recommendations?


> Hi,
>
> I'm playing with struts 0.5 on tomcat 3.1.
> I was wondering what JDBC connection pool people are using with struts.
>
> Thanks,
> Ray


RE: Open source connection pool recommendations?

Posted by Andy Boyko <ab...@fabgear.com>.
> I'm playing with struts 0.5 on tomcat 3.1.
> I was wondering what JDBC connection pool people are using with struts.

We're using the minerva pool (written for the jboss EJB container, 
but we're using it by itself, without jboss).  It has some very 
nice features, like JDBC 2.0 Datasource support and client-side 
PreparedStatement pooling.  It's at www.jboss.org.

Andy Boyko   aboyko@fabgear.com

Open source connection pool recommendations?

Posted by Ray Power <ra...@spc75.demon.co.uk>.
Hi,

I'm playing with struts 0.5 on tomcat 3.1.
I was wondering what JDBC connection pool people are using with struts.

Thanks,
Ray 

RE: encodeURL tag

Posted by Ray Power <ra...@spc75.demon.co.uk>.
>         public java.lang.String encodeURL(java.lang.String url)
>         // Encodes the specified URL by including the session ID 
> in it, or,
> if encoding is not needed, returns the URL unchanged.
> 

I'm playing with struts 0.5 on tomcat 3.1 with IE5 & cookies enabled.
How do I get tomcat to return URLs unchanged?


Thanks,
Ray

Re: encodeURL tag

Posted by Pierre Métras <ge...@sympatico.ca>.
Hi Martin,

You should be right in the terminology. I derived the name of the tag from
the javax.servlet.http.HttpServletResponse method:
        public java.lang.String encodeURL(java.lang.String url)
        // Encodes the specified URL by including the session ID in it, or,
if encoding is not needed, returns the URL unchanged.

But I don't mind to change it to <rewriteURL>...

Pierre Métras

----- Original Message -----
From: "Martin Cooper" <ma...@tumbleweed.com>
To: <st...@jakarta.apache.org>
Sent: Friday, November 17, 2000 12:23 AM
Subject: Re: encodeURL tag


> Pierre,
>
> Isn't this URL rewriting? Shouldn't the tag be called rewriteURL instead
of
> encodeURL?
>
> Unless I'm mistaken, URL encoding is when you encode special characters in
a
> URL, like turning spaces into %20, etc., and URL rewriting is when you
> modify the URL to embed the session ID.
>
> --
> Martin Cooper
> Tumbleweed Communications
>
> ----- Original Message -----
> From: "Pierre Métras" <ge...@sympatico.ca>
> To: <st...@jakarta.apache.org>
> Sent: Thursday, November 16, 2000 11:18 AM
> Subject: encodeURL tag
>
>
> > Hi all,
> >
> > Here is a very simple tag. It's role is to add session encoding to its
> > parameter if the client browser doesn't support cookies.
> >
> > In the majority of cases, you don't need it because <link> and <forward>
> do
> > it already. I had the need for it when my application opens a new window
> > from JavaScript to present messages to the user:
> >
> > <script language="JavaScript" type="text/javascript">
> >     window.open('<s:encodeURL href="error.do?action=1243" />');
> > </script>
> >
> > Add the following declaration to your struts.tld file:
> >
> >     <tag>
> >         <name>encodeURL</name>
> >         <tagclass>org.apache.struts.taglib.EncodeURLTag</tagclass>
> >         <bodycontent>EMPTY</bodycontent>
> >         <info>Encodes the URL given as parameter, adding session
> information
> > if necessary</info>
> >         <attribute>
> >             <name>href</name>
> >             <required>true</required>
> >             <rtexprvalue>true</rtexprvalue>
> >         </attribute>
> >     </tag>
> >
> > Hope this helps.
> >
> > Pierre Métras
> >
> >
> >
>
>
>


Re: encodeURL tag

Posted by Martin Cooper <ma...@tumbleweed.com>.
Pierre,

Isn't this URL rewriting? Shouldn't the tag be called rewriteURL instead of
encodeURL?

Unless I'm mistaken, URL encoding is when you encode special characters in a
URL, like turning spaces into %20, etc., and URL rewriting is when you
modify the URL to embed the session ID.

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "Pierre Métras" <ge...@sympatico.ca>
To: <st...@jakarta.apache.org>
Sent: Thursday, November 16, 2000 11:18 AM
Subject: encodeURL tag


> Hi all,
>
> Here is a very simple tag. It's role is to add session encoding to its
> parameter if the client browser doesn't support cookies.
>
> In the majority of cases, you don't need it because <link> and <forward>
do
> it already. I had the need for it when my application opens a new window
> from JavaScript to present messages to the user:
>
> <script language="JavaScript" type="text/javascript">
>     window.open('<s:encodeURL href="error.do?action=1243" />');
> </script>
>
> Add the following declaration to your struts.tld file:
>
>     <tag>
>         <name>encodeURL</name>
>         <tagclass>org.apache.struts.taglib.EncodeURLTag</tagclass>
>         <bodycontent>EMPTY</bodycontent>
>         <info>Encodes the URL given as parameter, adding session
information
> if necessary</info>
>         <attribute>
>             <name>href</name>
>             <required>true</required>
>             <rtexprvalue>true</rtexprvalue>
>         </attribute>
>     </tag>
>
> Hope this helps.
>
> Pierre Métras
>
>
>