Stephan,

I think this is the same design mistake that was made by the Servlet API.
Let me have a look at the related EG discussion.

Best regards,
Jerome  

> -----Message d'origine-----
> De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Envoyé : jeudi 6 mars 2008 10:30
> À : discuss@restlet.tigris.org
> Objet : Re: first send headers, than create message body?
> 
> Hello Jerome,
> 
> yes, I know this way and using it.
> But for this case the JAX-RS proposal requires, that it is 
> possible to 
> create the http headers and the body in *the same* method.
> 
> public void methodname(StreamingOutput so, ...)
> {
>     Response jaxRsResponse = ...
>     // create response headers.
>     OutputStream os = do.getOutputStream(response); // this 
> should send 
> the http headers from the jaxRsResponse.
>     os.write(...);
>     os.write(...);
>     os.write(...);
>     os.write(...);
> }
> 
> This should all happens in *one* method.
> 
> best regards
>    Stephan
> >> is it possible to code in Restlet, that I create a message 
> >> head, than start to send it and afterwoods start to create 
> >> the entity data (the message body) in one method, without 
> >> creating a new Representation subclass that does it?
> >> I think not, or does I miss something?
> >>     
> > This is easily possible by creating a subclass of 
> OutputRepresentation.
> >
> > response.setEntity(new OutputRepresentation(){
> >     public void write(OutputStream os){
> >             os.write(...)
> >             os.write(...)
> >             os.write(.. perhaps large data ..)
> >             os.write(...)
> >             os.write(.. more large data ..)
> >             os.write(...)
> >             os.write(...)
> >     };
> > });
> >   

Reply via email to