Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Session Problem with Servlets

2 posts in General Discussion (old) Last posting was on 2000-03-24 03:31:58.0Z
Kelly Hart Posted on 2000-03-23 19:13:01.0Z
Newsgroups: sybase.public.easerver
Date: Thu, 23 Mar 2000 13:13:01 -0600
From: Kelly Hart <KHart@ifmc.org>
Reply-To: khart@netins.net
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Session Problem with Servlets
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 47
NNTP-Posting-Host: host37.ifmc.org 207.108.42.37
Message-ID: <347_38DA6CBC.53225D9E@ifmc.org>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25806
Article PK: 155852

I have a servlet that checks to see if you have done a successful
login. If not, it creates a session and writes out the original URL and
redirects you to the login page. The login page upon successful entry
writes to the session indicating the login was successful and reads the
original URL and redirects back to where they originally tried to go.
The code with the redirects works fine if I run the servlets from the
Java Web Server from Sun, Netscape Web Server using ServletExec or JRUN
but does not work running the servlets under Jaguar. Below shows an
excerpt of the code. I am pretty new to java, am I doing something
wrong?


public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
String host = getHost(req);

HttpSession session = null;
if (isPersonLoggedIn(req, res))
session = req.getSession(true);
else
return;
additional code...


public boolean isPersonLoggedIn(HttpServletRequest req,
HttpServletResponse res) throws ServletException, IOException
{
HttpSession session = req.getSession(true);
Object done = session.getValue("login.isDone");
if (done == null)
{
String target = "";
String query = "";
res.setContentType("text/plain");
target = HttpUtils.getRequestURL(req).toString();
query = req.getQueryString();
if (query != null)
target = target + "?" + query;
session.putValue("login.target", target);
res.sendRedirect(getHost(req) + "/login.html");
return false;
}
else
{
return true;
}
}

The session only appears to be created (running under Jaguar) if I take
out the redirects.
I am using JAG 3.5 with the Con. EBF.


Dave Wolf [Sybase] Posted on 2000-03-24 03:31:58.0Z
Newsgroups: sybase.public.easerver
From: "Dave Wolf [Sybase]" <dwolf@sybase.com>
Subject: Re: Session Problem with Servlets
Date: Thu, 23 Mar 2000 22:31:58 -0500
Lines: 63
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: vpn-eme-040.sybase.com 130.214.8.40
Message-ID: <347_6xhxiIUl$GA.298@forums.sybase.com>
References: <347_38DA6CBC.53225D9E@ifmc.org>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:25771
Article PK: 155820

On the surface sounds like a bug to me. Please open a case with support.

Dave Wolf
Internet Applications Division

"Kelly Hart" <KHart@ifmc.org> wrote in message
news:38DA6CBC.53225D9E@ifmc.org...
> I have a servlet that checks to see if you have done a successful
> login. If not, it creates a session and writes out the original URL and
> redirects you to the login page. The login page upon successful entry
> writes to the session indicating the login was successful and reads the
> original URL and redirects back to where they originally tried to go.
> The code with the redirects works fine if I run the servlets from the
> Java Web Server from Sun, Netscape Web Server using ServletExec or JRUN
> but does not work running the servlets under Jaguar. Below shows an
> excerpt of the code. I am pretty new to java, am I doing something
> wrong?
>
>
> public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws IOException, ServletException
> {
> String host = getHost(req);
>
> HttpSession session = null;
> if (isPersonLoggedIn(req, res))
> session = req.getSession(true);
> else
> return;
> additional code...
>
>
> public boolean isPersonLoggedIn(HttpServletRequest req,
> HttpServletResponse res) throws ServletException, IOException
> {
> HttpSession session = req.getSession(true);
> Object done = session.getValue("login.isDone");
> if (done == null)
> {
> String target = "";
> String query = "";
> res.setContentType("text/plain");
> target = HttpUtils.getRequestURL(req).toString();
> query = req.getQueryString();
> if (query != null)
> target = target + "?" + query;
> session.putValue("login.target", target);
> res.sendRedirect(getHost(req) + "/login.html");
> return false;
> }
> else
> {
> return true;
> }
> }
>
> The session only appears to be created (running under Jaguar) if I take
> out the redirects.
> I am using JAG 3.5 with the Con. EBF.
>
>