> On Monday 11 March 2002 8:13 am, Chetan Hiremath P wrote: > > Hi, > > This sort of problem occurs if and only if the url to which u are > > redirecting has a different port or the servlet to which u are > > redirecting is in a different context. > > If u are redirecting from a servlet whose url is > > http://localhost:80/customers/servlet/list > > to a servlet whose url is > > http://localhost:80/suppliers/servlet/list > > or > > https://localhost:443/customers/servlet/list > > then the session attributes set in the first servlet will not be > > accessible > > > from the next servlet(where it is redirected). > > U can test it by redirecting to the servlet with the same url path(ie > > port and context). > > cookies are only valid for the domain specified when they are sent > > so this problem often occurs if you log into the site using a short form on > the machine name - set a cookie and later redirect to the fully qualified > domain name (also true if there is more thane one fqdn for the server) > > (I'm comming to servlets from php,perl - so I'm not sure if you can access > the same servlet context from these different hostnames...)
On Monday 11 March 2002 11:15 am, Rohan Shrinivas Desai wrote: > Thank you Sean and Chetan for ur response > but i think there is nothing like, changing the context of the servlet and > also the change in the port number actually hapening in my application. > > but i will be glad to know more in detail about what Sean said. > Sean, if u dont mind, can u please elaborate ?? > when you set a cookie - you are probably mostly aware of setting the name/value pair of your cookie but there are several other pices of information sent, the ones I am aware of are expiry - defaults to session (ie cookie expires when browser is shut down) path - defaults to / - whole server domain - defaults to the domain that set the cookie when the browser makes subsequent requests - it is this data it consults to see whether it should send cookie data with the request. it will only send cookie-data if the cookie has not expired, the domain and path match *and* the browser is set to return cookies. for the path to match the request path must be within the cookie path - same for domain) so a cookie valid for www.yourdomain.com will not be valid for www2.yourdomain.com - even if both domain names point to the sanme server I often develop locally and refer to my virtual server as 'eu' but I might also refer to it as eu.sean (inluding the machine name) or eu.sean.uncertainty.org.uk (fqdn) - a cookie set for one of these will not be valid for any other as none of the names are subsets of the others. I can however set a cookie for sean.uncertainty.org.uk and it will be returned to server1.uncertainty.org.uk and server2.uncertainty.org.uk etc for more info - and the java methods required http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/javax/servlet/http/Cookie.html I have often had problems with this where a server accepts several names for the same site - but redirects have been used without checking the hostname being used. -- Sean ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
