why won't the isNew() method work properly? - Weblogic

This is a discussion on why won't the isNew() method work properly? - Weblogic ; I have coded an include jsp like this. String iContextPath; String iCommonPath; String iImagesPath; %> iContextPath = request.getContextPath(); iCommonPath = iContextPath + "/common"; iImagesPath = iCommonPath + "/images"; System.err.println(" here "); HttpSession thisSession = request.getSession( false ); if( thisSession.isNew() ){ ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: why won't the isNew() method work properly?

  1. why won't the isNew() method work properly?

    I have coded an include jsp like this.

    <%@page language="Java"%>
    <%@page import="javax.servlet.http.HttpSession"%>
    <%!
    String iContextPath;
    String iCommonPath;
    String iImagesPath;
    %>
    <%
    iContextPath = request.getContextPath();
    iCommonPath = iContextPath + "/common";
    iImagesPath = iCommonPath + "/images";

    System.err.println(" here ");
    HttpSession thisSession = request.getSession( false );
    if( thisSession.isNew() ){
    System.err.println("isnew");
    response.sendRedirect( iContextPath + "/common/login.jsp" );
    }

    %>

    Now I also have a redirect.jsp in the root of an application that contains
    this.


    <%
    System.err.println("Redirecting at this time from the root");
    response.sendRedirect( request.getContextPath() + "/secureArea/");
    %>



    And I have a logout.java servlet that looks like this.
    package com.pch.epics;

    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import weblogic.servlet.security.ServletAuthentication;

    public class Logout extends HttpServlet{
    private static final String CONTENT_TYPE = "text/html";
    //Initialize global variables
    public void init() throws ServletException{
    }

    //Process the HTTP Get request
    public void doGet( HttpServletRequest request, HttpServletResponse
    response ) throws ServletException, IOException{
    String username = "";
    if( request.getUserPrincipal() == null ){
    username = "Unknown";
    } else {
    username = request.getUserPrincipal().getName();
    }
    System.err.println( "ePics logging out '" + username + "'" );
    request.getSession( false ).invalidate();
    ServletAuthentication.logout( request );
    ServletAuthentication.invalidateAll( request );
    ServletAuthentication.killCookie( request );
    response.sendRedirect( request.getContextPath() );
    }

    //Process the HTTP Post request
    public void doPost( HttpServletRequest request, HttpServletResponse
    response ) throws ServletException, IOException{
    doGet( request, response );
    }

    //Clean up resources
    public void destroy(){
    }
    }

    First of all, why won't the isNew() report a new session in the server log?
    EVERY request coming in says it's an old request (ie it's not new). The
    J2EE Applications and BEA WebLogic Server book from BEA says this should
    work.

    My second question is why do I need to do those three lines from
    ServletAuthentication to logout a user? Ok, maybe I'm from the MS world,
    but that seems excessive, especially since I've already done a
    session.invalidate() right before it, but the bea docs say I'm required to
    do all four!



  2. Re: why won't the isNew() method work properly?


    "Flip" wrote in message
    news:3f97327b@newsgroups.bea.com...
    > I have coded an include jsp like this.
    >

    You may want to ask in the weblogic.developer.interest.servlet newsgroup.



  3. Re: why won't the isNew() method work properly?

    Thanks for the heads up.



    "Peter" wrote in message news:3f9c6ad7@newsgroups.bea.com...
    >
    > "Flip" wrote in message
    > news:3f97327b@newsgroups.bea.com...
    > > I have coded an include jsp like this.
    > >

    > You may want to ask in the weblogic.developer.interest.servlet newsgroup.
    >
    >




+ Reply to Thread