On 7/14/06, Matthias Wessendorf <[EMAIL PROTECTED]> wrote:
dunno the ticket,
but provide your solution here (describtion) and the code at jira
The solution is basically to override the facesContext method in
MyFacesGenericPortlet.
protected FacesContext facesContext(PortletRequest
request,PortletResponse response) {
if (FileUpload.isMultipartContent((HttpServletRequest)
request)) {
String strMaxSize = getPortletConfig().getInitParameter(
MAX_FILE_SIZE);
String strThreshold =
getPortletConfig().getInitParameter(
THRESHOLD_SIZE);
String strRepo = getPortletConfig().getInitParameter(
REPOSITORY_PATH);
MultipartRequestWrapper wrapper = new
MultipartRequestWrapper(
(HttpServletRequest) request,
resolveSize(strMaxSize,
uploadMaxFileSize),
resolveSize(strThreshold,
uploadThresholdSize),
strRepo);
return new FileUploadFacesContext(getPortletContext(),
request,
response, wrapper);
} else {
return super.facesContext(request, response);
}
}
If a multipart request is detected the MultipartRequestWrapper is used
inside a custom FacesContext. In this flavor of FacesContext the
getExternalContext().getRequest() returns the MultipartRequestWrapper;
It stills gets the session values from portletSession.
There were a few other small changes to avoid ClassCastExceptions but
that's basically it.
Ryan
On 7/14/06, Ryan Wynn <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a solution that enables me to upload files using
> t:inputFileUpload inside a JSR-168 portlet.
>
> The only configuration change that needs to be made is that you must
> refer to my extension of MyFacesGenericPortlet in portlet.xml.
> Everything else can remain that same.
>
> I've tested it in WebSphere Portal 5.1 with myfaces-everything-1.1.1.
>
> Has this solution already be submitted? I saw something about using
> Portlet Filters. This one doesn't use any filters. If not please let
> me know which ticket I should attach to.
>
> Thanks,
> Ryan
>
--
Matthias Wessendorf
further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com