Do we still need the UtilJ2eeCompat class?

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

Do we still need the UtilJ2eeCompat class?

Jacopo Cappellato-4
After the cleanup I did today (where I fixed some thread safe issues and removed some unused methods/fields) this class is very easy to read:
it is used to figure out, by checking the servlet container implementation, if the response should be sent using a Writer or a OutputStream; it uses a Writer for Tomcat, Websphere, Jetty, Orion, Jrun, Tradecity and it uses an OutputStream for all the other servlet containers.

However accordingly to the Servlet api:

ServletResponse.getWriter():
          Returns a PrintWriter object that can send character text to the client.
ServletResponse.getOutputStream():
          Returns a ServletOutputStream suitable for writing binary data in the response.

it seems that getWriter() should always be used (for html pages) in all the containers, not just Tomcat, Websphere, Jetty, Orion, Jrun, Tradecity.
Are we sure that these are the only ones that require a Writer? Or it is just because no one tried to run OFBiz in a different container? Maybe the class was useful in the early days of OFBiz but it is no more necessary.
In my opinion we could remove this class and always set a writer as a response.

WDYT?

Jacopo

Reply | Threaded
Open this post in threaded view
|

Re: Do we still need the UtilJ2eeCompat class?

Jacopo Cappellato-3
In rev 1622976 I have removed the class and cleaned up the client code that was using it.

Jacopo

On Sep 3, 2014, at 11:30 AM, Jacopo Cappellato <[hidden email]> wrote:

> After the cleanup I did today (where I fixed some thread safe issues and removed some unused methods/fields) this class is very easy to read:
> it is used to figure out, by checking the servlet container implementation, if the response should be sent using a Writer or a OutputStream; it uses a Writer for Tomcat, Websphere, Jetty, Orion, Jrun, Tradecity and it uses an OutputStream for all the other servlet containers.
>
> However accordingly to the Servlet api:
>
> ServletResponse.getWriter():
>          Returns a PrintWriter object that can send character text to the client.
> ServletResponse.getOutputStream():
>          Returns a ServletOutputStream suitable for writing binary data in the response.
>
> it seems that getWriter() should always be used (for html pages) in all the containers, not just Tomcat, Websphere, Jetty, Orion, Jrun, Tradecity.
> Are we sure that these are the only ones that require a Writer? Or it is just because no one tried to run OFBiz in a different container? Maybe the class was useful in the early days of OFBiz but it is no more necessary.
> In my opinion we could remove this class and always set a writer as a response.
>
> WDYT?
>
> Jacopo
>