dev@grizzly.java.net

Re: little how-to required :)

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Tue, 27 Oct 2009 11:01:06 +0100

Hi Rama,

this is what I think you can do:

InputBuffer ib = req.getInputBuffer();
ByteChunk buffer = new ByteChunk();

while (true)
        int count = ib.doRead(buffer, req);

        if (count == -1) break;

        // parse ByteChunk
};

WBR,
Alexey.


On Oct 26, 2009, at 17:49 , rama.rama_at_tiscali.it wrote:

> hi all,
>
> i have some doubt on how i can read the content of a file
> sended via form
>
> suppose that i have something like
>
> <form
> method="post" action="blablabla" enctype="multipart/form-data">
>
> <input type="file" name="user_file" />
> <input
> type="submit" />
> </form>
>
>
> and on my mighty java application i
> have a
> GrizzlyWebServer --> GrizzlyAdapter --> service(req,res)
>
> it's
> not really clear to me how i can do that..
> basically what i want to
> achive is the ability to
> 1) detect a file upload (not based on a name
> of a hidden post var obviusly)
> 2) read all the data (binary mode, to be
> sure that i can save jpeg or stuff like that)
>
> tnx for help!
>
>
>
>
> Passa a Tiscali Tutto Incluso Light: telefono + adsl 8 Mb senza
> limiti a soli 9,95 euro al mese fino al 01/04/2010. Gratis la Sim
> Tiscali Mobile con 25 euro di traffico. L’offerta è valida solo se
> attivi entro il 29/10/09 http://abbonati.tiscali.it/telefono-adsl/prodotti/tc/tuttoincluso_light/?WT.mc_id=01fw
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>