RE: session from URL/Cookie

2002-04-03 Thread Huy K Dung

How do i encode URLs in Velocity Macro? I am using Tomcat and Turbine.

-Original Message-
From: Jeff Larsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:36 AM
To: Tomcat Users List
Subject: Re: session from URL/Cookie


I'm not entirely sure I understand your problem, but I'll
take a stab at it anyway

Typically, you don't need to worry about where the sessionid comes
from. Anywhere you send a redirect or put a link in a JSP or servlet
generated html, you should ALWAYS use HttpServletResponse.encodeURL() or
HttpServletResponse.encodeRedirectURL(). Once tomcat knows whether or
not the browser is using cookies, it will encode the URL as needed. If
cookies are enabled, the URL will be unchanged. If no cookies, the session
ID will be inserted. Tomcat does this for you. You don't need to worry about
it, just encode ALL URLs.

Jeff

- Original Message -
From: "Michael" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 28, 2002 4:16 AM
Subject: session from URL/Cookie


>
> Hi!
>
> (tomcat 3.3.1)
>
> *** please help! ***
>
> my question (short version;-):
> client supports cookies and makes a request with session-encoded URL:
> request: http://myserver/testservlet;jsessionid=12121212
> isRequestedSessionIdFromURL() is false
> isRequestedSessionIdFromCookie() is true
> and
> getRequestURI() won't show the encoded sessionid!!!
>
> so how to find out, that the URL is encoded???
>
>
> question (long version):
>
> If a client request comes with no session (or an invalid session) I do:
>
> session = request.getSession(true); //create session
> result.sendRedirect(result.encodeRedirectURL(request.getRequestURI()));
//redirect to
the same page, so the next request comes with valid session
>
> - tomcat can't know, whether my browser supports cookies the time it
creates the session
or not
> - so it encodes the sessionid into the URL
> - after the redirect, I can check, if the client's browser supports
cookies
(isRequestedSessionIdFromURL() /Cookie()) - this works in any case, because
the URL is
encoded!!!
> my problem:
> - now I would like to make another redirect, if the browser supports
cookies (so the
sessionid won't be visible in the URL again) or leave the session id in the
encoded URL
(if it doesn't support cookies)
>
> BUT how to check, if the sessionid is encoded into the URL, when the
browser supports
cookies???
> isRequestedSessionIdFromURL() is false
> isRequestedSessionIdFromCookie() is true
> and
> getRequestURI() won't show the encoded sessionid!!!
>
> an example:
> client request: http://myserver/testservlet (no session)
> -> create new session - redirect to same page
> client request: http://myserver/testservlet;jsessionid=12121212
> -> now tomcat sees if the browser supports cookies or not - but how do I
recognize, that
the URL is encoded?
> another redirect to the same page would do
> request: http://myserver/testservlet;jsessionid=12121212
> request: http://myserver/testservlet
>
>
> thanks
> michi






> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 



RE: session object [urgent!]

2002-04-03 Thread Huy K Dung

Hi Nancy,

I don't think it's Tomcat's problem. It's a problem with the browsers
themselves.

This problem happens to me even with Tomcat 3.2.3. At first I thought it's a
problem with Tomcat 3.3.1 but I ran the same app with Tomcat 3.2.3 and the
problem still persists.

A workaround or some tricks will solve this problem I hope. For those who
have come up with a fix for this problem, I appreciate very much if you read
this message. Thanks.

-Original Message-
From: Nancy Crisostomo Martinez [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 02, 2002 02:56 PM
To: Tomcat Users List
Subject: Re: session object [urgent!]


I have found a kind of bug or I don't know what
I tried to access to the session's attributes, with another servlet-engine
and it works perferct!
So... I think Tomcat 3.3 (I'm using) has a bug or maybe it is a cause of a
bad configuration because the
track is lost

What do you think about it?
Does any of you have the same problem with sessions?



Nancy Crisostomo Martinez wrote:

> Hi everybody!
>
> I need your help..
> I'm trying to track some attributes I added to the session object, but I
> can't...
>
> I have an html file (main.htm) which opens a new window browser
> (validate.jsp) when you press a button to access to one service...
> Then when the user is validated in the validate.jsp file, I added two
> attributes to the session object like this:
>
>  ...
>  <%
>  if (validUser(id_Usuario)){
> session.setAttribute("numero",id_Usuario);
> session.setAttribute("edad",num);
>  ...
>
> and finally the window is closed and another new window is opened (
> portal.jsp ).
>
>  %>
>  
>
>
window.open("portal.jsp","","top=0,left=0,width=791,height=520,scrollbars=ye
s,resizable=yes,status=yes")
>
>  return eval('close()')
>  
>  <%
>  }
>  %>
>
> The portal.jsp file is formed by frames:
>
>   
>framespacing="0">
>marginwidth="0" marginheight="0" SRC="arriba.htm" frameborder="0">
>
>   frameborder="0">
>   marginwidth="0" marginheight="0" noresize SRC="izquierda.jsp"
>   frameborder="NO">
>   marginheight="0" noresize SRC="blanco.jsp" frameborder="NO" >
>  
>
>  
>Su browser no acepta Frames.
>  
>   
>   
>
> In the left frame (FrameIzquierda) I have a jsp file (izquierda.jsp)
> that reads the new session's attributes (numero,edad) and they are
> displayed perfectly when the
> portal.jsp file is opened. Moreover, in the right frame I put a jsp file
> (blanco.jsp) that also reads the attributes 'id' and 'ag' and they are
> perfectly displayed too.
> But the problem becomes when I click a link placed in the izquierda.jsp
> file :
>
>  .
>  test
>  or
>  test
>  .
>
> The top.jsp file also reads the attributes (numero, edad)...
> In both cases the session's attributes are not displayed, they only
> return a "null" value,  and the session id (session.getId()) is
> differtent because when the link is
> pressed, a new session object is createdso.. I don't know how to fix
> this
> I really need to get the two attributes I stored previously in the
> session object...
>
> Could you please help me???
> I'm desperate!!
>
> Thank you in advance..
> Nancy.
>
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 



RE: session object [urgent!]

2002-04-03 Thread Huy K Dung

I have exactly the same problem. I am working on a solution but still no
luck. This problem happens to me only when i am using Netscape 4.79. IE 5.5
and Netscape 6.2.2 are OK.

I find that IE 5.5 creates a new session in a new window when IE 5.5 is run
by clicking on its icon. However, if a new IE 5.5 window is opened by
javascript from another IE 5.5 window, the same session is maintained.

As for Netscape 6.2.2, it doesn't matter if a new windows is opened by
clicking on its icon or by javascript from another Netscape window.

As for Netscape 4.79, the session is also maintained if another window is
opened ny clicking on its icon. However, if a new window is opened by
javascript from another window, the new window is able to access the session
to render the info for display but when an action is done on the new window,
a new session kicks in and the old session is unknown. Somehow, Netscape
4.79 pops up a new window as a different process.

Please HELP!!! I hope my description of the problem is clear enough.

-Original Message-
From: Nancy Crisostomo Martinez [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 02, 2002 02:56 PM
To: Tomcat Users List
Subject: Re: session object [urgent!]


I have found a kind of bug or I don't know what
I tried to access to the session's attributes, with another servlet-engine
and it works perferct!
So... I think Tomcat 3.3 (I'm using) has a bug or maybe it is a cause of a
bad configuration because the
track is lost

What do you think about it?
Does any of you have the same problem with sessions?



Nancy Crisostomo Martinez wrote:

> Hi everybody!
>
> I need your help..
> I'm trying to track some attributes I added to the session object, but I
> can't...
>
> I have an html file (main.htm) which opens a new window browser
> (validate.jsp) when you press a button to access to one service...
> Then when the user is validated in the validate.jsp file, I added two
> attributes to the session object like this:
>
>  ...
>  <%
>  if (validUser(id_Usuario)){
> session.setAttribute("numero",id_Usuario);
> session.setAttribute("edad",num);
>  ...
>
> and finally the window is closed and another new window is opened (
> portal.jsp ).
>
>  %>
>  
>
>
window.open("portal.jsp","","top=0,left=0,width=791,height=520,scrollbars=ye
s,resizable=yes,status=yes")
>
>  return eval('close()')
>  
>  <%
>  }
>  %>
>
> The portal.jsp file is formed by frames:
>
>   
>framespacing="0">
>marginwidth="0" marginheight="0" SRC="arriba.htm" frameborder="0">
>
>   frameborder="0">
>   marginwidth="0" marginheight="0" noresize SRC="izquierda.jsp"
>   frameborder="NO">
>   marginheight="0" noresize SRC="blanco.jsp" frameborder="NO" >
>  
>
>  
>Su browser no acepta Frames.
>  
>   
>   
>
> In the left frame (FrameIzquierda) I have a jsp file (izquierda.jsp)
> that reads the new session's attributes (numero,edad) and they are
> displayed perfectly when the
> portal.jsp file is opened. Moreover, in the right frame I put a jsp file
> (blanco.jsp) that also reads the attributes 'id' and 'ag' and they are
> perfectly displayed too.
> But the problem becomes when I click a link placed in the izquierda.jsp
> file :
>
>  .
>  test
>  or
>  test
>  .
>
> The top.jsp file also reads the attributes (numero, edad)...
> In both cases the session's attributes are not displayed, they only
> return a "null" value,  and the session id (session.getId()) is
> differtent because when the link is
> pressed, a new session object is createdso.. I don't know how to fix
> this
> I really need to get the two attributes I stored previously in the
> session object...
>
> Could you please help me???
> I'm desperate!!
>
> Thank you in advance..
> Nancy.
>
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 



RE: losing session info with netscape 4.x

2002-04-02 Thread Huy K Dung

I am using Turbine 2.1 with velocity macro. Is there an equivalent of
encodeURL() in velocity macro?

I am not doing anything with cookies. Is session id automatically saved as a
cookie?

This is what I did:

session.setAttribute("name", value);

popup can't seem to retrieve correctly:

session.getAttribute("name");

-Original Message-
From: Jeff Larsen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 09:55 AM
To: Tomcat Users List; Huy K. Dung
Subject: Re: losing session info with netscape 4.x


To encode a URL with the session id, you call
HttpServletResponse.encodeURL()
or HttpServletResponse.encodeRedirectURL(). If the session id is being
stored
as a cookie, these methods will leave the URL unchanged. If cookies are
disabled, then these methods will embed the session id within the URL.

So if you have a jsp with javascript that opens a popup, your javascript
would be something like this:

popup = window.open("<%= response.encodeURL("popup.jsp") %>");

In your case, with cookies enabled, it doesn't seem likely that this
is your problem. But it's a necessary practice if you want to allow
users that don't accept cookies to access your site.

Jeff

- Original Message -
From: "Huy K Dung" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 5:53 PM
Subject: RE: losing session info with netscape 4.x


> netscape 4.79 in particular. "Accept all cookies" option is selected.
>
> I will try your suggestion and see what it will do.
>
> Thanks.
>
> PS. how do you correctly encode URL?
>
> -Original Message-
> From: Jeff Larsen [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 01, 2002 06:29 PM
> To: Tomcat Users List; Huy K. Dung
> Subject: Re: losing session info with netscape 4.x
>
>
> Netscape 4.x has been working for me in this type of situation,
> but the value of ".x" might make a difference. Do you have cookies
> enabled? If not, does your javascript for opening the popup window
> use a correctly encoded URL so the popup window's request has the
> session id built in? For debugging, configure your popup window with
> an address bar so you can see the sessionid in the URL.
>
> Jeff
>
> - Original Message -
> From: "Huy K Dung" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
> Sent: Monday, April 01, 2002 4:59 PM
> Subject: losing session info with netscape 4.x
>
>
> > Hi,
> >
> > I am using tomcat 3.3.1, apache 1.3.24, turbine 2.1 to develop my web
app.
> > Everything seems to work fine with IE 5.5 and netscape 6.x and even
> netscape
> > 4.x. What I've noticed is that when I use popup windows, netscape 4.x
> > doesn't seem to have the right info from session.
> >
> > From main netscape window I click to open a 1st popup window, and from
the
> > 1st popup window I click to open a 2nd popup windows. When I perform an
> > action from the 2nd popup window, it closes it self and refresh the 1st
> > popup. The 1st popup doesn't seem to have the right session info. And
the
> > same thing happens to the main window when I perform an action on the
1st
> > popup. None of this happens to IE 5.5 or netscape 6.x.
> >
> > Does anyone come across this problem before? Work around? Please HELP!!!
> >
> > Thanks in advance!!!
> >
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>



RE: losing session info with netscape 4.x

2002-04-01 Thread Huy K Dung

netscape 4.79 in particular. "Accept all cookies" option is selected.

I will try your suggestion and see what it will do.

Thanks.

PS. how do you correctly encode URL?

-Original Message-
From: Jeff Larsen [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 06:29 PM
To: Tomcat Users List; Huy K. Dung
Subject: Re: losing session info with netscape 4.x


Netscape 4.x has been working for me in this type of situation,
but the value of ".x" might make a difference. Do you have cookies
enabled? If not, does your javascript for opening the popup window
use a correctly encoded URL so the popup window's request has the
session id built in? For debugging, configure your popup window with
an address bar so you can see the sessionid in the URL.

Jeff

- Original Message -
From: "Huy K Dung" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Monday, April 01, 2002 4:59 PM
Subject: losing session info with netscape 4.x


> Hi,
>
> I am using tomcat 3.3.1, apache 1.3.24, turbine 2.1 to develop my web app.
> Everything seems to work fine with IE 5.5 and netscape 6.x and even
netscape
> 4.x. What I've noticed is that when I use popup windows, netscape 4.x
> doesn't seem to have the right info from session.
>
> From main netscape window I click to open a 1st popup window, and from the
> 1st popup window I click to open a 2nd popup windows. When I perform an
> action from the 2nd popup window, it closes it self and refresh the 1st
> popup. The 1st popup doesn't seem to have the right session info. And the
> same thing happens to the main window when I perform an action on the 1st
> popup. None of this happens to IE 5.5 or netscape 6.x.
>
> Does anyone come across this problem before? Work around? Please HELP!!!
>
> Thanks in advance!!!
>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>



losing session info with netscape 4.x

2002-04-01 Thread Huy K Dung

Hi,

I am using tomcat 3.3.1, apache 1.3.24, turbine 2.1 to develop my web app.
Everything seems to work fine with IE 5.5 and netscape 6.x and even netscape
4.x. What I've noticed is that when I use popup windows, netscape 4.x
doesn't seem to have the right info from session.

>From main netscape window I click to open a 1st popup window, and from the
1st popup window I click to open a 2nd popup windows. When I perform an
action from the 2nd popup window, it closes it self and refresh the 1st
popup. The 1st popup doesn't seem to have the right session info. And the
same thing happens to the main window when I perform an action on the 1st
popup. None of this happens to IE 5.5 or netscape 6.x.

Does anyone come across this problem before? Work around? Please HELP!!!

Thanks in advance!!!



RE: can I use only tomcat with out Apache httpd server

2002-03-21 Thread Huy K Dung

I believe Tomcat can work as a httpd server as well as app server. The
reason one would use Apache with Tomcat is because Apache is a better httpd
server than Tomcat.

The reason Tomcat doesn't work for you is because of misconfigurations
somewhere.

I've been using Tomcat alone for development purposes and it works fine
alone.

-Original Message-
From: Uma Munugala [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 10:32 AM
To: '[EMAIL PROTECTED]'
Subject: can I use only tomcat with out Apache httpd server


Hi
  I installed tomcat 4.0.4b1 and apache httpd sever.
My question is can tomcat work without starting apache httpd, do I have to
start both of them and some how link them.

I tried to start tomcat alone and its examples working but when I run my
servlet iam getting error


java.lang.ClassFormatError: com/CellFusion/Relational/RelConnection (Illegal
Variable name "")


Any help is very much appreciated.



Thanks
Umamaheswar


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 



tomcat3-3.3a-2 HELP

2002-03-20 Thread Huy K Dung

2002-03-20 14:19:40 - Http10Interceptor: SocketException reading request,
ignored

I saw that error in tomcar.log. Does anyone know what it is.

My app doesn't run because tomcat doesn't load turbine library (jar) in
WEB-INF/lib. I have tried to move all libraries (jars) into tomcat/lib/apps
but it doesn't work either. PLEASE HELP!!!



RE: tomcat3-3.3a-2 doesn't load turbine-2.1

2002-03-19 Thread Huy K Dung

It could be a mistake when we did the web.xml originally. I've been
wondering if that would be the problem. However, it has been working with
tomcat 3.2.3 all along. I just upgraded to tomcat 3-3.3a-2 and it stopped
working. I fixed the typo and restarted tomcat - it didn't work either.

Well, one thing I can say is that the structure of tomcat 3-3.3a-2 is
different from that of tomcat 3.2.3. It could be that I don't know how to
configure the new tomcat.

Thank you!!! Please advise if you have any other ideas.

-Original Message-
From: Larry Isaacs [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 07:41 AM
To: 'Tomcat Users List'
Subject: RE: tomcat3-3.3a-2 doesn't load turbine-2.1


Is it a typo that you are using "turbine" in the
servlet declaration, and "Turbine" (uppercase 'T')
in the mapping?  They should be the same.

Cheers,
Larry

> -Original Message-
> From: Huy K Dung [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 18, 2002 7:02 PM
> To: [EMAIL PROTECTED]
> Subject: tomcat3-3.3a-2 doesn't load turbine-2.1
>
>
> Hi,
>
> I just installed tomcat3-3.3a-2 on my linux 7.2 system apache
> 1.3.20.  I deployed two web apps that I have been developed
> and work with tomcat 3.2.3. These two web apps deployed
> outside of webapps directory.
>
> Tomcat seems to work ok since I can run jsp's from /examples
> and /admin through port 8080.
>
> Both of my web apps are recognized by apache and tomcat. The
> problem is that as soon as they finish loading the index.html
> (which redirects to turbine), I get a HTTP 404 Not Found. I
> check the tomcat.log and see the following
> message:
>
> 2002-03-18 18:41:39 - Ctx(/[myapp]) : Class not found: turbine
>
> Here is the partial of my web.xml:
>
> 
> 
> 
>turbine
> 
> 
> org.apache.turbine.Turbine
> 
>  
> properties
> 
> 
> WEB-INF/conf/TurbineResources.properties
> 
> 
> 
> 
>   Turbine
>   /turbine
> 
>
> ...
> ...
>
> 
>
> I have all the jar files (turbine as well as other libraries)
> in [myapp]/WEB-INF/lib directory.
>
> Does anyone have the same problem that I am having? Please
> HELP!!! Thanks
>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>



tomcat3-3.3a-2 doesn't load turbine-2.1

2002-03-18 Thread Huy K Dung

Hi,

I just installed tomcat3-3.3a-2 on my linux 7.2 system apache 1.3.20.  I
deployed two web apps that I have been developed and work with tomcat 3.2.3.
These two web apps deployed outside of webapps directory.

Tomcat seems to work ok since I can run jsp's from /examples and /admin
through port 8080.

Both of my web apps are recognized by apache and tomcat. The problem is that
as soon as they finish loading the index.html (which redirects to turbine),
I get a HTTP 404 Not Found. I check the tomcat.log and see the following
message:

2002-03-18 18:41:39 - Ctx(/[myapp]) : Class not found: turbine

Here is the partial of my web.xml:




   turbine


org.apache.turbine.Turbine

 
properties


WEB-INF/conf/TurbineResources.properties




  Turbine
  /turbine


...
...



I have all the jar files (turbine as well as other libraries) in
[myapp]/WEB-INF/lib directory.

Does anyone have the same problem that I am having? Please HELP!!! Thanks