You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by Michael Blum <bl...@apache.org> on 2004/04/08 17:51:44 UTC

Re: Content Type Bug in ServletRequestImpl.java

Jeff, I see your point. The implementation was too limiting. I have 
fixed it now.

Michael

Jeff Linwood wrote:
> Hi,
> 
> I was having a problem getting a portlet that handles file uploads to 
> work properly, so I took a look, and Pluto wasn't handling the content 
> type for an action request properly. I was getting "text/html" instead 
> of "multipart/form-data", which is what I would get through a servlet or 
> anything else.
> 
> I think that there is a bug in 
> \portal\src\java\org\apache\pluto\portalImpl\servlet\ServletRequestImpl.java, 
> line 57.
> 
> This message by Alex Rudnev 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=pluto-dev@jakarta.apache.org&msgId=1113654 
> mentioned the problem first.
> 
> In the below code, I just commented out the line for text/html, and 
> asked the servlet request for its content type. The servlet returns null 
> if its not known, rather than text/html. The portlet API java docs also 
> specify that this method returns null if the content type is unknown, 
> rather than text/html. I'm unclear as to why it appends the character 
> encoding, though.
> 
> // HttpServletRequestWrapper overlay
> 
>     public java.lang.String getContentType()
>     {
>         //String contentType = "text/html";
>         String contentType = super.getContentType();
>         if (getCharacterEncoding()!=null)
>         {
>             contentType += ";" + getCharacterEncoding();
>         }
>         return contentType;
>     }
> 
> If anyone is interested, I can share the FileUploadPortlet I am using. 
> Jeff Sackett wrote several classes for the Commons File Upload project 
> that use the ActionRequest instead of a servletRequest to handle file 
> uploads, so I used them.
> 
> Thanks,
> Jeff Linwood
> 
> 
> 



Re: Content Type Bug in ServletRequestImpl.java

Posted by Gerard Mason <pl...@gerardmason.com>.
Yes please, that will save me a few hours work!


Cheers,
Gerard.


Jeff Linwood wrote:
> Thanks! If anyone wants some file upload portlet code, let me know.
> 
> Jeff
> 
> Michael Blum wrote:
> 
>> Jeff, I see your point. The implementation was too limiting. I have 
>> fixed it now.
>>
>> Michael
>>
>> Jeff Linwood wrote:
>>
>>> Hi,
>>>
>>> I was having a problem getting a portlet that handles file uploads to 
>>> work properly, so I took a look, and Pluto wasn't handling the 
>>> content type for an action request properly. I was getting 
>>> "text/html" instead of "multipart/form-data", which is what I would 
>>> get through a servlet or anything else.
>>>
>>> I think that there is a bug in 
>>> \portal\src\java\org\apache\pluto\portalImpl\servlet\ServletRequestImpl.java, 
>>> line 57.
>>>
>>> This message by Alex Rudnev 
>>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=pluto-dev@jakarta.apache.org&msgId=1113654 
>>> mentioned the problem first.
>>>
>>> In the below code, I just commented out the line for text/html, and 
>>> asked the servlet request for its content type. The servlet returns 
>>> null if its not known, rather than text/html. The portlet API java 
>>> docs also specify that this method returns null if the content type 
>>> is unknown, rather than text/html. I'm unclear as to why it appends 
>>> the character encoding, though.
>>>
>>> // HttpServletRequestWrapper overlay
>>>
>>>     public java.lang.String getContentType()
>>>     {
>>>         //String contentType = "text/html";
>>>         String contentType = super.getContentType();
>>>         if (getCharacterEncoding()!=null)
>>>         {
>>>             contentType += ";" + getCharacterEncoding();
>>>         }
>>>         return contentType;
>>>     }
>>>
>>> If anyone is interested, I can share the FileUploadPortlet I am 
>>> using. Jeff Sackett wrote several classes for the Commons File Upload 
>>> project that use the ActionRequest instead of a servletRequest to 
>>> handle file uploads, so I used them.
>>>
>>> Thanks,
>>> Jeff Linwood
>>>
>>>
>>>
>>
>>
>>
>>
> 
> 



Re: Content Type Bug in ServletRequestImpl.java

Posted by Jeff Linwood <je...@greenninja.com>.
Thanks! If anyone wants some file upload portlet code, let me know.

Jeff

Michael Blum wrote:
> Jeff, I see your point. The implementation was too limiting. I have 
> fixed it now.
> 
> Michael
> 
> Jeff Linwood wrote:
> 
>> Hi,
>>
>> I was having a problem getting a portlet that handles file uploads to 
>> work properly, so I took a look, and Pluto wasn't handling the content 
>> type for an action request properly. I was getting "text/html" instead 
>> of "multipart/form-data", which is what I would get through a servlet 
>> or anything else.
>>
>> I think that there is a bug in 
>> \portal\src\java\org\apache\pluto\portalImpl\servlet\ServletRequestImpl.java, 
>> line 57.
>>
>> This message by Alex Rudnev 
>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=pluto-dev@jakarta.apache.org&msgId=1113654 
>> mentioned the problem first.
>>
>> In the below code, I just commented out the line for text/html, and 
>> asked the servlet request for its content type. The servlet returns 
>> null if its not known, rather than text/html. The portlet API java 
>> docs also specify that this method returns null if the content type is 
>> unknown, rather than text/html. I'm unclear as to why it appends the 
>> character encoding, though.
>>
>> // HttpServletRequestWrapper overlay
>>
>>     public java.lang.String getContentType()
>>     {
>>         //String contentType = "text/html";
>>         String contentType = super.getContentType();
>>         if (getCharacterEncoding()!=null)
>>         {
>>             contentType += ";" + getCharacterEncoding();
>>         }
>>         return contentType;
>>     }
>>
>> If anyone is interested, I can share the FileUploadPortlet I am using. 
>> Jeff Sackett wrote several classes for the Commons File Upload project 
>> that use the ActionRequest instead of a servletRequest to handle file 
>> uploads, so I used them.
>>
>> Thanks,
>> Jeff Linwood
>>
>>
>>
> 
> 
> 
>