Hi Judy,
I want to give a help and try to fix this issue, but I need your help. Whether users like to use s:fileUpload or ice:inputFile in their Seam-ICEfaces projects, it totally doesn't influence they like ICEfaces components. I think using ice:inputFile in Seam-ICEfaces is a little tricky, especially in EJB and conversation.
I tested s:fileUpload, and found some problem in FileUploadRendererBase.java as shown partial codes below. Why the request object is not a instance of MultipartRequest? Maybe, ICEfaces form submitting changes the ServletRequest? Could you give me some analysis on it? Thanks a lot.
protected void doDecode(FacesContext context, UIComponent component)
{
UIFileUpload fileUpload = (UIFileUpload) component;
ServletRequest request = (ServletRequest) context.getExternalContext().getRequest();
if (!(request instanceof MultipartRequest))
{
request = unwrapMultipartRequest(request);
}
if (request instanceof MultipartRequest)
{
MultipartRequest multipartRequest = (MultipartRequest) request;
........
}
}
/**
- Finds an instance of MultipartRequest wrapped within a request or its
- (recursively) wrapped requests.
*/
private static ServletRequest unwrapMultipartRequest(ServletRequest request)
{
while (!(request instanceof MultipartRequest))
{
boolean found = false;
for (Method m : request.getClass().getMethods())
{
if (ServletRequest.class.isAssignableFrom(m.getReturnType())
&& m.getParameterTypes().length == 0)
{
try
{
request = (ServletRequest) m.invoke(request);
found = true;
break;
}
catch (Exception ex)
{ /* Ignore, try the next one */
}
}
}
if (!found)
{
for (Field f : request.getClass().getDeclaredFields())
{
if (ServletRequest.class.isAssignableFrom(f.getType()))
{
try
{
request = (ServletRequest) f.get(request);
}
catch (Exception ex)
{ /* Ignore */
}
}
}
}
if (!found) break;
}
return request;
}
Not sure why we would integrate this component. Just use <ice:inputFile> without the progress Bar. (pretty much does the same thing as this s component). Most issues arising from <ice:inputFile> are due to progressBar...but they have all been resolved in ICEfaces-1.7.1 (other than for jboss-4.2.3.GA which we are now working on and has just been released).