You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by "David H. DeWolf" <dd...@apache.org> on 2006/01/02 20:01:44 UTC

Re: pluto 1.1: patch for pluto-portal-driver when upgrading to Spring 2.0M1

I would prefer to fix this bug another way as this one change requires 
an entirely new dependency and we're trying to keep pluto "light  weight".

Other Thoughts?

David

Stefan Armbruster wrote:
> Hi,
> 
> recently the Spring team released Spring 2.0M1. I tried to use this with 
> pluto-portal-driver. When deploying the portal's war file, an 
> IllegalStateException occured. This is caused by 
> InputStreamResource.getInputStream being called twice. The attached patch 
> uses ServletContextResource instead and solves this problem. This patch also 
> contains the necessary version changes in pom.xml. 
> 
> Regards,
> Stefan
> 
> 
> ------------------------------------------------------------------------
> 
> Index: pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java
> ===================================================================
> --- pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java	(Revision 359203)
> +++ pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java	(Arbeitskopie)
> @@ -20,6 +20,7 @@
>  import org.springframework.beans.factory.xml.XmlBeanFactory;
>  import org.springframework.beans.factory.NoSuchBeanDefinitionException;
>  import org.springframework.core.io.InputStreamResource;
> +import org.springframework.web.context.support.ServletContextResource;
>  
>  import javax.servlet.ServletContext;
>  import java.io.InputStream;
> @@ -106,9 +107,7 @@
>  
>      private XmlBeanFactory getBeanFactory(ServletContext context) {
>          if(beanFactory == null) {
> -            InputStream in =
> -                    context.getResourceAsStream(DRIVER_CONFIG);
> -            beanFactory = new XmlBeanFactory(new InputStreamResource(in, "Driver Configuration"));
> +            beanFactory = new XmlBeanFactory(new ServletContextResource(context, DRIVER_CONFIG));
>          }
>          return beanFactory;
>      }
> Index: pluto-portal-driver/pom.xml
> ===================================================================
> --- pluto-portal-driver/pom.xml	(Revision 359203)
> +++ pluto-portal-driver/pom.xml	(Arbeitskopie)
> @@ -88,15 +88,21 @@
>      <dependency>
>        <groupId>org.springframework</groupId>
>        <artifactId>spring-core</artifactId>
> -      <version>1.2.5</version>
> +      <version>2.0-m1</version>
>        <scope>compile</scope>
>      </dependency>
>      <dependency>
>          <groupId>org.springframework</groupId>
>          <artifactId>spring-beans</artifactId>
> -        <version>1.2.5</version>
> +        <version>2.0-m1</version>
>          <scope>compile</scope>
>      </dependency>
> +    <dependency>
> +        <groupId>org.springframework</groupId>
> +        <artifactId>spring-web</artifactId>
> +        <version>2.0-m1</version>
> +        <scope>compile</scope>
> +    </dependency>
>    </dependencies>
>    <build>
>      <resources>


Re: pluto 1.1: patch for pluto-portal-driver when upgrading to Spring 2.0M1

Posted by Stefan Armbruster <st...@armbruster-it.de>.
Hi David,

I've modified the patch in order not to introduce any new dependencies. I 
small nested class "ServletContextResource" solves the job.

Regards,
Stefan


Am Montag, 2. Januar 2006 20:01 schrieb David H. DeWolf:
> I would prefer to fix this bug another way as this one change requires
> an entirely new dependency and we're trying to keep pluto "light  weight".
>
> Other Thoughts?
>
> David
>
> Stefan Armbruster wrote:
> > Hi,
> >
> > recently the Spring team released Spring 2.0M1. I tried to use this with
> > pluto-portal-driver. When deploying the portal's war file, an
> > IllegalStateException occured. This is caused by
> > InputStreamResource.getInputStream being called twice. The attached patch
> > uses ServletContextResource instead and solves this problem. This patch
> > also contains the necessary version changes in pom.xml.
> >
> > Regards,
> > Stefan
> >
> >
> > ------------------------------------------------------------------------
> >
> > Index:
> > pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverCo
> >nfigurationFactory.java
> > =================================================================== ---
> > pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverCo
> >nfigurationFactory.java	(Revision 359203) +++
> > pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverCo
> >nfigurationFactory.java	(Arbeitskopie) @@ -20,6 +20,7 @@
> >  import org.springframework.beans.factory.xml.XmlBeanFactory;
> >  import org.springframework.beans.factory.NoSuchBeanDefinitionException;
> >  import org.springframework.core.io.InputStreamResource;
> > +import org.springframework.web.context.support.ServletContextResource;
> >
> >  import javax.servlet.ServletContext;
> >  import java.io.InputStream;
> > @@ -106,9 +107,7 @@
> >
> >      private XmlBeanFactory getBeanFactory(ServletContext context) {
> >          if(beanFactory == null) {
> > -            InputStream in =
> > -                    context.getResourceAsStream(DRIVER_CONFIG);
> > -            beanFactory = new XmlBeanFactory(new InputStreamResource(in,
> > "Driver Configuration")); +            beanFactory = new
> > XmlBeanFactory(new ServletContextResource(context, DRIVER_CONFIG)); }
> >          return beanFactory;
> >      }
> > Index: pluto-portal-driver/pom.xml
> > ===================================================================
> > --- pluto-portal-driver/pom.xml	(Revision 359203)
> > +++ pluto-portal-driver/pom.xml	(Arbeitskopie)
> > @@ -88,15 +88,21 @@
> >      <dependency>
> >        <groupId>org.springframework</groupId>
> >        <artifactId>spring-core</artifactId>
> > -      <version>1.2.5</version>
> > +      <version>2.0-m1</version>
> >        <scope>compile</scope>
> >      </dependency>
> >      <dependency>
> >          <groupId>org.springframework</groupId>
> >          <artifactId>spring-beans</artifactId>
> > -        <version>1.2.5</version>
> > +        <version>2.0-m1</version>
> >          <scope>compile</scope>
> >      </dependency>
> > +    <dependency>
> > +        <groupId>org.springframework</groupId>
> > +        <artifactId>spring-web</artifactId>
> > +        <version>2.0-m1</version>
> > +        <scope>compile</scope>
> > +    </dependency>
> >    </dependencies>
> >    <build>
> >      <resources>