[JBoss Seam] - Context listener
by tzman
As a learning/debug helper I am trying to catch events when components are stored/removed from any context. org.jboss.seam.preSetVariable and the like do pretty much what I am looking for, but I would like to set this in a more coarse grained manner. As it is now, to use this I need to create a method for each event and for each variable I want to catch an event on. I would like to declare the components I want to catch events on and receive the events on the same listener.
I could programatically add the observer when I see a component I am interested in but when the method is called I will not know which component it is for as there is no parameter passed to these methods.
As an example if I have the following:
| @Name( "personAction" )
| @Scope( ScopeType=PAGE )
| public class PersonAction implements Serializable
| {
| @In( scope=ScopeType.SESSION )
| Person person;
|
| ...
| }
|
And a listener something like:
| public presetVariable( Event someEvent )
| {
| log.debug( "Event variable:" + someEvent.getVariable() );
| log.debug( "Component:" + someEvent.getComponent() );
| log.debug( "Contect type:" + someEvent.getContextType() );
| }
|
If somehow, in a yet determined way, I configure this component as an Observer for my event. I would like notification of when "personAction" and "person" have been added to context and removed from context and which context that is.
I am not sure if there is already a means to do this, so any insight is appreciated.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048023#4048023
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048023
18 years, 11 months
[JBoss Seam] - Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
by shushamen
I have the same problem, using Rational Software Architect 7 - WAS 6.1 runtime.
I think is a problem with the IBM -JSF implementation, I was doing some decompile over com.ibm.ws.webcontainer_2.0.0.jar , but can't found the issue, is something related with this code :
obj = (ApplicationFactory)FactoryFinder.getFactory("javax.faces.application.ApplicationFactory");
application = (ApplicationImpl)((ApplicationFactory) (obj)).getApplication();
The second line give the cast exception, I think they (IBM) have to cast to (Application) not to (ApplicationImpl) because org.jboss.seam.jsf.SeamApplication11 extend for application.
But to try to find a workaround for this I need more time and help from the JBoss Seam.
I really hope that someone or me can find a workaround or make a patch, so people out there can use Seam on WAS 6.1 with the IBM JSF implementation.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048022#4048022
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048022
18 years, 11 months
[JBoss Seam] - Re: Simplest <s:fileUpload> usage
by landrew
This solution of reading uploaded file thru byte[] works. Thank you for sharing.
However, I wanted to use a different approach using Backing Bean wrapping org.apache.myfaces.custom.fileupload.UploadedFile component.
In my attempt as stated, I found that the Backing Bean was instantiated ok, the file upload Browse and Submit buttons were generated ok but when Submit is clicked, the JSF failed to inject the multipart UploadedFile to it, so the Action listener class received Backing Bean with a null UploadedFile object.
The Backing Bean is a Seam component but the UploadedFile is JSF multipart/form-data component.
I would appreciate any help shed some light in this.
Thanks - landrew.
Code snippets as shown:
fileUpload.xhtml:
..
<h:form enctype="multipart/form-data" >
Browse and Pick a File
<t:inputFileUpload value="#{uploadBean.uploadedFile}" storage="file" />
<h:commandButton value="Submit" action="#{uploader.upload}" />
</h:form>
..
UploadBean.java (Backing Bean)
..
@Name("uploadBean")
@Scope(SESSION)
public class UploadBean
{
@In(required=false)
private UploadedFile uploadedFile;
..
UploadAction.java (Action class JSF Listener)
..
@Name("uploader")
@Scope(EVENT)
public class UploadAction implements UploadActionIF
{
private final String CLAZZ = this.getClass().toString();
/**
* Uploaded file wrapper object.
*/
@In(required = false)
private UploadBean uploadBean;
..
public String upload()
{
..
Other components:
- jboss-4.0.5.GA Server
- WEB-INF/tomahawk.taglib.xml
- tomahawk-1.1.5.jar
- jboss-seam.jar thru Seam-Version: 1.2.0.PATCH1
- jsf-facelets.jar Implementation-Version: 1.1.12
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048021#4048021
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048021
18 years, 11 months