You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Vitaly Repetenko <vi...@mtu.ru> on 2001/11/06 10:34:56 UTC
Symbol escaped in a property
Good day!
I have a problem with escaping comma in a property.
Property example:
datasource.resource.loader.templatestatement = select a from t1\, t2
where t1.id = t2.t1_id
configuration.display() result is:
templatestatement => [select a from t1, t2 where t1.id = t2.t1_id]
configuration.getString("timestampstatement") result is:
select a from t1
Thanks in advance!
Vitaly
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by Vitaly Repetenko <vi...@mtu.ru>.
"Geir Magnusson Jr." wrote:
>
> That's the problem. I think the Properties is messing you up.
>
> I would override the new initVelocity() method in VelocityServlet, load an
> ExtendedProperties (from org.apache.commons)
>
> Then call
>
> Velocity.setExtendedProperties()
> Velocity.init()
>
> There are some details missing, but I hope this conveys the idea. The
> ExtendedProperties respects the, and prevents vectorization...
>
Good day!
I have made changes in VelocityServlet as you advised in previos message.
Now it works only with two escape symbols (select a from a\\, b). :(
I added also some System.out.println in ExtendedProperties and
it seems that ExtendedProperties executes a property twice.
Thanks in advance,
Vitaly
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/8/01 8:00 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>
>
> "Geir Magnusson Jr." wrote:
>
>> On 11/8/01 7:31 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>>
>>> Good day!
>>>
>>> "Geir Magnusson Jr." wrote:
>>>
>>>> On 11/6/01 6:55 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>>>>
>>>>>>>
>>>>>>> configuration.getString("timestampstatement") result is:
>>>>>>> select a from t1
>>>>>>>
>>>>>>> Thanks in advance!
>>>>>>> Vitaly
>>>>>>
>>>>>> I thought we had a problem like this about 6 months ago, and Leon
>>>>>> submitted
>>>>>> a patch and was applied. I assume this is a recent version of Velocity?
>>>>>
>>>>> Velocity Version: Nightly 28 oct. 2001
>>>>>
>>>>
>>>> Heh. You can't argue that's its old :)
>>>>
>>>> I need to fix that class anyway, so I will spend some time on it today.
>>>
>>> It still does not work (commas escaped in properties) :(
>>>
>>> I have found that it works: select a from a\\\\, b
>>
>> This dones't make sense :)
>>
>> We test the configuration stuff in our testbed, and do things with ,'s
>>
>> Take a look at the CommonsExtPropTestCase in o.a.v.test
>
> I see.
> I use Velocity in servlets. May be I do something wrong during loading
> properties.
> In this configuration I can not use escape symbol. :(
> It works only when I add \\\\ in a property.
> Could you help me?
>
> protected Properties loadConfiguration(ServletConfig config )
> throws IOException, FileNotFoundException
> {
> Properties p = new Properties();
>
> String propsFile = config.getInitParameter(INIT_PROPS_KEY);
>
> if ( propsFile != null )
> {
> String realPath = getServletContext().getRealPath(propsFile);
>
> if ( realPath != null )
> {
> propsFile = realPath;
> }
> }
>
> p.load( new FileInputStream(propsFile) );
>
> return p;
> }
>
> Thanks in advance,
> Vitaly
That's the problem. I think the Properties is messing you up.
I would override the new initVelocity() method in VelocityServlet, load an
ExtendedProperties (from org.apache.commons)
Then call
Velocity.setExtendedProperties()
Velocity.init()
There are some details missing, but I hope this conveys the idea. The
ExtendedProperties respects the, and prevents vectorization...
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by Vitaly Repetenko <vi...@mtu.ru>.
"Geir Magnusson Jr." wrote:
> On 11/8/01 7:31 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>
> > Good day!
> >
> > "Geir Magnusson Jr." wrote:
> >
> >> On 11/6/01 6:55 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
> >>
> >>>>>
> >>>>> configuration.getString("timestampstatement") result is:
> >>>>> select a from t1
> >>>>>
> >>>>> Thanks in advance!
> >>>>> Vitaly
> >>>>
> >>>> I thought we had a problem like this about 6 months ago, and Leon submitted
> >>>> a patch and was applied. I assume this is a recent version of Velocity?
> >>>
> >>> Velocity Version: Nightly 28 oct. 2001
> >>>
> >>
> >> Heh. You can't argue that's its old :)
> >>
> >> I need to fix that class anyway, so I will spend some time on it today.
> >
> > It still does not work (commas escaped in properties) :(
> >
> > I have found that it works: select a from a\\\\, b
>
> This dones't make sense :)
>
> We test the configuration stuff in our testbed, and do things with ,'s
>
> Take a look at the CommonsExtPropTestCase in o.a.v.test
I see.
I use Velocity in servlets. May be I do something wrong during loading properties.
In this configuration I can not use escape symbol. :(
It works only when I add \\\\ in a property.
Could you help me?
protected Properties loadConfiguration(ServletConfig config )
throws IOException, FileNotFoundException
{
Properties p = new Properties();
String propsFile = config.getInitParameter(INIT_PROPS_KEY);
if ( propsFile != null )
{
String realPath = getServletContext().getRealPath(propsFile);
if ( realPath != null )
{
propsFile = realPath;
}
}
p.load( new FileInputStream(propsFile) );
return p;
}
Thanks in advance,
Vitaly
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/8/01 7:31 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
> Good day!
>
> "Geir Magnusson Jr." wrote:
>
>> On 11/6/01 6:55 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>>
>>>>>
>>>>> configuration.getString("timestampstatement") result is:
>>>>> select a from t1
>>>>>
>>>>> Thanks in advance!
>>>>> Vitaly
>>>>
>>>> I thought we had a problem like this about 6 months ago, and Leon submitted
>>>> a patch and was applied. I assume this is a recent version of Velocity?
>>>
>>> Velocity Version: Nightly 28 oct. 2001
>>>
>>
>> Heh. You can't argue that's its old :)
>>
>> I need to fix that class anyway, so I will spend some time on it today.
>
> It still does not work (commas escaped in properties) :(
>
> I have found that it works: select a from a\\\\, b
This dones't make sense :)
We test the configuration stuff in our testbed, and do things with ,'s
Take a look at the CommonsExtPropTestCase in o.a.v.test
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by Vitaly Repetenko <vi...@mtu.ru>.
Good day!
"Geir Magnusson Jr." wrote:
> On 11/6/01 6:55 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>
> >>>
> >>> configuration.getString("timestampstatement") result is:
> >>> select a from t1
> >>>
> >>> Thanks in advance!
> >>> Vitaly
> >>
> >> I thought we had a problem like this about 6 months ago, and Leon submitted
> >> a patch and was applied. I assume this is a recent version of Velocity?
> >
> > Velocity Version: Nightly 28 oct. 2001
> >
>
> Heh. You can't argue that's its old :)
>
> I need to fix that class anyway, so I will spend some time on it today.
It still does not work (commas escaped in properties) :(
I have found that it works: select a from a\\\\, b
Velocity: 2001 nov. 08
Vitaly
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/6/01 6:55 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
>>>
>>> configuration.getString("timestampstatement") result is:
>>> select a from t1
>>>
>>> Thanks in advance!
>>> Vitaly
>>
>> I thought we had a problem like this about 6 months ago, and Leon submitted
>> a patch and was applied. I assume this is a recent version of Velocity?
>
> Velocity Version: Nightly 28 oct. 2001
>
Heh. You can't argue that's its old :)
I need to fix that class anyway, so I will spend some time on it today.
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by Vitaly Repetenko <vi...@mtu.ru>.
> >
> > configuration.getString("timestampstatement") result is:
> > select a from t1
> >
> > Thanks in advance!
> > Vitaly
>
> I thought we had a problem like this about 6 months ago, and Leon submitted
> a patch and was applied. I assume this is a recent version of Velocity?
Velocity Version: Nightly 28 oct. 2001
>
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> "He who throws mud only loses ground." - Fat Albert
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Symbol escaped in a property
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/6/01 4:34 AM, "Vitaly Repetenko" <vi...@mtu.ru> wrote:
> Good day!
>
> I have a problem with escaping comma in a property.
>
> Property example:
> datasource.resource.loader.templatestatement = select a from t1\, t2
> where t1.id = t2.t1_id
>
> configuration.display() result is:
> templatestatement => [select a from t1, t2 where t1.id = t2.t1_id]
Yep, that's clearly getting turned into an array for some reason...
>
> configuration.getString("timestampstatement") result is:
> select a from t1
>
> Thanks in advance!
> Vitaly
I thought we had a problem like this about 6 months ago, and Leon submitted
a patch and was applied. I assume this is a recent version of Velocity?
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>