You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2011/09/14 11:51:56 UTC

Adding a new method in abstract class should go in Wicket.next ?

Hi,

I just filed https://issues.apache.org/jira/browse/WICKET-4052: Add
org.apache.wicket.request.Response.write(byte[], int, int) to make it
easier to write buffered data to the web response.

I guess this have to wait for Wicket.next because it is API break ?
In the patch I added this new method for all implementations of
o.a.w.request.Response which we deliver but since there could be users
providing their own impls it is not OK to add it in 1.5.x?

Please confirm.

-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: Adding a new method in abstract class should go in Wicket.next ?

Posted by Martin Grigorov <mg...@apache.org>.
I already committed the change.

At runtime ServletWebRequest is used and it delegates to
ServletOutputStream#write(byte[], int, int), so arraycopy() is not
used at all.

o.a.w.request.Response is an abstract class that hides the specifics
for the user (i.e. the user just uses getResponse().write(...)).
Most of it methods are abstract and are implemented in the
specializations (ServletWebResponse, StringResponse, NullResponse,
...).
The problem that is solved with this arraycopy is that now
#write(byte[], int, int) is not abstract and can be added in 1.5.1.
This way if the user app has custom Response implementation then it
doesn't have to add impl for #write(byte[], int, int). If the
arraycopy is inefficient then the custom impl can override it with
more efficient solution.
In Wicket.next we will make this method abstract as #write(byte[]) is,
so even the user impls will have to provide proper implementation of
this method.

On Wed, Sep 14, 2011 at 5:07 PM, tetsuo <ro...@gmail.com> wrote:
> write(byte[],int,int) has a concrete implementation even in OutputStream. I
> don't think it would be necessary to make it abstract, even in Wicket.next.
> Well, the ideal would be to make this method abstract, and write(byte[])
> concrete, since it would avoid the arraycopy overhead, but I think it would
> be a marginal gain, compared to breaking backwards compatibility.
>
>
>
> On Wednesday, September 14, 2011, Martin Grigorov <mg...@apache.org>
> wrote:
>> Emond suggested in IRC to add default impl in Response like:
>>
>> public void write(byte[] array, int offset, int length) {
>>  byte[] towrite = new byte[length];
>>  System.arraycopy(array, offset, towrite, 0, length);
>>  write(towrite);
>> }
>>
>> so it will work for 1.5.1.
>> For Wicket.next we can make it abstract as all other methods in this
> class.
>>
>> I like the approach.
>>
>> On Wed, Sep 14, 2011 at 1:11 PM, Andrea Del Bene <ad...@ciseonweb.it>
> wrote:
>>> Yes, I'm afraid we should wait for a major release to add it.
>>>>
>>>> Hi,
>>>>
>>>> I just filed https://issues.apache.org/jira/browse/WICKET-4052: Add
>>>> org.apache.wicket.request.Response.write(byte[], int, int) to make it
>>>> easier to write buffered data to the web response.
>>>>
>>>> I guess this have to wait for Wicket.next because it is API break ?
>>>> In the patch I added this new method for all implementations of
>>>> o.a.w.request.Response which we deliver but since there could be users
>>>> providing their own impls it is not OK to add it in 1.5.x?
>>>>
>>>> Please confirm.
>>>>
>>>
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: Adding a new method in abstract class should go in Wicket.next ?

Posted by tetsuo <ro...@gmail.com>.
write(byte[],int,int) has a concrete implementation even in OutputStream. I
don't think it would be necessary to make it abstract, even in Wicket.next.
Well, the ideal would be to make this method abstract, and write(byte[])
concrete, since it would avoid the arraycopy overhead, but I think it would
be a marginal gain, compared to breaking backwards compatibility.



On Wednesday, September 14, 2011, Martin Grigorov <mg...@apache.org>
wrote:
> Emond suggested in IRC to add default impl in Response like:
>
> public void write(byte[] array, int offset, int length) {
>  byte[] towrite = new byte[length];
>  System.arraycopy(array, offset, towrite, 0, length);
>  write(towrite);
> }
>
> so it will work for 1.5.1.
> For Wicket.next we can make it abstract as all other methods in this
class.
>
> I like the approach.
>
> On Wed, Sep 14, 2011 at 1:11 PM, Andrea Del Bene <ad...@ciseonweb.it>
wrote:
>> Yes, I'm afraid we should wait for a major release to add it.
>>>
>>> Hi,
>>>
>>> I just filed https://issues.apache.org/jira/browse/WICKET-4052: Add
>>> org.apache.wicket.request.Response.write(byte[], int, int) to make it
>>> easier to write buffered data to the web response.
>>>
>>> I guess this have to wait for Wicket.next because it is API break ?
>>> In the patch I added this new method for all implementations of
>>> o.a.w.request.Response which we deliver but since there could be users
>>> providing their own impls it is not OK to add it in 1.5.x?
>>>
>>> Please confirm.
>>>
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>

Re: Adding a new method in abstract class should go in Wicket.next ?

Posted by Martin Grigorov <mg...@apache.org>.
Emond suggested in IRC to add default impl in Response like:

public void write(byte[] array, int offset, int length) {
  byte[] towrite = new byte[length];
  System.arraycopy(array, offset, towrite, 0, length);
  write(towrite);
}

so it will work for 1.5.1.
For Wicket.next we can make it abstract as all other methods in this class.

I like the approach.

On Wed, Sep 14, 2011 at 1:11 PM, Andrea Del Bene <ad...@ciseonweb.it> wrote:
> Yes, I'm afraid we should wait for a major release to add it.
>>
>> Hi,
>>
>> I just filed https://issues.apache.org/jira/browse/WICKET-4052: Add
>> org.apache.wicket.request.Response.write(byte[], int, int) to make it
>> easier to write buffered data to the web response.
>>
>> I guess this have to wait for Wicket.next because it is API break ?
>> In the patch I added this new method for all implementations of
>> o.a.w.request.Response which we deliver but since there could be users
>> providing their own impls it is not OK to add it in 1.5.x?
>>
>> Please confirm.
>>
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: Adding a new method in abstract class should go in Wicket.next ?

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Yes, I'm afraid we should wait for a major release to add it.
> Hi,
>
> I just filed https://issues.apache.org/jira/browse/WICKET-4052: Add
> org.apache.wicket.request.Response.write(byte[], int, int) to make it
> easier to write buffered data to the web response.
>
> I guess this have to wait for Wicket.next because it is API break ?
> In the patch I added this new method for all implementations of
> o.a.w.request.Response which we deliver but since there could be users
> providing their own impls it is not OK to add it in 1.5.x?
>
> Please confirm.
>