Question About UtilJ2eeCompat.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Question About UtilJ2eeCompat.java

Adrian Crum-2
I noticed that the screen renderers call the UtilJ2eeCompat.useOutputStreamNotWriter method to determine whether to use the response's print writer or output stream. Why is that check necessary? From my understanding of the javax.servlet spec, you use a writer to send text and you use the output stream to send binary data.

-Adrian



     
Reply | Threaded
Open this post in threaded view
|

Re: Question About UtilJ2eeCompat.java

Adrian Crum-2
I might have found the answer to this. Some application servers perform better with an output stream instead of a print writer (or the other way around). If that is the reason for this code, shouldn't that be something that is configurable? Right now the choices are hard-coded in Java. Why not allow OFBiz users choose the settings most appropriate for their installation?

-Adrian

--- On Sat, 6/5/10, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Question About UtilJ2eeCompat.java
> To: [hidden email]
> Date: Saturday, June 5, 2010, 12:11 PM
> I noticed that the screen renderers
> call the UtilJ2eeCompat.useOutputStreamNotWriter method to
> determine whether to use the response's print writer or
> output stream. Why is that check necessary? From my
> understanding of the javax.servlet spec, you use a writer to
> send text and you use the output stream to send binary
> data.
>
> -Adrian
>
>
>
>      
>



Reply | Threaded
Open this post in threaded view
|

Re: Question About UtilJ2eeCompat.java

David E. Jones-2

The simple answer is that in the past not all app servers supported repeated writes to one or the other of these two options. In other words, you could write once to either one, but if you wanted to "stream" stuff through the writer or the stream you had to use the one the app server supported, and there was nothing in the spec that said which one that should be... hence the need for a compatibility layer to handle the differences in different servlet containers.

-David


On Jun 5, 2010, at 10:44 PM, Adrian Crum wrote:

> I might have found the answer to this. Some application servers perform better with an output stream instead of a print writer (or the other way around). If that is the reason for this code, shouldn't that be something that is configurable? Right now the choices are hard-coded in Java. Why not allow OFBiz users choose the settings most appropriate for their installation?
>
> -Adrian
>
> --- On Sat, 6/5/10, Adrian Crum <[hidden email]> wrote:
>
>> From: Adrian Crum <[hidden email]>
>> Subject: Question About UtilJ2eeCompat.java
>> To: [hidden email]
>> Date: Saturday, June 5, 2010, 12:11 PM
>> I noticed that the screen renderers
>> call the UtilJ2eeCompat.useOutputStreamNotWriter method to
>> determine whether to use the response's print writer or
>> output stream. Why is that check necessary? From my
>> understanding of the javax.servlet spec, you use a writer to
>> send text and you use the output stream to send binary
>> data.
>>
>> -Adrian
>>
>>
>>
>>      
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Question About UtilJ2eeCompat.java

Adrian Crum-2
David,

Thanks for the reply - that helps. I'm still curious to know if this should be configurable. Let's say an application server changes its behavior and no one remembers to change the Java code. Wouldn't it help if those settings were in a configuration file?

-Adrian

--- On Sun, 6/6/10, David E Jones <[hidden email]> wrote:

> From: David E Jones <[hidden email]>
> Subject: Re: Question About UtilJ2eeCompat.java
> To: [hidden email]
> Date: Sunday, June 6, 2010, 1:27 AM
>
> The simple answer is that in the past not all app servers
> supported repeated writes to one or the other of these two
> options. In other words, you could write once to either one,
> but if you wanted to "stream" stuff through the writer or
> the stream you had to use the one the app server supported,
> and there was nothing in the spec that said which one that
> should be... hence the need for a compatibility layer to
> handle the differences in different servlet containers.
>
> -David
>
>
> On Jun 5, 2010, at 10:44 PM, Adrian Crum wrote:
>
> > I might have found the answer to this. Some
> application servers perform better with an output stream
> instead of a print writer (or the other way around). If that
> is the reason for this code, shouldn't that be something
> that is configurable? Right now the choices are hard-coded
> in Java. Why not allow OFBiz users choose the settings most
> appropriate for their installation?
> >
> > -Adrian
> >
> > --- On Sat, 6/5/10, Adrian Crum <[hidden email]>
> wrote:
> >
> >> From: Adrian Crum <[hidden email]>
> >> Subject: Question About UtilJ2eeCompat.java
> >> To: [hidden email]
> >> Date: Saturday, June 5, 2010, 12:11 PM
> >> I noticed that the screen renderers
> >> call the UtilJ2eeCompat.useOutputStreamNotWriter
> method to
> >> determine whether to use the response's print
> writer or
> >> output stream. Why is that check necessary? From
> my
> >> understanding of the javax.servlet spec, you use a
> writer to
> >> send text and you use the output stream to send
> binary
> >> data.
> >>
> >> -Adrian
> >>
> >>
> >>
> >>       
> >>
> >
> >
> >
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Question About UtilJ2eeCompat.java

David E. Jones-2

If the app server changes wouldn't everyone want the change? Personally if I was configuring OFBiz I'd prefer to have as few configuration settings to think about instead of as many as possible to have to deal with (especially where things can be handled in the background).

Have you run into an issue where this would be needed, or is this code getting under you skin because it could be configurable but isn't?

-David


On Jun 6, 2010, at 2:31 AM, Adrian Crum wrote:

> David,
>
> Thanks for the reply - that helps. I'm still curious to know if this should be configurable. Let's say an application server changes its behavior and no one remembers to change the Java code. Wouldn't it help if those settings were in a configuration file?
>
> -Adrian
>
> --- On Sun, 6/6/10, David E Jones <[hidden email]> wrote:
>
>> From: David E Jones <[hidden email]>
>> Subject: Re: Question About UtilJ2eeCompat.java
>> To: [hidden email]
>> Date: Sunday, June 6, 2010, 1:27 AM
>>
>> The simple answer is that in the past not all app servers
>> supported repeated writes to one or the other of these two
>> options. In other words, you could write once to either one,
>> but if you wanted to "stream" stuff through the writer or
>> the stream you had to use the one the app server supported,
>> and there was nothing in the spec that said which one that
>> should be... hence the need for a compatibility layer to
>> handle the differences in different servlet containers.
>>
>> -David
>>
>>
>> On Jun 5, 2010, at 10:44 PM, Adrian Crum wrote:
>>
>>> I might have found the answer to this. Some
>> application servers perform better with an output stream
>> instead of a print writer (or the other way around). If that
>> is the reason for this code, shouldn't that be something
>> that is configurable? Right now the choices are hard-coded
>> in Java. Why not allow OFBiz users choose the settings most
>> appropriate for their installation?
>>>
>>> -Adrian
>>>
>>> --- On Sat, 6/5/10, Adrian Crum <[hidden email]>
>> wrote:
>>>
>>>> From: Adrian Crum <[hidden email]>
>>>> Subject: Question About UtilJ2eeCompat.java
>>>> To: [hidden email]
>>>> Date: Saturday, June 5, 2010, 12:11 PM
>>>> I noticed that the screen renderers
>>>> call the UtilJ2eeCompat.useOutputStreamNotWriter
>> method to
>>>> determine whether to use the response's print
>> writer or
>>>> output stream. Why is that check necessary? From
>> my
>>>> understanding of the javax.servlet spec, you use a
>> writer to
>>>> send text and you use the output stream to send
>> binary
>>>> data.
>>>>
>>>> -Adrian
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>
>>>
>>>
>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Question About UtilJ2eeCompat.java

Adrian Crum-2
It was just an something I noticed while going through the code. It's not an issue for me.

-Adrian

--- On Sun, 6/6/10, David E Jones <[hidden email]> wrote:

> From: David E Jones <[hidden email]>
> Subject: Re: Question About UtilJ2eeCompat.java
> To: [hidden email]
> Date: Sunday, June 6, 2010, 1:36 AM
>
> If the app server changes wouldn't everyone want the
> change? Personally if I was configuring OFBiz I'd prefer to
> have as few configuration settings to think about instead of
> as many as possible to have to deal with (especially where
> things can be handled in the background).
>
> Have you run into an issue where this would be needed, or
> is this code getting under you skin because it could be
> configurable but isn't?
>
> -David
>
>
> On Jun 6, 2010, at 2:31 AM, Adrian Crum wrote:
>
> > David,
> >
> > Thanks for the reply - that helps. I'm still curious
> to know if this should be configurable. Let's say an
> application server changes its behavior and no one remembers
> to change the Java code. Wouldn't it help if those settings
> were in a configuration file?
> >
> > -Adrian
> >
> > --- On Sun, 6/6/10, David E Jones <[hidden email]>
> wrote:
> >
> >> From: David E Jones <[hidden email]>
> >> Subject: Re: Question About UtilJ2eeCompat.java
> >> To: [hidden email]
> >> Date: Sunday, June 6, 2010, 1:27 AM
> >>
> >> The simple answer is that in the past not all app
> servers
> >> supported repeated writes to one or the other of
> these two
> >> options. In other words, you could write once to
> either one,
> >> but if you wanted to "stream" stuff through the
> writer or
> >> the stream you had to use the one the app server
> supported,
> >> and there was nothing in the spec that said which
> one that
> >> should be... hence the need for a compatibility
> layer to
> >> handle the differences in different servlet
> containers.
> >>
> >> -David
> >>
> >>
> >> On Jun 5, 2010, at 10:44 PM, Adrian Crum wrote:
> >>
> >>> I might have found the answer to this. Some
> >> application servers perform better with an output
> stream
> >> instead of a print writer (or the other way
> around). If that
> >> is the reason for this code, shouldn't that be
> something
> >> that is configurable? Right now the choices are
> hard-coded
> >> in Java. Why not allow OFBiz users choose the
> settings most
> >> appropriate for their installation?
> >>>
> >>> -Adrian
> >>>
> >>> --- On Sat, 6/5/10, Adrian Crum <[hidden email]>
> >> wrote:
> >>>
> >>>> From: Adrian Crum <[hidden email]>
> >>>> Subject: Question About
> UtilJ2eeCompat.java
> >>>> To: [hidden email]
> >>>> Date: Saturday, June 5, 2010, 12:11 PM
> >>>> I noticed that the screen renderers
> >>>> call the
> UtilJ2eeCompat.useOutputStreamNotWriter
> >> method to
> >>>> determine whether to use the response's
> print
> >> writer or
> >>>> output stream. Why is that check
> necessary? From
> >> my
> >>>> understanding of the javax.servlet spec,
> you use a
> >> writer to
> >>>> send text and you use the output stream to
> send
> >> binary
> >>>> data.
> >>>>
> >>>> -Adrian
> >>>>
> >>>>
> >>>>
> >>>>       
> >>>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
>
>