----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi,

I am using Stronghold 2.4.2(Apache 1.3.6) with JServ 1.1 on Solaris 2.6
platform. My problem is I am losing my session with https. 

The ServerName for the http server is host1 and ServerName for the SSL
Virtual Host is host2. I have two servlets , Servlet1 and Servlet2. Servlet1
is initated by calling https://host2/servlet/Servlet1 , and then by using
sendRedirect, it passes the request to Servlet2 by implementing
response.sendRedirect( response.encodeRedirectUrl(
https://host2/servlet/Servlet2 ) ). If the user accepts the cookie, the
system work. However if the user does not accept the cookie, URLRewriting
does not work and the session is lost. 

When I put a link on the Servlet1 , point to Servlet2 via
response.encodeURL( https://host2/servlet/Servlet2) instead of sendRedirect,
session tracking works without the cookies. However it doesn' t work with
sendRedirect.  

Below you can find http.conf, jserv.conf, Servlet1.java and Servlet2.java. I
would appreciate any help or comment on this topic.

Thanks,
Yalcin

httpd.conf
############################
### Server configuration ###
############################
ServerType standalone
Port 80
Listen 80
HostnameLookups off
User nobody
Group nobody
ServerRoot /usr/local/stronghold
#BindAddress *
ExtendedStatus On
ServerName host1
ServerSignature on
UseCanonicalName on
DocumentRoot /usr/local/stronghold/htdocs

# Add jserv configuration 
Include /usr/local/jserv/etc/jserv.conf

# This virtual host handles the secure port (443)
###
Listen "443"
<VirtualHost *:443>

ServerName host2 
DocumentRoot "/usr/local/stronghold/htdocs"
</VirtualHost>

##############################
jserv.conf


############################################################################
###
#                     Apache JServ Configuration File
#
############################################################################
###

# Note: this file should be appended or included into your httpd.conf

# Tell Apache on win32 to load the Apache JServ communication module
#LoadModule jserv_module modules/ApacheModuleJServ.dll

# Tell Apache on Unix to load the Apache JServ communication module
# For shared object builds only!!!
#LoadModule jserv_module /usr/local/jserv/libexec/mod_jserv.so

<IfModule mod_jserv.c>

# Whether Apache must start Apache JServ or not (On=Manual Off=Autostart)
# Syntax: ApJServManual [on/off]
# Default: "Off"
ApJServManual off

# Properties filename for Apache JServ in Automatic Mode. 
# In manual mode this directive is ignored
# Syntax: ApJServProperties [filename]
# Default: "./conf/jserv.properties"
ApJServProperties /usr/local/jserv/etc/jserv.properties

# Log file for this module operation relative to Apache root directory.
# Set the name of the trace/log file.  To avoid possible confusion about
# the location of this file, an absolute pathname is recommended.
# 
# This log file is different than the log file that is in the
# jserv.properties file. This is the log file for the C portion of Apache
# JServ.
# 
# On Unix, this file must have write permissions by the owner of the JVM
# process. In other words, if you are running Apache JServ in manual mode
# and Apache is running as user nobody, then the file must have its
# permissions set so that that user can write to it.
# Syntax: ApJServLogFile [filename] 
# Default: "./logs/mod_jserv.log"
# Note: when set to "DISABLED", the log will be redirected to Apache error
log
ApJServLogFile /usr/local/stronghold/logs/mod_jserv.log


# Log Level for this module
# Syntax: ApJServLogLevel [debug|info|notice|warn|error|crit|alert|emerg]
# Default: info    (unless compiled w/ JSERV_DEBUG, in which case it's
debug)
ApJServLogLevel notice

# Protocol used by this host to connect to Apache JServ
# (see documentation for more details on available protocols)
# Syntax: ApJServDefaultProtocol [name]
# Default: "ajpv12"
ApJServDefaultProtocol ajpv12

# Default host on which Apache JServ is running
# Syntax: ApJServDefaultHost [hostname]
# Default: "localhost"
#ApJServDefaultHost java.apache.org

# Default port that Apache JServ is listening to
# Syntax: ApJServDefaultPort [number]
# Default: protocol-dependant (for ajpv12 protocol this is "8007")
ApJServDefaultPort 8007

# The amount of time to give to the JVM to start up as well
# as the amount of time to wait to ping the JVM to see if it
# is alive. Slow or heavily loaded machines might want to 
# increase this value.
# Default: 10 seconds
ApJServVMTimeout 10

# Passes parameter and value to specified protocol.
# Syntax: ApJServProtocolParameter [name] [parameter] [value]
# Default: NONE
# Note: Currently no protocols handle this. Introduced for future protocols.

# Apache JServ secret key file relative to Apache root directory.
# Syntax: ApJServSecretKey [filename]
# Default: "./conf/jserv.secret.key"
# Warning: if authentication is DISABLED, everyone on this machine (not just
# this module) may connect to your servlet engine and execute servlet 
# bypassing web server restrictions. See the documentation for more
information
#ApJServSecretKey /usr/local/jserv/etc/jserv.secret.key
ApJServSecretKey DISABLED

# Mount point for Servlet zones
# (see documentation for more information on servlet zones)
# Syntax: ApJServMount [name] [jserv-url]
# Default: NONE
# Note: [name] is the name of the Apache URI path to mount jserv-url on
#       [jserv-url] is something like "protocol://host:port/zone"
#  If protocol, host or port are not specified, the values from 
#  "ApJServDefaultProtocol", "ApJServDefaultHost" or "ApJServDefaultPort" 
#  will be used. 
#  If zone is not specified, the zone name will be the first subdirectory of
#  the called servlet.
# Example: "ApJServMount /servlets /myServlets"
#  if user requests "http://host/servlets/TestServlet"
#  the servlet "TestServlet" in zone "myServlets" on default host
#  thru default protocol on defaul port will be requested
# Example: "ApJServMount /servlets ajpv12://localhost:8007"
#  if user requests "http://host/servlets/myServlets/TestServlet"
#  the servlet "TestServlet" in zone "myServlets" will be requested
# Example: "ApJServMount /servlets
ajpv12://jserv.mydomain.com:15643/myServlets"
#  if user requests "http://host/servlets/TestServlet" the servlet 
#  "TestServlet" in zone "myServlets" on host "jserv.mydomain.com" using 
#  "ajpv12" protocol on port "15643" will be executed
ApJServMount /servlets /root
ApJServMount /servlet /root

# Whether <VirtualHost> inherits base host mount points or not
# Syntax: ApJServMountCopy [on/off]
# Default: "On"
# Note: This directive is meaninful only when virtual hosts are being used
ApJServMountCopy on

# Executes a servlet passing filename with proper extension in
PATH_TRANSLATED 
# property of servlet request.
# Syntax: ApJServAction [extension] [servlet-uri]
# Defaults: NONE
# Notes: This is used for external tools.
#ApJServAction .jsp /servlets/org.gjt.jsp.JSPServlet
#ApJServAction .gsp /servlets/com.bitmechanic.gsp.GspServlet
#ApJServAction .jhtml /servlets/org.apache.servlet.ssi.SSI
#ApJServAction .xml /servlets/org.apache.cocoon.Cocoon

# Enable the Apache JServ status handler with the URL of 
# "http://servername/jserv/" (note the trailing slash!)
# Change the "deny" directive to restrict access to this status page.
<Location /jserv/>
  SetHandler jserv-status
  
  order deny,allow
  deny from all
  allow from localhost
</Location>

#####################################
Servlet1.java
#####################################
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Servlet1 extends HttpServlet {
    
    public void init(javax.servlet.ServletConfig config) throws
ServletException {
        super.init(config);     
    }

    public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) throws ServletException,
IOException {
        doPost(request, response);
    }

    public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) throws ServletException,
IOException {
        try {
                HttpSession session = request.getSession(true);
                session.putValue("username", "demo");
                response.sendRedirect(response.encodeRedirectUrl(
"https://host2/servlet/Servlet2" ));
        } catch (Exception e) {
                log(e.toString());
                e.printStackTrace();
        }                       
    }

###############################################
Servlet2.java
###############################################
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Servlet2 extends HttpServlet {

    public void init(javax.servlet.ServletConfig config) throws
ServletException {
        super.init(config);     
    }

    public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) throws ServletException,
IOException {
        try {
                HttpSession session = request.getSession(false);
                response.setContentType("text/html; charset=iso-8859-9");
                PrintWriter out = response.getWriter();
                
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Demo</title>");
                out.println("<meta http-equiv=\"Content-Type\"
content=\"text/html; charset=windows-1254\">");
                out.println("</head>");
                out.println("<body>");
                out.println("<center>TAMAM</center>");
                out.println("<p>" + session.getValue("username") + "</p>");
                out.println("</body>");
                out.println("</html>");         
                out.flush();
                out.close();
        } catch (Exception e) {
                log(e.toString());
                e.printStackTrace();
        }
    }

    public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) throws ServletException,
IOException {
        doGet(request, response);
    }
}


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to