You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Shu (JIRA)" <ji...@apache.org> on 2012/07/14 04:14:34 UTC

[jira] [Created] (WICKET-4655) Can a SpringBean's state be serialized?

Shu created WICKET-4655:
---------------------------

             Summary: Can a SpringBean's state be serialized?
                 Key: WICKET-4655
                 URL: https://issues.apache.org/jira/browse/WICKET-4655
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-spring
    Affects Versions: 1.5.7
         Environment: Windows/Linux, JDK 6, Spring 3.1.0
            Reporter: Shu


I have Wicket page containing a SpringBean injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean injected object should be bound to "page" scope?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4655) Can a SpringBean's state be serialized?

Posted by "Shu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shu updated WICKET-4655:
------------------------

    Description: 
I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

{code}
public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}
{code}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean-injected object should be bound to "page" scope, so that if the same page instance is deserialized the same dependency instance is looked up? 

  was:
I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean-injected object should be bound to "page" scope, so that if the same page instance is deserialized the same dependency instance is looked up? 

    
> Can a SpringBean's state be serialized?
> ---------------------------------------
>
>                 Key: WICKET-4655
>                 URL: https://issues.apache.org/jira/browse/WICKET-4655
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.5.7
>         Environment: Windows/Linux, JDK 6, Spring 3.1.0
>            Reporter: Shu
>
> I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.
> In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.
> {code}
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> }
> @Component
> @Scope("request")
> public class DAODataProvider extends SortableDataProvider {
> 	@Inject protected GeneralDAO dao;
> 	
> 	private Class<?> entityClass;
> 	
> 	public DAODataProvider() {
> 		super();
> 	}
> }
> {code}
> The solution seems to be to do this:
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> 	@Override
> 	protected void onBeforeRender()
> 	{
> 		dataProvider.setEntityClass(UserAccount.class);
> 		super.onBeforeRender();
> 	}
> }
> Is there a good way to indicate that a SpringBean-injected object should be bound to "page" scope, so that if the same page instance is deserialized the same dependency instance is looked up? 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4655) Can a SpringBean's state be serialized?

Posted by "Shu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shu updated WICKET-4655:
------------------------

    Description: 
I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean-injected object should be bound to "page" scope, so that if the same page instance is deserialized the same dependency instance is looked up? 

  was:
I have Wicket page containing a SpringBean injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean injected object should be bound to "page" scope?

    
> Can a SpringBean's state be serialized?
> ---------------------------------------
>
>                 Key: WICKET-4655
>                 URL: https://issues.apache.org/jira/browse/WICKET-4655
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.5.7
>         Environment: Windows/Linux, JDK 6, Spring 3.1.0
>            Reporter: Shu
>
> I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.
> In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> }
> @Component
> @Scope("request")
> public class DAODataProvider extends SortableDataProvider {
> 	@Inject protected GeneralDAO dao;
> 	
> 	private Class<?> entityClass;
> 	
> 	public DAODataProvider() {
> 		super();
> 	}
> }
> The solution seems to be to do this:
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> 	@Override
> 	protected void onBeforeRender()
> 	{
> 		dataProvider.setEntityClass(UserAccount.class);
> 		super.onBeforeRender();
> 	}
> }
> Is there a good way to indicate that a SpringBean-injected object should be bound to "page" scope, so that if the same page instance is deserialized the same dependency instance is looked up? 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4655) Can a SpringBean's state be serialized?

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4655.
-------------------------------------

    Resolution: Not A Problem

Please use the mailing lists for asking questions like this.

Your bean is request scoped so it will be recreated for each request. Wicke serializes only a Proxy to the bean.
Try with session scope.
                
> Can a SpringBean's state be serialized?
> ---------------------------------------
>
>                 Key: WICKET-4655
>                 URL: https://issues.apache.org/jira/browse/WICKET-4655
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.5.7
>         Environment: Windows/Linux, JDK 6, Spring 3.1.0
>            Reporter: Shu
>
> I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.
> In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.
> {code}
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> }
> @Component
> @Scope("request")
> public class DAODataProvider extends SortableDataProvider {
> 	@Inject protected GeneralDAO dao;
> 	
> 	private Class<?> entityClass;
> 	
> 	public DAODataProvider() {
> 		super();
> 	}
> }
> {code}
> The solution seems to be to do this:
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> 	@Override
> 	protected void onBeforeRender()
> 	{
> 		dataProvider.setEntityClass(UserAccount.class);
> 		super.onBeforeRender();
> 	}
> }
> Is there a good way to indicate that a SpringBean-injected object should have its non-injected properties serialized, to avoid doing the onBeforeRender workaround above?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4655) Can a SpringBean's state be serialized?

Posted by "Shu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shu updated WICKET-4655:
------------------------

    Description: 
I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

{code}
public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}
{code}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean-injected object should have its non-injected properties serialized, to avoid doing the onBeforeRender workaround above?

  was:
I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.

In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.

{code}
public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

}


@Component
@Scope("request")
public class DAODataProvider extends SortableDataProvider {
	@Inject protected GeneralDAO dao;
	
	private Class<?> entityClass;
	
	public DAODataProvider() {
		super();
	}
}
{code}


The solution seems to be to do this:


public class DemoPage extends WebPage {
	@Inject @SpringBean DAODataProvider dataProvider;
	
	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
    	super(parameters);
		
		dataProvider.setEntityClass(UserAccount.class);
		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
    }

	@Override
	protected void onBeforeRender()
	{
		dataProvider.setEntityClass(UserAccount.class);
		super.onBeforeRender();
	}

}

Is there a good way to indicate that a SpringBean-injected object should be bound to "page" scope, so that if the same page instance is deserialized the same dependency instance is looked up? 

    
> Can a SpringBean's state be serialized?
> ---------------------------------------
>
>                 Key: WICKET-4655
>                 URL: https://issues.apache.org/jira/browse/WICKET-4655
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-spring
>    Affects Versions: 1.5.7
>         Environment: Windows/Linux, JDK 6, Spring 3.1.0
>            Reporter: Shu
>
> I have Wicket page containing a SpringBean-injected object that contains state. This state is not serialized and hence not available when the user revisits the page via the Back button.
> In the example below, the DAODataProvider object has an entityClass property. When the user goes back to the page via the Back button, the dataProvider and dataProvider.dao properties are available, but dataProvider.entityClass is null.
> {code}
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> }
> @Component
> @Scope("request")
> public class DAODataProvider extends SortableDataProvider {
> 	@Inject protected GeneralDAO dao;
> 	
> 	private Class<?> entityClass;
> 	
> 	public DAODataProvider() {
> 		super();
> 	}
> }
> {code}
> The solution seems to be to do this:
> public class DemoPage extends WebPage {
> 	@Inject @SpringBean DAODataProvider dataProvider;
> 	
> 	public DemoPage(final PageParameters parameters) throws ClassNotFoundException, IntrospectionException {
>     	super(parameters);
> 		
> 		dataProvider.setEntityClass(UserAccount.class);
> 		add(new CRUDPanel("panel", UserAccount.class, dataProvider));
>     }
> 	@Override
> 	protected void onBeforeRender()
> 	{
> 		dataProvider.setEntityClass(UserAccount.class);
> 		super.onBeforeRender();
> 	}
> }
> Is there a good way to indicate that a SpringBean-injected object should have its non-injected properties serialized, to avoid doing the onBeforeRender workaround above?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira