You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ol...@axa-alert.com on 2001/02/21 09:20:47 UTC

STRUTS - IPlanet6.0 - What to do ?

Hi, 

a.)
The first thing you have to do is to switch of the ability of the
web-application to be distributable over several server instances due to the
fact that STRUTS has ServletContext attributes that are not serializable at
the moment. 

To do so I have attached a screenshot of the IP-deploymenttool. There is a
check box on the panel for the war file with the name DISTRIBUTABLE on the
panel GENERAL. You should't check this until STRUTS ServletContext
attributes are all serializable.

--> I did not attached the screenshot. If somebody needs that call me.

b.) 
The second one refers to the incompatibilty of IP SP1 to Servlet2.2. This
will be fixed, as SUN announced, with SP2. 
I did not test that yet, but with a little (cheap) work-around you can use
STRUTS with SP1, too:

b1.) 

In the ActionServlet in the method 

	protected String processPath(HttpServletRequest request) 

I included the follwing code:

	  //IPLANETBUGFIX BEGIN
        path = (String)request.getParameter("iplanetaction");
	  if (path!=null){
		System.err.println("Using IPlanet-Bugfix");
		return path;
	  }
        //IPLANETBUGFIX END 

The whole method looks like that: 

protected String processPath(HttpServletRequest request) {

	  String path = null;
	  //IPLANETBUGFIX BEGIN
        path = (String)request.getParameter("iplanetaction");
	  if (path!=null){
		System.err.println("Using IPlanet-Bugfix");
		return path;
	  }
        //IPLANETBUGFIX END 	
	

        // For prefix matching, we want to match on the path info (if any)
        path =
            (String)
request.getAttribute("javax.servlet.include.path_info");
        if (path == null)
            path = request.getPathInfo();
	if ((path != null) && (path.length() > 0))
	    return (path);

	// For extension matching, we want to strip the extension (if any)
        path =
           (String)
request.getAttribute("javax.servlet.include.servlet_path");
        if (path == null)
            path = request.getServletPath();
	int slash = path.lastIndexOf("/");
	int period = path.lastIndexOf(".");
	if ((period >= 0) && (period > slash))
	    path = path.substring(0, period);
	return (path);

}

In order to let that work you have to include a hidden input field on every
screen with the value of the action like:

<html:form action="candiLogon.do" focus="username">
<input type="hidden" name="iplanetaction" value="/candiLogon"/> 

Why this workaround ? 

It's because the method request.getServletPath() always returns the path of
the ActionServlet and not the mapped URI.  


c.) 

The following thing has to be taken into account as well, refers also to the
Servlet2.2 incompatibility and will 
be fixed with SP2 as well, as SUN promised.

You can't forward with mapped URI via the RequestDispatcher. You have to
forward to JSPs or Servlets or HTMLs. 

That means you can't do things like:

<forward name="success" path="/candiAktenauskunft.do" redirect="false"/>

You have to do:
  
<forward name="success" path="/candiAktenauskunft.jsp" redirect="false"/>

or any other solution..!

Because of that some nice features are lost.


Finally:
That are the three main problems where two can be fixed with workararounds
and the third one has to be considered separately. 

Nevertheless it works and I am looking forward to install SP2 to use STRUTS
with all of it's possibilities.
At the moment we are developing with STRUTS relying on SP2.  

Oliver



  
  
 



Re: STRUTS - IPlanet6.0 - What to do ?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
See a couple of embedded comments below.

Oliver.Lauer@axa-alert.com wrote:

> Hi,
>
> a.)
> The first thing you have to do is to switch of the ability of the
> web-application to be distributable over several server instances due to the
> fact that STRUTS has ServletContext attributes that are not serializable at
> the moment.
>

Just to clarify ... this is currently true only for the example application.
The framework itself uses only Serializable servlet context attributes in recent
nightly builds.

>
> To do so I have attached a screenshot of the IP-deploymenttool. There is a
> check box on the panel for the war file with the name DISTRIBUTABLE on the
> panel GENERAL. You should't check this until STRUTS ServletContext
> attributes are all serializable.
>
> --> I did not attached the screenshot. If somebody needs that call me.
>
> b.)
> The second one refers to the incompatibilty of IP SP1 to Servlet2.2. This
> will be fixed, as SUN announced, with SP2.
> I did not test that yet, but with a little (cheap) work-around you can use
> STRUTS with SP1, too:
>
> b1.)
>
> In the ActionServlet in the method
>
>         protected String processPath(HttpServletRequest request)
>
> I included the follwing code:
>
>           //IPLANETBUGFIX BEGIN
>         path = (String)request.getParameter("iplanetaction");
>           if (path!=null){
>                 System.err.println("Using IPlanet-Bugfix");
>                 return path;
>           }
>         //IPLANETBUGFIX END
>
> The whole method looks like that:
>

You can avoid having to modify the existing Struts controller servlet for things
like this if you subclass it instead, and override the processPath() method like
this:

    protected String processPath(HttpServletRequest request) {

        String path = request.getParameter("iplanetaction");
        if (path != null) {
            System.err.println("Using IPLanet-Bugfix");
            return path;
        }
        return super.processPath(request);

    }

That way, you will not get left behind if the standard logic in processPath() is
updated in the future.  Simply use your custom subclass, instead of
org.apache.struts.action.ActionServlet, in the web.xml file.


>
> Oliver
>

Craig