-
1. Re: Seam component especification
piklos Oct 24, 2011 9:16 AM (in response to tschleuss)Make a simple producer class like so:
public class LoginManagerProducer @Produces @SessionScoped public LoginManager getLoginManager(){ LoginManager l = new LoginManager(); l.setKeystore('/certs/certs.jks'); l.setKeystorePassword('password'); .... return l; }
-
2. Re: Seam component especification
tschleuss Oct 24, 2011 12:00 PM (in response to tschleuss)Thanks!
Seam 3 have great new features,
but others such as components.xml and pages.xml
were not good. -
3. Re: Seam component especification
tschleuss Oct 24, 2011 12:23 PM (in response to tschleuss)Other question, theres any way to set this values from seam-beans.xml ??
For example, i'm create LoginProducerManager but i'm want to do it more dynamic
like this, but it doensn't work.My producer class:
public class LoginManagerProducer { @Produces @SessionScoped private LoginManager loginManager = new LoginManager(); }
My seam-bean.xml
<producer:LoginManagerProducer> <ee:replaces/> <producer:loginManager> <ee:modifies> <ee:Named>loginManager</ee:Named> <sso:setWebserviceURL>https://localhost:8090/services/v1_0_0/</sso:setWebserviceURL> <sso:setKeystore>/certs/certs.jks</sso:setKeystore> <sso:setKeystorePassword>password</sso:setKeystorePassword> <sso:setUpdateTimeInterval>3600</sso:setUpdateTimeInterval> </ee:modifies> </producer:loginManager> </producer:LoginManagerProducer>
-
4. Re: Seam component especification
piklos Oct 24, 2011 5:43 PM (in response to tschleuss)Just by reading the example in the documentation of seam-config i think something like this should work:
<producer:LoginManagerProducer> <s:replaces> <producer:loginManager> <s:Produces/> <producer:setWebserviceURL>https://localhost:8090/services/v1_0_0/</producer:setWebserviceURL> <producer:setKeystore>/certs/certs.jks</producer:setKeystore> <producer:setKeystorePassword>password</producer:setKeystorePassword> <producer:setUpdateTimeInterval>3600</producer:setUpdateTimeInterval> </producer:loginManager> </producer:LoginManagerProducer>
Play a bit with it and yell if you have any problems.
Good luck.
-
5. Re: Seam component especification
piklos Oct 25, 2011 5:01 AM (in response to tschleuss)So ok, after a bit more looking at your example, i think that this should work:
package com.some.package; import ... public class LoginManagerProducer private String keystore; private String keystorePassword; private String webserviceURL; private Integer updateTimeInterval; @Produces @SessionScoped public LoginManager getLoginManager(){ LoginManager l = new LoginManager(); l.setKeystore(keystore); l.setKeystorePassword(keystorePassword); .... return l; }
... xmlns:a="urn:java:com.some.package" ... <a:LoginManagerProducer> <s:modifies /> <a:keystore>/certs/certs.jks</a:keystore> <a:updateTimeInterval>13</a:updateTimeInterval> <a:skeystorePassword>password</a:keystorePassword> <a:webserviceURL>https://localhost:8090/services/v1_0_0/</a:webserviceURL> </a:LoginManagerProducer>
-
6. Re: Seam component especification
tschleuss Oct 25, 2011 9:08 AM (in response to tschleuss)Yeah, the second option worked perfectly! Thanks.
I was trying to change the second-level object direct,
like first option, but i think it is not possible.Thanks again, i could understand how it works.
-
7. Re: Seam component especification
nishant_k123 Aug 7, 2012 1:00 AM (in response to tschleuss)it appears that when the bean is specified in the seam-beans.xml, the @postConstruct method is not called.
I have several instances of the same class specified in the seam-beans.xml with a different @Named (using <s:Named value="abc"/>). but it appears that the post construct on these instances are not called even though they are created correctly.
Anyone else notice this ?
-
8. Re: Seam component especification
nishant_k123 Aug 8, 2012 2:18 AM (in response to nishant_k123)I also noticed that none of the injection seems to happen for a bean created via the seam-beans.xml. Is this by design that the post construct and injection get ignored for beans created via seam-beans.xml. or is there something i am missing entirely ?>