svn commit: r745136 - /tomcat/connectors/trunk/jk/native/common/jk_connect.c

2009-02-17 Thread mturk
Author: mturk
Date: Tue Feb 17 16:37:13 2009
New Revision: 745136

URL: http://svn.apache.org/viewvc?rev=745136&view=rev
Log:
Make jk_apr_pool as subpool of httpd's conf pool.
This allows to clear the pool and make memory consumption constant for multiple
jk_resolve calls

Modified:
tomcat/connectors/trunk/jk/native/common/jk_connect.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_connect.c?rev=745136&r1=745135&r2=745136&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_connect.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_connect.c Tue Feb 17 16:37:13 
2009
@@ -343,12 +343,13 @@
 apr_sockaddr_t *remote_sa, *temp_sa;
 char *remote_ipaddr;
 
-if (!(jk_apr_pool = (apr_pool_t *)pool)) {
-if (apr_pool_create(&jk_apr_pool, NULL) != APR_SUCCESS) {
+if (!jk_apr_pool) {
+if (apr_pool_create(&jk_apr_pool, (apr_pool_t *)pool) != 
APR_SUCCESS) {
 JK_TRACE_EXIT(l);
 return JK_FALSE;
 }
 }
+apr_pool_clear(jk_apr_pool);
 if (apr_sockaddr_info_get
 (&remote_sa, host, APR_UNSPEC, (apr_port_t) port, 0, jk_apr_pool)
 != APR_SUCCESS) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



javax.el.ELContext.getFunctionMapper().resolveFunction() returns null always

2009-02-17 Thread Najeed Ahmed Khan
Hi,

 

I'm developing an application to parse EL expressions from a file and
evaluate them. I am using Java Unified EL for the same. The value
expressions are resolving fine however the  functions are not. I'm using
Tomcat 6.0.10 which is bundled with JBoss 4.2.3. I've posted this query
to the Tomcat user mailing list earlier but it is related to the Tomcat
source so I'm it posting here as I didn't receive any response from the
user forums.

 

The way I am evaluating the expression is:

 

final MethodExpression methodExpr =

exprFactory.createMethodExpression(jspContext.getELContext(), el,
expectedType, paramTypes);

Object result = methodExpr.invoke(jspContext.getELContext(), params);

 

 

However, the function is not being invoked and I get a stack trace like
such:

 

2009-02-12 22:35:13,629 [http-0.0.0.0-8080-5] ERROR STDERR () -
javax.el.ELException: Function 'testtld:escapeJava' not found

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:171)

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.parser.SimpleNode.accept(SimpleNode.java:129)

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:133)

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:147)

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBu
ilder.java:197)

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFac
toryImpl.java:57)

2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
test.util.ELExpressionEvaluator.evaluate(ELExpressionEvaluator.java:120)

 

 

The jsp page that I am using to obtain the ELContext has the taglib
directive to include that particular tld. If I invoke that JSP function
from a JSP page(using EL), it works fine. However, when I try to resolve
the function programmatically as above, I get the above error.

 

 

When I checked the Tomcat source code, I noticed in
org.apache.jasper.el.ELContextImpl :

 

private final static FunctionMapper NullFunctionMapper = new
FunctionMapper() {

public Method resolveFunction(String prefix, String localName) {

return null;

}

};

 

 

And a few lines below that,

 

private FunctionMapper functionMapper = NullFunctionMapper; // immutable

 

Although there is a 

 

public void setFunctionMapper(FunctionMapper functionMapper) {

this.functionMapper = functionMapper;

}

 

 

I am not sure whether that is invoked or how to have it invoked.

 

This could be the problem for me as the
ELContext.getFunctionMapper().resolveFunction(...) would return null and
I receive a message which corresponds to the Method object resolving to
null. From org.apache.el.lang.ExpressionBuilder.visit, the code
generating the exception:

 

Method m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode

.getLocalName());

if (m == null) {

throw new ELException(MessageFactory.get(

   "error.fnMapper.method", funcNode.getOutputName()));

}

 

 

When I check the generated servlet for the jsp that contains the same
EL, I see:

 

static private org.apache.jasper.runtime.ProtectedFunctionMapper
_jspx_fnmap_0;

 

static {

  _jspx_fnmap_0=
org.apache.jasper.runtime.ProtectedFunctionMapper.getMapForFunction("tes
ttld:escapeJava", org.apache.commons.lang.StringEscapeUtils.class,
"escapeJava", new Class[] {java.lang.String.class});

}

 

And

 

_jspx_th_c_005fset_005f0.setValue(new
org.apache.jasper.el.JspValueExpression("/test/scratchPad.jsp(7,0)
'${testtld:escapeJava(\"Test
String\")}'",_el_expressionfactory.createValueExpression(new
org.apache.jasper.el.ELContextWrapper(_jspx_page_context.getELContext(),
_jspx_fnmap_0),"${testtld:escapeJava(\"Test
String\")}",java.lang.Object.class)).getValue(_jspx_page_context.getELCo
ntext()));

 

But if I put the following test code within the same jsp in a scriptlet,
I see the exception above(javax.el.ELException: Function
'testtld:escapeJava' not found):

 

<%

JspApplicationContext jspAppCtx =
JspFactory.getDefaultFactory().getJspApplicationContext(pageContext.getS
ervletContext());

ExpressionFactory exprFactory = jspAppCtx.getExpressionFactory();

ELContext elCtx = pageContext.getELContext();

Class[] klass = {String.class};

String[] param = {"Test String"};

MethodExpression methodExpr =

exprFactory.createMethodExpression(elCtx,
"${testtld:escapeJava('Test String')}", String.class, klass);

String result = methodExpr.invoke(elCtx, param).toString();

out.println(result);

%>

 

I searched over the internet and did not come up wit

DO NOT REPLY [Bug 46727] New: DefaultServlet - serving multiple encodings

2009-02-17 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46727

   Summary: DefaultServlet - serving multiple encodings
   Product: Tomcat 6
   Version: unspecified
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: ft...@synernet.com
CC: ft...@synernet.com


Created an attachment (id=23272)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23272)
Minor refactor of DefaultServlet

Hi,

It had to happen sooner or later. In one of my tomcat applications I now have
to serve multiple collections of static content which may have various
encodings. We depend heavily on DefaultServlet, but in its current state it is
not possible to control encoding on a resource-by-resource basis. One can set
the "fileEncoding" parameter, but this controls all static resources.

The structure of the current code makes this impossible to solve by extending
the class, since fileEncoding is a global instance variable.

The attached refactoring mitigates this primarily by changing the method
signature of serveResource() to contain an encoding argument. The extending
class may override this method on every call if necessary.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 46727] DefaultServlet - serving multiple encodings

2009-02-17 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46727





--- Comment #1 from Mark Thomas   2009-02-17 15:10:14 PST ---
Patches should be in diff -u format


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 46727] DefaultServlet - serving multiple encodings

2009-02-17 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46727





--- Comment #2 from Fred Toth   2009-02-17 15:30:12 PST ---
Created an attachment (id=23273)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23273)
DefaultServlet refactor - patch

Hi,

Resubmit as a patch.

Thanks,

Fred


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r745374 - /tomcat/tc6.0.x/trunk/STATUS.txt

2009-02-17 Thread billbarker
Author: billbarker
Date: Wed Feb 18 04:16:19 2009
New Revision: 745374

URL: http://svn.apache.org/viewvc?rev=745374&view=rev
Log:
comment

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=745374&r1=745373&r2=745374&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Feb 18 04:16:19 2009
@@ -163,6 +163,11 @@
   keepAliveTimeout should be used regardless of setting of disableUploadTimeout
   http://svn.apache.org/viewvc?rev=744160&view=rev
   +1: markt
+   0: billbarker The original was an optimization to not keep setting the 
timeout to the same value
+ if we haven't changed it.  Of course it is broken, but a 
better patch would be to
+ set the timeout correctly outside the loop, and retain the 
disableUploadTimeout check.
+ The first request shouldn't care, since we should already 
have available() > 0 with the 
+ JIO connector.
   -1: 
 
 * Use ThreadLocal rather than syncs for DateFormat to prevent potential



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org