Re: [Resin-interest] php.ini and include_path

2010-08-30 Thread Alexandre Bertails
2010/8/27 Emil Ong e...@caucho.com:
 Hi Alexandre,

 Sorry, I still don't understand one point.  What are you expecting
 ${RESIN} to be?  Are you setting this as an environment variable or is
 that something you think the container should set?

 Aside from that point, relative include paths are interpreted relative
 to the root directory of the webapp, so that might help in this
 particular case.  For example, if your include path was:

 include_path=WEB-INF/php

I've tried this solution but it doesn't work. That would be perfect if
it worked out but this is not the case.

Actually, the case where you set a relative path (without a '.') is
not specified in the semantics of include_path [1]. After some tests,
the way it's implemented in Quercus is that such a path will be
concatenated with the getcwd() of the file invoking the require_once.

So there are only two solutions there:
* use an absolute path (which of course we don't want)
* have a way to specify a path related to where the application is
deployed. I'm searching for a solution like that and that's what I
meant by writing something like ${ABSOLUTE_PATH_WHERE_THE
WAR_IS_DEPLOYED}/webapps/WEB-INF/php.

Does it make sense or am I going to the wrong direction?

Alexandre Bertails, W3C Systems Team.

[1] http://www.php.net/manual/en/ini.core.php#ini.include-path


 This would pick up all the php files in your webapps WEB-INF/php
 directory.

 Hope that helps,
 Emil

 On Thu, Aug 26, 2010 at 07:29:11PM -0400, Alexandre Bertails wrote:
 2010/8/26 Emil Ong e...@caucho.com:
  Hi,
 
  I don't think we support the ${RESIN} variable in php.ini at the moment,
  but out of curiosity, why do you need the Resin root if you're using
  Jetty?

 I'm trying to write a Java/Scala wrapper for some existing code in PHP.

 The first step is to make everything to work without modification in
 the existing code. There are plenty of require_once-like functions
 spread all over the code and I need to modify include_path because of
 them.

 I have found some examples on the web (basically in the forums) where
 you can set variables directly in web.xml but none of them worked
 for me, I don't know why. If you have an example using ${RESIN},
 that's of course a perfect workaround.

 Alexandre Bertails, W3C Systems, Team.

 
  Thanks,
  Emil
 
  On Wed, Aug 25, 2010 at 07:57:48PM -0400, Alexandre Bertails wrote:
  Hi all,
 
  I have this worky partial web.xml:
  [[
    servlet
      servlet-nameQuercus Servlet/servlet-name
      
  servlet-classcom.caucho.quercus.servlet.QuercusServlet/servlet-class
      init-param
        param-nameini-file/param-name
        param-valueWEB-INF/php.ini/param-value
      /init-param
    /servlet
  ]]
 
  and this WEB-INF/php.ini:
  [[
  include_path = .:${RESIN}/webapps/WEB-INF/php
  ]]
 
  The include_path value is set as expected.
 
  The question is: how can I make Quercus to interpret ${RESIN}?
 
  (I'm using Quercus 4.0.10 and Jetty.)
 
  Alexandre Bertails, W3C Systems Team.
 
 
  ___
  resin-interest mailing list
  resin-interest@caucho.com
  http://maillist.caucho.com/mailman/listinfo/resin-interest
 
 
  ___
  resin-interest mailing list
  resin-interest@caucho.com
  http://maillist.caucho.com/mailman/listinfo/resin-interest
 


 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest


 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] java.io.IOException: can't clear response after writing headers

2010-08-30 Thread Aaron Freeman
  This is unrelated, but worth mentioning to other people converting 
over from Resin 3.0.x:

We had this problem when converting over from Resin 3.0.x.:   The 
problem is that Resin 4.0.x now outputs white space in each iteration of 
c:forEach .../c:forEach loops, and other places where Resin 3.0.x 
did not.  That causes problems with Resin 3.0.x and older code that has 
c:redirect, sendRedirect, jsp:forward, response.reset(), and any other 
calls that rely on the response not being committed.   The reason is 
that the buffer used to cache up a response prior to writing out to 
response's outputStream can fill up very quickly compared with earlier 
versions and causes the response to commit very fast (with a ton of 
white space to boot).

The fix is, if you are doing jsp:include page= with loops in it, to do:

c:import url= var=debug .. /c:import

instead.  Instead of the output being dumped directly to response's 
output buffer, the white space will go to a variable that you can ignore 
(and comes in handy a development environment).

If you are not including/importing anything and have a bunch of 
c:forEach in your code prior to your redirect/clear/reset, try 
throwing those in a second JSP and doing a c:import .. var=debug in 
order to trap the white space.

This way your response.buffer won't commit prematurely and you can still 
do redirects/resets.

I know this is unrelated but we had issues with it, and I thought I 
would post it for others searching for redirect/clear/reset issues.

Aaron


On 8/30/2010 10:33 AM, Morawetz, Martin wrote:
 wMorawetz, Martin wrote:
 Hi all,

 Some JSPs produce following error Stacktrace in our Java-log:

 java.io.IOException: can't clear response after writing headers

 at
 com.caucho.server.http.ResponseStream.clear(ResponseStream.java:233)
 at

 com.caucho.server.http.HttpServletResponseImpl.getOutputStream(HttpServ
 letResponseImpl.java:137)
 :

 :

 The Exception gets thrown at the line

 sosOut = response.getOutputStream();

 This code work on all other resin installations (for years now)

 The only difference to our other resin installations that I'm aware
 of,
 is that resin and apache are on two separate machines now.

 We use Resin Pro 4.0.9.

 Any ideas what might cause this exception?

 Resin is being more strict about conforming to the servlet/JSP spec.

 Is there an output flush() anywhere before that clear()?

 -- Scott
 Yes there is, and removing the out.flush() resolves the issue.
 Was that 'being more strict' a recent change? The same code
 works on a different server with Resin 4.0.0 installed.

 Regards, Martin

 The information in this e-mail and in any attachments is confidential and 
 intended solely
 for the attention and use of the named addressee(s). This information may be 
 subject to legal,
 professional or other privilege and further distribution of it is strictly 
 prohibited without
 our authority. If you are not the intended recipient, you are not authorised 
 to and must not
 disclose, copy, distribute, or retain this message or any part of it, and 
 should notify us
 immediately.

 This footnote also confirms that this email has been automatically scanned 
 for the presence
 of computer viruses, profanities and certain file types.



 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest





___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] java.io.IOException: can't clear response after writing headers

2010-08-30 Thread Scott Ferguson
Morawetz, Martin wrote:

 Resin is being more strict about conforming to the servlet/JSP spec.

 Is there an output flush() anywhere before that clear()?

 -- Scott
 

 Yes there is, and removing the out.flush() resolves the issue.
 Was that 'being more strict' a recent change? The same code
 works on a different server with Resin 4.0.0 installed.
   
We passed the Servlet 3.0 TCK in 4.0.4, so the change would have 
happened before then.

-- Scott

 Regards, Martin

 The information in this e-mail and in any attachments is confidential and 
 intended solely 
 for the attention and use of the named addressee(s). This information may be 
 subject to legal, 
 professional or other privilege and further distribution of it is strictly 
 prohibited without 
 our authority. If you are not the intended recipient, you are not authorised 
 to and must not 
 disclose, copy, distribute, or retain this message or any part of it, and 
 should notify us 
 immediately.

 This footnote also confirms that this email has been automatically scanned 
 for the presence 
 of computer viruses, profanities and certain file types.



 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest

   



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] php.ini and include_path

2010-08-30 Thread Emil Ong
Hi Alexandre,

That's much clearer -- I got thrown by the word RESIN and that you
planned to use Jetty.  Unfortunately the variable isn't available at
in php.ini at the moment.  Of course you're right that the include
path is relative to the current script, so that's not a real solution.
I've filed a bug to address the issue:

http://bugs.caucho.com/view.php?id=4192

Best,
Emil

On Mon, Aug 30, 2010 at 01:39:41PM -0400, Alexandre Bertails wrote:
 2010/8/27 Emil Ong e...@caucho.com:
  Hi Alexandre,
 
  Sorry, I still don't understand one point.  What are you expecting
  ${RESIN} to be?  Are you setting this as an environment variable or is
  that something you think the container should set?
 
  Aside from that point, relative include paths are interpreted relative
  to the root directory of the webapp, so that might help in this
  particular case.  For example, if your include path was:
 
  include_path=WEB-INF/php
 
 I've tried this solution but it doesn't work. That would be perfect if
 it worked out but this is not the case.
 
 Actually, the case where you set a relative path (without a '.') is
 not specified in the semantics of include_path [1]. After some tests,
 the way it's implemented in Quercus is that such a path will be
 concatenated with the getcwd() of the file invoking the require_once.
 
 So there are only two solutions there:
 * use an absolute path (which of course we don't want)
 * have a way to specify a path related to where the application is
 deployed. I'm searching for a solution like that and that's what I
 meant by writing something like ${ABSOLUTE_PATH_WHERE_THE
 WAR_IS_DEPLOYED}/webapps/WEB-INF/php.
 
 Does it make sense or am I going to the wrong direction?
 
 Alexandre Bertails, W3C Systems Team.
 
 [1] http://www.php.net/manual/en/ini.core.php#ini.include-path
 
 
  This would pick up all the php files in your webapps WEB-INF/php
  directory.
 
  Hope that helps,
  Emil
 
  On Thu, Aug 26, 2010 at 07:29:11PM -0400, Alexandre Bertails wrote:
  2010/8/26 Emil Ong e...@caucho.com:
   Hi,
  
   I don't think we support the ${RESIN} variable in php.ini at the moment,
   but out of curiosity, why do you need the Resin root if you're using
   Jetty?
 
  I'm trying to write a Java/Scala wrapper for some existing code in PHP.
 
  The first step is to make everything to work without modification in
  the existing code. There are plenty of require_once-like functions
  spread all over the code and I need to modify include_path because of
  them.
 
  I have found some examples on the web (basically in the forums) where
  you can set variables directly in web.xml but none of them worked
  for me, I don't know why. If you have an example using ${RESIN},
  that's of course a perfect workaround.
 
  Alexandre Bertails, W3C Systems, Team.
 
  
   Thanks,
   Emil
  
   On Wed, Aug 25, 2010 at 07:57:48PM -0400, Alexandre Bertails wrote:
   Hi all,
  
   I have this worky partial web.xml:
   [[
     servlet
       servlet-nameQuercus Servlet/servlet-name
       
   servlet-classcom.caucho.quercus.servlet.QuercusServlet/servlet-class
       init-param
         param-nameini-file/param-name
         param-valueWEB-INF/php.ini/param-value
       /init-param
     /servlet
   ]]
  
   and this WEB-INF/php.ini:
   [[
   include_path = .:${RESIN}/webapps/WEB-INF/php
   ]]
  
   The include_path value is set as expected.
  
   The question is: how can I make Quercus to interpret ${RESIN}?
  
   (I'm using Quercus 4.0.10 and Jetty.)
  
   Alexandre Bertails, W3C Systems Team.
  
  
   ___
   resin-interest mailing list
   resin-interest@caucho.com
   http://maillist.caucho.com/mailman/listinfo/resin-interest
  
  
   ___
   resin-interest mailing list
   resin-interest@caucho.com
   http://maillist.caucho.com/mailman/listinfo/resin-interest
  
 
 
  ___
  resin-interest mailing list
  resin-interest@caucho.com
  http://maillist.caucho.com/mailman/listinfo/resin-interest
 
 
  ___
  resin-interest mailing list
  resin-interest@caucho.com
  http://maillist.caucho.com/mailman/listinfo/resin-interest
 
 
 
 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] php.ini and include_path

2010-08-30 Thread Alexandre Bertails
2010/8/30 Emil Ong e...@caucho.com:
 Hi Alexandre,

 That's much clearer -- I got thrown by the word RESIN and that you
 planned to use Jetty.  Unfortunately the variable isn't available at
 in php.ini at the moment.  Of course you're right that the include
 path is relative to the current script, so that's not a real solution.
 I've filed a bug to address the issue:

 http://bugs.caucho.com/view.php?id=4192

And the choice of the constant is perfect :-)

Thanks for having filled this report (I was not sure if it was actually a bug).

Alexandre Bertails, W3C Systems Team.


 Best,
 Emil

 On Mon, Aug 30, 2010 at 01:39:41PM -0400, Alexandre Bertails wrote:
 2010/8/27 Emil Ong e...@caucho.com:
  Hi Alexandre,
 
  Sorry, I still don't understand one point.  What are you expecting
  ${RESIN} to be?  Are you setting this as an environment variable or is
  that something you think the container should set?
 
  Aside from that point, relative include paths are interpreted relative
  to the root directory of the webapp, so that might help in this
  particular case.  For example, if your include path was:
 
  include_path=WEB-INF/php

 I've tried this solution but it doesn't work. That would be perfect if
 it worked out but this is not the case.

 Actually, the case where you set a relative path (without a '.') is
 not specified in the semantics of include_path [1]. After some tests,
 the way it's implemented in Quercus is that such a path will be
 concatenated with the getcwd() of the file invoking the require_once.

 So there are only two solutions there:
 * use an absolute path (which of course we don't want)
 * have a way to specify a path related to where the application is
 deployed. I'm searching for a solution like that and that's what I
 meant by writing something like ${ABSOLUTE_PATH_WHERE_THE
 WAR_IS_DEPLOYED}/webapps/WEB-INF/php.

 Does it make sense or am I going to the wrong direction?

 Alexandre Bertails, W3C Systems Team.

 [1] http://www.php.net/manual/en/ini.core.php#ini.include-path

 
  This would pick up all the php files in your webapps WEB-INF/php
  directory.
 
  Hope that helps,
  Emil
 
  On Thu, Aug 26, 2010 at 07:29:11PM -0400, Alexandre Bertails wrote:
  2010/8/26 Emil Ong e...@caucho.com:
   Hi,
  
   I don't think we support the ${RESIN} variable in php.ini at the moment,
   but out of curiosity, why do you need the Resin root if you're using
   Jetty?
 
  I'm trying to write a Java/Scala wrapper for some existing code in PHP.
 
  The first step is to make everything to work without modification in
  the existing code. There are plenty of require_once-like functions
  spread all over the code and I need to modify include_path because of
  them.
 
  I have found some examples on the web (basically in the forums) where
  you can set variables directly in web.xml but none of them worked
  for me, I don't know why. If you have an example using ${RESIN},
  that's of course a perfect workaround.
 
  Alexandre Bertails, W3C Systems, Team.
 
  
   Thanks,
   Emil
  
   On Wed, Aug 25, 2010 at 07:57:48PM -0400, Alexandre Bertails wrote:
   Hi all,
  
   I have this worky partial web.xml:
   [[
     servlet
       servlet-nameQuercus Servlet/servlet-name
       
   servlet-classcom.caucho.quercus.servlet.QuercusServlet/servlet-class
       init-param
         param-nameini-file/param-name
         param-valueWEB-INF/php.ini/param-value
       /init-param
     /servlet
   ]]
  
   and this WEB-INF/php.ini:
   [[
   include_path = .:${RESIN}/webapps/WEB-INF/php
   ]]
  
   The include_path value is set as expected.
  
   The question is: how can I make Quercus to interpret ${RESIN}?
  
   (I'm using Quercus 4.0.10 and Jetty.)
  
   Alexandre Bertails, W3C Systems Team.
  
  
   ___
   resin-interest mailing list
   resin-interest@caucho.com
   http://maillist.caucho.com/mailman/listinfo/resin-interest
  
  
   ___
   resin-interest mailing list
   resin-interest@caucho.com
   http://maillist.caucho.com/mailman/listinfo/resin-interest
  
 
 
  ___
  resin-interest mailing list
  resin-interest@caucho.com
  http://maillist.caucho.com/mailman/listinfo/resin-interest
 
 
  ___
  resin-interest mailing list
  resin-interest@caucho.com
  http://maillist.caucho.com/mailman/listinfo/resin-interest
 


 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest


 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest