That's ok for me (maybe much easier since it is time consuming for
me submitting a patch when I seem to do so many things wrong as Jon
said).
So, forget the patch, I will do it the easy way (there is another error in
the patch also, the correct syntax is
if ( forceComma )
t = t.replace('/', ',');
template = t;
and not
> > + if ( forceComma )
> > + template = t.replace('/', ',');
> > + else
> > template = t;
Thanks anyway,
Costas
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2001 10:06 AM
Subject: RE: [PATCH] Re: Use of ',' and '/' in template links with Apache as
WebServer
> Is this really necessary? It's not a very clean solution neither
technically
> nor conceptually as we should enforce usage of commas instead of slashes.
> Costas, could you just extend the TemplateLink class and add the
replacement
> to its setPage method before calling the orginal super.setPage()? In TR,
you
> must then reconfig the PullService to use the new one.
>
> -- Ilkka
>
>
> > -----Original Message-----
> > From: ext Costas Stergiou [mailto:[EMAIL PROTECTED]]
> > Sent: 09. May 2001 9:51
> > To: [EMAIL PROTECTED]
> > Subject: [PATCH] Re: Use of ',' and '/' in template links
> > with Apache as
> > WebServer
> >
> >
> > Here is the patch for the changes. Two files were modified TR.props
> > and TemplateLink.java.
> > Can you pls submit that for me?
> > Thanks very much,
> > Costas
> >
> >
> > cvs -z9 -q diff -w -u TurbineResources.properties
> > Index: TurbineResources.properties
> > ===================================================================
> > RCS file:
> > /home/cvspublic/jakarta-turbine/conf/TurbineResources.properties,v
> > retrieving revision 1.105
> > diff -w -u -r1.105 TurbineResources.properties
> > --- TurbineResources.properties 2001/04/25 05:31:03 1.105
> > +++ TurbineResources.properties 2001/05/09 06:48:51
> > @@ -308,6 +308,14 @@
> >
> > action.accesscontroller=AccessController
> >
> > +# Set this parameter to 'true' if you want the TemplateLink to force
> > +# the comma (',') as the path separator for Templates. This will
> > +# add an overhead to the processing of the TemplateLink but will
> > +# ensure that all links will be created using a comma instead of a
> > +# slash. Leave it to false if you are certain that you always use the
> > +# ',' character in your templates.
> > +templatelink.force.comma=false
> > +
> > # -------------------------------------------------------------------
> > #
> > # J N D I C O N T E X T S
> >
> >
> >
> >
> > cvs -z9 -q diff -w -u TemplateLink.java
> > Index: TemplateLink.java
> > ===================================================================
> > RCS file:
> > /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/ut
> > il/template/Te
> > mplateLink.java,v
> > retrieving revision 1.7
> > diff -w -u -r1.7 TemplateLink.java
> > --- TemplateLink.java 2001/03/06 06:14:45 1.7
> > +++ TemplateLink.java 2001/05/09 06:47:36
> > @@ -84,6 +84,7 @@
> > *
> > * @author <a href="[EMAIL PROTECTED]">Dave Bryson</a>
> > * @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
> > + * @author <a href="mailto:[EMAIL PROTECTED]">Costas Stergiou</a>
> > * @version $Id: TemplateLink.java,v 1.7 2001/03/06 06:14:45
> > chrise Exp $
> > */
> > public class TemplateLink
> > @@ -96,6 +97,26 @@
> > private String template = null;
> >
> > /**
> > + * reflects the value of the templatelink.force.comma
> > property. If set
> > + * the setPage method will check to ensure that the ','
> > is used as a
> > + * separator. If not, it will replace all slashes
> > (except the first
> > one)
> > + * with a comma.
> > + */
> > + private static boolean forceComma = false;
> > +
> > + static{
> > + try
> > + {
> > + forceComma =
> > TurbineResources.getBoolean("templatelink.force.comma",false);
> > + }
> > + catch(Exception ex)
> > + {
> > + //ignore: the TurbineResources servive has not yet been
> > initialized.
> > + }
> > + }
> > +
> > +
> > + /**
> > * Default constructor
> > * <p>
> > * The init method must be called before use.
> > @@ -127,6 +148,7 @@
> > // or null is passed in we'll throw an appropriate runtime
> > // exception.
> > super.init((RunData)data);
> > +
> > }
> >
> > /**
> > @@ -156,7 +178,12 @@
> > */
> > public DynamicURI setPage(String t)
> > {
> > + //see if we need to replace slashes with commas.
> > Exclude the first
> > slash
> > + if ( forceComma )
> > + template = t.replace('/', ',');
> > + else
> > template = t;
> > +
> > return addPathInfo(TEMPLATE_KEY,t);
> > }
> >
> > @@ -201,5 +228,13 @@
> > public String getURI()
> > {
> > return super.toString();
> > + }
> > +
> > + /**
> > + * Sets whether the TemplateLink object will attempt to
> > replace '/'
> > with
> > + * ',' for the path info in the generated links.
> > + */
> > + public static void setForceComma(boolean newValue){
> > + forceComma = newValue;
> > }
> > }
> >
> >
> > ----- Original Message -----
> > From: "John McNally" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, May 08, 2001 9:06 PM
> > Subject: Re: Use of ',' and '/' in template links with Apache
> > as WebServer
> >
> >
> > > I have stated over and over again that one should not use
> > '/' or '%2F'
> > > as the path separator when referring to templates. You
> > should use the
> > > ','. TemplateLink could be modified to check for cases
> > where templates
> > > are being referred to using '/' and converting to ',' but I
> > do not like
> > > adding this inefficiency for everyone, when the correct
> > thing to do is
> > > to use ',' and avoid the problem. But a TR.prop to allow
> > '/' so that a
> > > static final boolean can be used in the conditional would
> > be acceptable,
> > > if you care to submit a patch. Or you can extend TemplateLink and
> > > override setPage to make the conversion.
> > >
> > > To get the template parameter without conversion just do
> > > data.getParameters().getString("template");
> > >
> > > john mcnally
> > >
> > > Costas Stergiou wrote:
> > > >
> > > > Hi all,
> > > > I have a turbine+velocity app that is accessed from an
> > > > Apache WebServer with Ajp12 (or Ajp13). The problem is
> > > > that I cannot access any templates within directories because
> > > > the %2F is not recognized.
> > > > Is there any workaroung other than using the ',' to indicate the
> > > > sub-dir of a template?
> > > >
> > > > Is there a way to make the DynamicURI (TemplateLink) class
> > > > always use the ',' as a separator in order to avoid this problem
> > > > (of course, I could use the ',' at the setPage method, but the
> > > > templates and the links are too many...)
> > > >
> > > > Also, when I use the method data.getScreenTemplate() the
> > > > returned value always contains a '/' as a separator. How can I
> > > > avoid this?
> > > >
> > > > Thanks in advance,
> > > > Costas
> > >
> > >
> > ---------------------------------------------------------------------
> > > 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]
> >
>
> ---------------------------------------------------------------------
> 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]