RE: [Jelly] Jexl Syntax
Thanks, that clarifies a lot. I keep being amazed by the potential of Jelly. ...Frank -Original Message- From: Wannheden, Knut [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 2:22 AM To: 'Jakarta Commons Users List' Subject: RE: [Jelly] Jexl Syntax Frank, Where could I get a description of Jexl and how it is used within a Jelly file? Jexl is an extension of JSTL expression language. You can read more about how it extends JSTL at http://jakarta.apache.org/commons/jexl/. If you're unfamiliar with JSTL take a look at http://java.sun.com/products/jsp/jstl/. In Jelly you can basically write Jexl expressions anywhere you like. You write them like ${expr}. The syntax is very simple, really. It's just like writing Java. I suggest you browse through the examples mentioned in the Jelly documentation and some of the unit tests written as Jelly scripts to get an idea of how to use them. Cheers, -- knut
Re: [logging] How to setLevel() for commons logging? (urgent :)
On Thu, 3 Apr 2003, Thomas Nichols wrote: Of course, if you find it necessary to access these logger objects, it seems to me that using commons-logging is a waste of time -- you're going to be tying yourself to the underlying implementation anyway. I can live with a Log4J dependency in a single source file, but I don't want such dependencies scattered throughout the code. Such an architecture would even allow me to have a controller class select either Log4J or JDK14 logging at startup based on user prefs - to do this it would be very handy to have access to the internals of the instantiated logger to perform custom setup. It seems this is exactly what I get from your suggestion of a custom LogFactory - and commons-logging stays clean and within scope :-) Why don't you just let the underlying logging system configure itself based on properties files (log4j.properties for Log4J, logging.properties for JDK 1.4)? Then you have zero code dependencies, and only need to make sure that the correct properties file is visible. Programmatic initialization of stuff like this is a lot more painful. The other thing to remember is that, at least for the default c-l implementations, the object you get directly from Log4J: Logger logger = Logger.getLogger(com.mycompany.mypackage.Foo); is the exact same one that is wrapped by c-l: Log log = LogFactory.getLog(com.mycompany.mypackage.Foo); so configuration changes on the former will be reflected in the behavior of the latter (it's just a wrapper). This is only guaranteed if you're using the default implementations in c-l. But, as stated above, I would still avoid programmatic initialization totally if you can. Zero implementation-classes is infinitely better than one :-). Thanks again, Thomas. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [logging] How to setLevel() for commons logging? (urgent :)
At 11:24 03/04/2003 -0800, Craig R. McClanahan wrote: On Thu, 3 Apr 2003, Thomas Nichols wrote: [snip] Why don't you just let the underlying logging system configure itself based on properties files (log4j.properties for Log4J, logging.properties for JDK 1.4)? Then you have zero code dependencies, and only need to make sure that the correct properties file is visible. Programmatic initialization of stuff like this is a lot more painful. More painful - yes. But it gives me fine control without requiring that a properties file be present. I'm re-examining my reasons for wanting this, but my thinking was to get default (no props files found) behaviour that works as I expect. Maybe the advantages of this are illusory :) The other thing to remember is that, at least for the default c-l implementations, the object you get directly from Log4J: Logger logger = Logger.getLogger(com.mycompany.mypackage.Foo); is the exact same one that is wrapped by c-l: Log log = LogFactory.getLog(com.mycompany.mypackage.Foo); so configuration changes on the former will be reflected in the behavior of the latter (it's just a wrapper). (Dull thud as penny drops). This does exactly what I was trying to do - though now I'm not so sure it's the best solution... This is only guaranteed if you're using the default implementations in c-l. But, as stated above, I would still avoid programmatic initialization totally if you can. Zero implementation-classes is infinitely better than one :-). Craig Thank you for taking the time to explain the options here - a plethora of choices! Best Regards, Thomas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RE: Re: [DBCP] Strange Problems and Errors
I added the validation query and it still has the same problem. Travis Original Message From: Rodney Waldhoff [EMAIL PROTECTED] Sent: 2003-04-02 To: Jakarta Commons Users List [EMAIL PROTECTED] Subject: RE: Re: [DBCP] Strange Problems and Errors On Tue, 1 Apr 2003 [EMAIL PROTECTED] wrote: Could it be this problem [specifying TimeBetweenEvictionRuns but no ValidationQuery] that Jason stated below? I don't think so. Without a validation query, dbcp can still check minEvictableIdleTime for each connection. Travis - Rod http://radio.weblogs.com/0122027/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[httpclient] Parse response for NameValuePairs?
Hi, I've looked through the API docs but didn't find what I wanted. I'm wondering if there is a method that will find and return all NameValuePairs from a given response? If not can anyone please suggest a few lines of code? Thanks. John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [httpclient] Parse response for NameValuePairs?
Hi John, I take it you wanted to get the name and value of all the headers returned in the response. You can use the getResponseHeaders() method in any HttpMethod which will return an array of Headers. Each header though can contain multiple values so you'd have to iterate over the headers and the over the values for each header. Something like: Header[] headers = method.getResponseHeaders(); for (int i = 0; i headers.length; i++) { String headerName = headers[i].getName(); HeaderElement[] elements = headers[i].getValues(); for (int j = 0; j elements.length; j++) { HeaderElement el = elements[j]; // At this stage you have the header and it's value. // See below for information on some funky headers } } Some headers can contain multiple values within the header value, in particular cookie headers do this. You can repeat the pattern above to iterate over the parameters of the HeaderElement to get a name value pair of each element if that's what you want. It really depends what level of detail you need to go to. Why were you wanting to do this? Adrian Sutton, Software Engineer Ephox Corporation www.ephox.com -Original Message- From: John Burke [mailto:[EMAIL PROTECTED] Sent: Friday, 4 April 2003 1:17 PM To: [EMAIL PROTECTED] Subject: [httpclient] Parse response for NameValuePairs? Hi, I've looked through the API docs but didn't find what I wanted. I'm wondering if there is a method that will find and return all NameValuePairs from a given response? If not can anyone please suggest a few lines of code? Thanks. John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
BeanUtils.copyProperties and null properties
hi to all, i have a problem which i think is a usual problem, but i cant find the answer in commons forum, so please help :) Here we go: i'm trying to copy properties from Struts' ActionForm to my POJO, and vice versa. All properties from ActionForm are String, as suggested, and most of the properties in my POJO are Float objects, which correspond to db column. My problem is when the user send back the input form, and i use BeanUtils.copyProperties to copy the content of AF to my POJO, all the empty property string turns into default object. For example the from the empty String i get a Float object with value of 0.0, which isn't what i need. (i just need null, so i can update the db column with null value, not 0.0 value). Is this the default behavior of BeanUtils.copyProperties? if its so, how can i get around this? If you need further information, i'll be glad to provide. Thanks in advance Ross. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[betwixt] BeanReader - setXXX(Object)
I was wondering if there is something I'm missing, or if Betwixt just can't do it as is. Given the following XML: Element nameElement 1/name value Integer5/Integer /value /Element and the following bean mapped to the Element XML element: public class ElementBean { private String mName; private Object mValue; public ElementBean() { } public void setName(String iName) { mName = iName; } public String getName() { return mName; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[betwixt] BeanReader - setXXX(Object)
I was wondering if there is something I'm missing, or if Betwixt just can't do it as is. Given the following XML: Element nameElement 1/name value Integer5/Integer /value /Element and the following bean mapped to the Element XML element: public class ElementBean { private String mName; private Object mValue; public ElementBean() { } public void setName(String iName) { mName = iName; } public String getName() { return mName; } public void setValue(Object iValue) { mValue = iValue; } public Object getValue() { return mValue; } } Is there any way to get the value (5) into the Element's setValue method as an Integer as opposed to an Object? I rely on being able to reuse objects and pulling out the values as appropriate, but with the BeanReader, all calls to 'getValue' result in [EMAIL PROTECTED] Aside from my 'Object'ion, the reader parses fine. Any help would be appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]