tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Drake" <...@pobox.com>
Subject Re: resp.sendRedirect("./Join2?Email_Address=" + EmailAddress);
Date Wed, 14 Nov 2001 19:49:50 GMT
Carl:

encodeURL() and encodeRedirectURL() do not do what you think they do.
These methods may add a 'jsessioniid=...' entry to url. They will not URL
encode
the url string itself.

However, I think that I was wrong about the '@' anyway. You could still have
a problem with
invalid characters in your URL. Everyone should be urlencoding everything
after the '?' in their url's.
There is some code on the jakarta site that will do this. I think it's in a
class called something
like HttpUtils.java. I think you can find it in taglibs or struts.

I don't know what would cause an illegal state exception.

Tom
----- Original Message -----
From: "Carl Boudreau" <carl.boudreau@notiva.com>
To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>; "'Tom Drake'"
<rtd@pobox.com>
Sent: Wednesday, November 14, 2001 9:54 AM
Subject: RE: resp.sendRedirect("./Join2?Email_Address=" + EmailAddress);


| Well Tom,
|
| I have changed the following code to read;
|                     if(TxtCheck1.equals(User_Name)) {
|                         // User join1 data has been added to Database
|                         String Redirect_String = "./ValidUser?firstname="
+
| User_Name;
|                         //resp.sendRedirect("./ValidUser?firstname=" +
| User_Name);
|                         //resp.encodeRedirectURL("./ValidUser?firstname="
+
| User_Name);
|                         out.println(Redirect_String + "<br>");
|                         //resp.sendRedirect(Redirect_String.trim());
|  Error >> >>
| resp.sendRedirect(resp.encodeRedirectURL(Redirect_String.trim()));
|                         //out.close();
|                         out.println("Found User_Name " + User_Name + " on
| Row " + result.getRow() + "<br>");
|
| //out.println(resp.encodeRedirectUrl("./ValidUser?firstname=" + User_Name)
+
| "<p>");
|                         out.flush();
|                         }
|                         else {
|                             out.println(User_Name + " User_Name Not Found
on
| Row " + result.getRow() + "<p>");
|
| //resp.sendRedirect("./htmlpage/joinerror.html");
|                             out.flush();
|                             //out.close();
|                             }
|
| And this is returning  "java.lang.IllegalStateException"  exception, and
| still crashing if the  "If"  is true.
|
| Any ideas?  Carl
|
|
| -----Original Message-----
| From: Tom Drake [mailto:rtd@pobox.com]
| Sent: Wednesday, November 14, 2001 9:57 AM
| To: Tomcat Users List; carl.boudreau@notiva.com
| Subject: Re: resp.sendRedirect("./Join2?Email_Address=" + EmailAddress);
|
|
| You're @ is likely the problem. You must url-encoude the redirect address.
|
| ----- Original Message -----
| From: "Carl Boudreau" <carl.boudreau@notiva.com>
| To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
| Sent: Wednesday, November 14, 2001 7:32 AM
| Subject: resp.sendRedirect("./Join2?Email_Address=" + EmailAddress);
|
|
| | Good Morning Fellow Coders,
| |
| | I have a very interesting question for all of you.  Below is a small
| | snippet of code which basically validates a database Insert operation.
| The
| | operation writes to the database then turns around and read the email
| | address and compares it to what was passed to the Servlets.  For example
| | within the 20 params sent, cboudrea@pressenter.com would be sent as an
| email
| | address.  It would then be written and then it would re-query the
database
| | and compare the results.  This snippet makes the comparison between what
| was
| | passed and what was read out of the database, in turn uses the Redirect
to
| | either move on to the next Servlets Join2 if successful, or display
| | joinerror.html if un-successful.  But an exception is caught and ends
the
| | Servlets.  During debug I have reduce the error to the redirect line
| | [resp.sendRedirect("./Join2?Email_Address=" + EmailAddress);].
| |
| | Now I have been monitoring the email forum and had seen there was a
| problem
| | with the redirect.  And in the mean time I had manually started these
| | Servlets by using IE and entering the
| | [./Join2?Email_Address=cboudrea@pressenter.com)]  and it works fine.  I
| | think, I found out, that if I manually do this first, then run it
normally
| | by hitting it from a index.html page it works.  But my results have been
| | very erratic and I don't trust myself.
| |
| | I have tried to use out.flush( ); alone and then followed up by a
| | out.close( ); by this doesn't seem to change anything.
| |
| | DOES ANYONE HAVE ANY SUGGESTIONS, OR A WORK AROUND?
| |
| | Source Code Snippet;
| |
| |                     if(TxtCheck1.equals(MemberMail))
| |                        {
| |                         // User join1 data has been added to Database
| |                        resp.sendRedirect("./Join2?Email_Address=" +
| | EmailAddress);
| |                         }
| |                         else {
| |
| | resp.sendRedirect("./htmlpage/joinerror.html");
| |                                }
| |
| |
| | System Config;
| |
| | Win2000pro.
| | Tomcat 4.0 standalone.
| | MySQL 7.0
| |
| |
| | --
| | To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
| | For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
| | Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
| |
| |
| |
|
|
| --
| To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
| For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
| Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
|
|
|


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message