Ah, forgot about that one. I'll look into it hopefully this weekend. And I'll open a bug for it.

Eelco

叶卫国 wrote:

The UploadForm class doesn't consider the encoding of request...  Can anybody 
fix it???

this is the code snippet form Tapestry:


   public void decode(HttpServletRequest request)
   {
       Map partMap = new HashMap();

       request.setAttribute(PART_MAP_ATTRIBUTE_NAME, partMap);

       // The encoding that will be used to decode the string parameters
// It should NOT be null at this point, but it may be // if the older Servlet API 2.2 is used
       String encoding = request.getCharacterEncoding();

       // DiskFileUpload is not quite threadsafe, so we create a new instance
       // for each request.

       DiskFileUpload upload = new DiskFileUpload();

       List parts = null;

       try
       {
            if (encoding != null)
               upload.setHeaderEncoding(encoding);
           parts = upload.parseRequest(request, _thresholdSize, _maxSize, 
_repositoryPath);
       }
       catch (FileUploadException ex)
       {
           throw new ApplicationRuntimeException(
               Tapestry.format("DefaultMultipartDecoder.unable-to-decode", 
ex.getMessage()),
               ex);
       }

       int count = Tapestry.size(parts);

       for (int i = 0; i < count; i++)
       {
           FileItem uploadItem = (FileItem) parts.get(i);

           if (uploadItem.isFormField())
           {
               try
               {
                   String name = uploadItem.getFieldName();
                   String value;
                   if (encoding == null)
                       value = uploadItem.getString();
                   else
                       value = uploadItem.getString(encoding);
ValuePart valuePart = (ValuePart) partMap.get(name);
                   if (valuePart != null)
                   {
                       valuePart.add(value);
                   }
                   else
                   {
                       valuePart = new ValuePart(value);
                       partMap.put(name, valuePart);
                   }
               }
               catch (UnsupportedEncodingException ex)
               {
                   throw new ApplicationRuntimeException(
                       Tapestry.format("illegal-encoding", encoding),
                       ex);
               }
           }
           else
           {
               UploadPart uploadPart = new UploadPart(uploadItem);

               partMap.put(uploadItem.getFieldName(), uploadPart);
           }
       }

   }








[EMAIL PROTECTED]
          2005-05-24
HS^甸殜X�'矈辵紗�:
y隻�ay娆夒-连�%暒璀玘b濎"�(聤鋤�澴%夐沓b曟'b�az爡�,秶憝暕輗墻簒渏亘災醶发瞶轫秵钌┹蕥渏y瀦脂←^潾2㈧炘胧+_《�l⑶gr壙i貪举〆∪�^邭)蓃EG谦櫒x%娝V壣峨甔�(悍~娻zw瓎踚��鍔薼矉玵玷�咤娝l⺋)撸�"rG谦




-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to