-
1. Re: Tomahawk File Upload
soshah Jul 28, 2006 9:34 AM (in response to angelo.dangelo)Angelo-
You are right. The JSF approach does not work in the portal environment. Try the org.apache.commons.fileupload.portlet.PortletFileUpload approach in your portlet. Here is some sample code to get you startedimport org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.portlet.PortletFileUpload; /** * * */ private void processAttachments(ActionRequest req) throws Exception { DiskFileItemFactory factory = new DiskFileItemFactory(); PortletFileUpload upload = new PortletFileUpload(factory); //Merge with upload fields for (Iterator i = upload.parseRequest(req).iterator(); i.hasNext();) { FileItem item = (FileItem)i.next(); if (item.isFormField()) { //if it's form field just add it to request params map //TODO:Be aware that this adds single value as we won't have multiply values in new topic form for now... req.getParameterMap().put(item.getFieldName(), new String[]{item.getString()}); } else { //process the FileItem here....this is your attachment //data } } }
Thanks
Sohil -
2. Re: Tomahawk File Upload
angelo.dangelo Jul 31, 2006 6:54 AM (in response to angelo.dangelo)Hi Sohil (thanks for the answer),
but any existing Portal/Portlets Bridge lets me able to use Tomahawk?
Angelo -
3. Re: Tomahawk File Upload
rashmi_ceru1 Aug 30, 2009 3:37 AM (in response to angelo.dangelo)Hi ,
when we are trying to set the values to requestparameter map i am getting exception
Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableMap.put(Collections.java:1286)
at
javax.portlet.faces.HelloJSFPortlet.processAttachments(HelloJSFPortlet.java:158)
at
javax.portlet.faces.HelloJSFPortlet.processAction(HelloJSFPortlet.java:44)
... 197 more
i am using org.apache.myfaces.component.html.util.ExtensionsFilter as filter .
can any you please let me know how to solve this problem .
this is place where i am getting exception .
req.getParameterMap().put(item.getFieldName(), new String[]{item.getString()});