Re: [Resin-interest] Websphere?

2008-06-28 Thread John Steel
Eric Kreiser wrote:
 even *IF *that were true (which I doubt) there is more to choosing app 
 server. 

 do you really want to go with the company that designed java's date 
 handling API's

Ouch !

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] Resin JSP include handling changed between 3.1.2 and 3.1.5

2008-05-02 Thread John Steel
Hi all,

A recent attempt to upgrade some 3.1.2 Pro servers broke them due to 
some changes in the
include handling of JSP's. The attempt was made to use 3.1.5, which 
failed.

The simplest case of what we are doing:

--
index.jsp:
%@ include file='/header.jsp' %
  table width='100%' cellPadding='0' cellSpacing='0' border='0'
tr
  td class='maintableleft' background='images/left-back.jpg'
%@ include file='/left.jsp' %
  /td
...
/tr
  /table
%@ include file='/footer.jsp' %

--
header.jsp:
%@ page import=java.util.*,
 java.text.*,
 ...%%
if (session != null) {
try {
if (request.getParameter(logout).equals(true)) {
DbAuthenticator auth = (DbAuthenticator) 
application.getAttribute(caucho.authenticator);
if (auth != null) {
auth.logout(request, response, application, 
request.getUserPrincipal());
}
session.invalidate();
response.sendRedirect(index.jsp);
}
} catch (Exception e) {
}
}
PageManager pm = new PageManager(pageContext.getOut());

pm.setName(request.getRequestURL().toString().substring(request.getRequestURL().toString().lastIndexOf('/')
 
+ 1));
DbAuthenticator auth = (DbAuthenticator) 
application.getAttribute(caucho.authenticator);
java.security.Principal user = request.getUserPrincipal();
%html

--
left.jsp:
table  border='0' cellPadding='0' cellSpacing='0' width='130'
tr
 td width='10'nbsp;/td
 td width='120'
%

if (auth.isUserInRole(request, response, getServletContext(), user, 
MANAGER)) {
out.print(trtdhr/td/tr);
pm.writeSideEntry(summary.jsp, Summary);
...
pm.writeSideEntry(prices.jsp, Prices);
}
%

DbAuthenticator is a custom child of 
com.caucho.http.security.JdbcAuthenticator. Its working fine.
The problem is, in 3.1.5 or later a visit to index.jsp results in:

java.lang.NullPointerException
at _jsp._index__jsp._jspService(left.jsp:100)
at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
at com.caucho.jsp.Page.pageservice(Page.java:578)
at 
com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:192)
at 
com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:187)
at 
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
at 
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
at 
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
at java.lang.Thread.run(Thread.java:619)

left.jsp line 100 is
if (auth.isUserInRole(request, response, getServletContext(), user, 
MANAGER)) {

If I trace auth and user they are both null at that point.

So, is there something else I should be doing, or should have been doing 
all along (possibly
related to declaring session scope etc of the variables) or is this 
really a bug?


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


[Resin-interest] Deploying a WAR to multiple webapps

2007-09-23 Thread John Steel
I know dropping a war to resin/webapps will deploy it for access with 
the default url http://localhost:8080. I have configured a few empty 
webapp locations and want to deploy variants of my war to them, such as 
http://localhost:8080/stable, http://localhost:8080/snapshot etc. Where 
do I copy the wars to in order for them to be similarly deployed please, 
or what config changes must I make to effect the same? Thanks.

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] [OT] Academic question - thread safe class vars

2007-07-06 Thread John Steel
public class MyServlet extends HttpServlet {

  private int nonThreadSafeInt = 1;
 
  public void doGet(HttpServletRequest req, HttpServletResponse res) 
throws ServletException, IOException {
nonThreadSafeInt++;
try {
  Thread.currentThread().sleep((long) Math.random() * 5000);
  nonThreadSafeInt++;
} catch (Exception e) { }   
nonThreadSafeInt++;
  ..
  }
}

I understand nonThreadSafeInt isn't thread safe. This means it must be 
shared across all instances. So whats the difference between that and 
declaring it as

  public static int nonThreadSafeInt = 1;

apart from then being able to do MyServlet.nonThreadSafeInt++; which I 
can't see a use for.

Thanks

-- John 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] Disable caching of pattern of images

2007-06-22 Thread John Steel
John Steel wrote:
 Resin 3.1.1 pro, developing under XP/Linux for production.
 I use jfreechart to create jpg graphs. My jsp correctly updates the 
 graph on disk each time its loaded, which happens via a POST with 
 params. I guarantee the jpg is always updated because I'm monitoring it 
 separately from the local drive. The problem is resin caches it so it 
 doesn't always update on the page. I have seen the web.xml's 
 cache-mapping url-pattern=*.jpg expires=1s/  which looks useful, 
 especially as I can name these chart*.jpg and leave the rest of the 
 site jpgs cached. This had no effect though. I also tried  meta 
 http-equiv=Pragma content=no-cache / in the jsp header with no effect.

 This must have been nailed by now as I'm sure I heard of it years ago on 
 the mail list. Anyone help please? Thanks.

   
More info - when deployed on linux apache/mod_caucho the problem goes 
away too, presumably there apache is serving the jpg.
Still looking for a fix please.

-- John

--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] php4 in Quercus

2007-06-14 Thread John Steel
Scott Ferguson wrote:
 Our main development goals for Quercus for the rest of the year are  
 working towards getting 100 PHP applications running on Quercus and  
 closing bugs as they're reported.  
Cool. Well I'd really appreciate news when Pligg is ok (the PHP Digg 
clone).
Its at (http://bugs.caucho.com/view.php?id=1800) and the db connect half 
works, so it might be a quickie.
Anyone else seen com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 
Query was empty. from Quercus?

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] On the subject of JSP compilation...

2007-06-01 Thread John Steel
I've been using this pattern for some time with excellent results:
%
if (user == null) {
%   
 %@ include file=/jsp/loginpanel.jsp %
%
} else {
%   
 %@ include file=/jsp/logoutpanel.jsp %
%
}
%   
I'm curious how this affects performance. In once sense, the assembled 
jsp is being changed each visit. So is it rebuilt each time? What gets 
cached?

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] What happens if you *don't* call super.init(...)?

2007-04-24 Thread John Steel
Just found (and corrected) a probable howler in a pretty busy servlet:

public void init(ServletConfig config) throws ServletException {
  super.init(config);
  sc = config.getServletContext();
  try {
env = (Context) new InitialContext().lookup(java:comp/env);
pool = (javax.sql.DataSource) env.lookup(System.getProperty(app.dbid));
  } catch (NamingException e) {
e.printStackTrace();
  }
  Locale.setDefault(Locale.ENGLISH);
  logConfPath = sc.getRealPath()+WEB-INF/log/log.properties;
}

The super.init() line was missing. We didn't notice because it was serving 
correctly, but have seen a gradual slowdown over a few
days usually cured by a restart. Could the missing line have caused it? If not, 
what bad side effects could we have expected please?

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] HELP: caucho-status duplicate hosts!

2007-03-23 Thread John Steel
Adam Allgaier wrote:
 We're having sever problems, so any help you have would be great!  I'll take 
 you to dinner!
   
We had exactly this last week, and I'm really annoyed as its sent my 
Google pagerank to 0 as they checked the site during the couple of days 
it took to fix, saw the redirection and I guess thought we were running 
some kind of scam.

You need to stop resin and apache, delete /tmp/localhost_6802 then 
restart them both.
I'd like my steak medium rare please ;-)

-- John

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] JDBC JNDI lookup fails in 3.1.0, always worked before

2007-03-17 Thread John Steel
John Steel wrote:

Please ignore this - it was a misconfig during the upgrade.

Thanks

- John

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] JDBC JNDI lookup fails in 3.1.0, always worked before

2007-03-15 Thread John Steel
Hi, more funnies moving old resin code to 3.1.0.
This, in a servlet, works with 3.0.23 and has for literally years:

  private Context env;
  private DataSource pool;
  private DataSource authPool;
  private ServletContext sc;

  public void init(ServletConfig sfg) throws ServletException {
sc = sfg.getServletContext();

try {
  env = (Context) new InitialContext().lookup(java:comp/env);
  pool = (javax.sql.DataSource) 
env.lookup(System.getProperty(app.dbid));
  authPool = (javax.sql.DataSource) 
env.lookup(System.getProperty(app.authentication.dbid));
} catch (NamingException e) {
  log.error(e);
}

with these entries in web.xml
system-property app.dbid='jdbc/customers'/
system-property app.authentication.dbid=jdbc/customer_auth/

The reason for doing it this way was to allow easy db redirection during 
development.
With 3.1.0 we get

java.lang.ClassCastException: com.caucho.naming.ContextImpl cannot be cast

on each of the env.lookups

Is there something different I need to do with 3.1.0 please?

Thanks

- John

--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] Startup differences between 3.0.23 and 3.1.0

2007-03-12 Thread John Steel
As a longtime resin user we have built up some scripts to control 
running instances, some of which fail with 3.1.0.
Specifically, in 3.0.23

 - in httpd.sh the args= isn't picked up, we used args=-Xmn100M 
-Xms500M -Xmx500M -J-Duser.timezone=Europe/London
 - a startup script (restart-a.sh) just has this line 
$RESIN_HOME/bin/httpd.sh -conf conf/resin.conf -pid resin-a.pid restart 
but 3.1.0 complains about the pid

Pointers gratefully received, Thanks.

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] Convert dir names to params (e.g. www.example.com/a/b/c - www.example.com?1=a2=b3=c)

2007-03-11 Thread John Steel
I know this was asked and answered on this list ages ago but am darned 
if I can find it!
Resin 3.0.23.

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] Using XML escapes (e.g. copy;) in resin.conf

2007-03-05 Thread John Steel
Resin 3.21 - If I add something like this system-property 
site.footer.copyright='Copyright copy; 2001-2007 example.com.'/ I get 
the error expected local reference at 'copy;' - whats wrong please?

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] contentType='x-application/xslt' - meaning hijacked?

2007-02-20 Thread John Steel
Anoop K Achuthan wrote:
 Hi John,
You can write a Response Filter  which  sets the Content type of your 
 choise.
 The filter could be added as the last filter in the chain to make sure 
 that no other
 filter is changing it's content type.

   
Thanks - I get it. However, it didn't do what was expected (this is the 
first filter I wrote though).
I see the comment, so I know its being called, and its defined after the 
xslt one in web.xml.
Should this work?

public class ContentTypeFilter implements Filter {

  private FilterConfig filterConfig;

  public void doFilter (ServletRequest request,
 ServletResponse response,
 FilterChain chain)
  {
try
{
  System.out.println (Within ContentType filter ... );

  chain.doFilter (request, response);
  response.setContentType(text/html);

} catch (Exception e) {
  e.printStackTrace();
}
  }

  public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
  } 
 
  public void destroy() {
this.filterConfig = null;
  } 

}
 -Anoop

 John Steel wrote:

   
 test.jsp here http://www.caucho.com/resin-3.1/doc/xslt-filter.xtp shows 
 you need to add this and the filter to the web-app in order for it to 
 trigger resin to performing the transformation. I'm having an issue 
 based on that example where basically I need to also control the 
 contentType for real, i.e. text/html, text/xml etc.

 How can I do this whilst still using the xsl filter please?
 The problem is in the stylesheet, if I change method=xml to 
 method=html below the contentType in the HTTP response toggles between
 Content-Type: text/xml; charset=UTF-8 and Content-Type: text/html; 
 charset=UTF-8

   xsl:output
   method=xml
   
 doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
   doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN/

 I want to retain the method=xml line but have it served as html so the 
 browser doesn't complain about missing stylesheets. But of course, as 
 soon as I try to set the contentType in the JSP I find I must leave it 
 at 'x-application/xslt' or the filter won't be applied.

  

 



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


   


-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] contentType='x-application/xslt' - meaning hijacked?

2007-02-20 Thread John Steel
Pablo Saavedra wrote:
 The filter order is defined by the filter-mapping element in the 
 web.xml. Make sure that your filter-mapping is after the xslt filter's.

 Regards.

Thanks - its like this, is this ok?

  filter filter-name='xslt' filter-class='com.caucho.filters.XsltFilter'/
  filter-mapping url-pattern='*.jsp' filter-name='xslt'/

  filter filter-name='ContentType' 
filter-class='com.otamate.pwc.web.support.ContentTypeFilter'/
  filter-mapping url-pattern='*.jsp' filter-name='ContentType'/


-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


Re: [Resin-interest] contentType='x-application/xslt' - meaning hijacked?

2007-02-20 Thread John Steel
try
{
  System.out.println (Within ContentType filter ... );

  chain.doFilter (request, response);
  ((HttpServletResponse) response).addHeader(ContentTypeFilter, 
PROCESSED);
  response.setContentType(text/html);

} catch (Exception e) {
  e.printStackTrace();
}
  }

Ok theres definitely some voodoo going on here - I see the test header I 
add but the content type is unchanged.
Is there something which forbids a content type change once something 
earlier in the processing has set it and written to the stream?


-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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


[Resin-interest] contentType='x-application/xslt' - meaning hijacked?

2007-02-19 Thread John Steel
test.jsp here http://www.caucho.com/resin-3.1/doc/xslt-filter.xtp shows 
you need to add this and the filter to the web-app in order for it to 
trigger resin to performing the transformation. I'm having an issue 
based on that example where basically I need to also control the 
contentType for real, i.e. text/html, text/xml etc.

How can I do this whilst still using the xsl filter please?
The problem is in the stylesheet, if I change method=xml to 
method=html below the contentType in the HTTP response toggles between
Content-Type: text/xml; charset=UTF-8 and Content-Type: text/html; 
charset=UTF-8

   xsl:output
   method=xml
   
doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
   doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN/

I want to retain the method=xml line but have it served as html so the 
browser doesn't complain about missing stylesheets. But of course, as 
soon as I try to set the contentType in the JSP I find I must leave it 
at 'x-application/xslt' or the filter won't be applied.

-- 
--
http://www.phonewebcam.com
[EMAIL PROTECTED]



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