We want to customise org.richfaces.event.FileUploadEvent to cater to one of our application needs. I have extended above class as CustomFileUploadEvent and checking to see if the corresponding object is getting instantiated(entering constructor) on calling fileUploadListener="#{fileUploadBean.uploadListener}" using rich faces file upload tag. <rich:fileUpload id="upload" fileUploadListener="#{fileUploadBean.uploadListener}" immediateUpload="true" addControlLabel="Add" >
<a4j:ajax event="uploadcomplete" execute="@none" onbegin="disableButtons()"
oncomplete="enableButtons()" /> </rich:fileUpload>
CustomFileUploadEvent.java file: import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponent;
@FacesComponent(value="CustomFileUploadEvent")
public class CustomFileUploadEvent extends org.richfaces.event.FileUploadEvent {
public CustomFileUploadEvent(UIComponent component, UploadedFile uploadedFile) {
super(component, uploadedFile); // TODO Auto-generated constructor stub
}
}
In FileUploadBean.java, We have below listener method. If We use richfaces FileUploadEvent, listener method gets called correctly. But if we use CustomFileUploadEvent, it throws javax.faces.event.AbortProcessingException //Doesn't work
// public void uploadListener(test.fileupload.CustomFileUploadEvent event) throws IOException{
//Works
public void uploadListener( org.richfaces.event.FileUploadEvent event) throws IOException{
UploadedFile item = event.getUploadedFile(); UploadFile file= new UploadFile();
file.setBytes(item.getData());
....
Am I missing any configuration in faces-config.xml or in @FacesComponent annotation in CustomFileUploadEvent.java ? |