You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Igor Fedulov <if...@outlook.net> on 2002/01/07 20:00:29 UTC
VelocityServlet.init(ServletConfig config) question
Question:
If I want to do some application specific initialization from MyServlet
which extends VelocityServlet where should I put my init code? I was
looking through the source and I would love to have an abstract hook like
initOther(config) placed right after initVelocity(config); in
init(config), or should I just simply put everything into
parameterless init() ?
--
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Igor Fedulov <if...@outlook.net>.
> In short, this is an application of the template method pattern. In
> VelocityServlet, we could have:
>
> public final void init() throws ServletException
> {
> preInit();
>
> // other base-class initialization stuff before init-ing Velocity?
>
> beforeInitVelocity();
> initVelocity();
> afterInitVelocity();
>
> // other base-class initialization stuff after init-ing Velocity?
>
> postInit();
> }
I think that 'pre' and 'post' init methods are just enough, you can always
span more from those :) And above is totally cool with me, I don't care
about 'final' modifier, because I don't see the need to override this method
when extending VelocityServlet. So is it gonna make it into the code?
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Donnie Hale <do...@haleonline.net>.
Geir - see (way :) below.
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Wednesday, January 09, 2002 12:33 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: VelocityServlet.init(ServletConfig config) question
>
>
> On 1/9/02 12:10 AM, "Donnie Hale" <do...@haleonline.net> wrote:
>
> >
> >
> >> -----Original Message-----
> >> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> >> Sent: Tuesday, January 08, 2002 11:40 PM
> >> To: velocity-user@jakarta.apache.org
> >> Subject: Re: VelocityServlet.init(ServletConfig config) question
> >>
> >>
> >> On 1/8/02 11:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:
> >>
> >>> We do have Craig M. hanging about on the commons, struts, and
> >> tomcat lists.
> >>> I feel quite confident based on all the servlet examples I've
> >> seen recently,
> >>> the Struts ActionServlet, etc., that it's safe to use
> >> "getServletConfig()"
> >>> to get the config from within the parameter-less init() call.
> >> It's not like
> >>> we need the servlet to be handling requests at that point -
> we're still
> >>> initializing. About the only important thing we have to depend
> >> upon is that
> >>> we can use getServletConfig().getInitParameter() and
> >>> getServletConfig().getServletContext().getInitParameter(); and
> >> I know those
> >>> work.
> >>
> >> I'm sure they work.
> >>
> >> That's not the question.
> >>
> >> The question is : when is init() called? When the rest of init(
> >> config ) is
> >> complete? Half way though? Before? (The last two, probably
> not, but you
> >> can't prove otherwise at the momment - and you can't appeal to
> the servlet
> >> impl here in jakarta, as other containers which implement the
> >> same API seem
> >> to be able to do it diffrerently.
> >>
> >> If you are counting on init( config ) to configure velocity and then in
> >> init() you want to work with Velocity, you better be right :)
> >
> > I agree 100%. I guess I'm seeing the question a little
> differently now, as I
> > didn't think the issue was using init(config) *and* init(). I
> thought it was
> > using init(config) *or* init(). In the *or* case, if you used
> just init(),
> > you'd have to initialize Velocity right there before you did
> anything with
> > it. So of course you'd know that Velocity was initialized.
>
> Yes, but then we can't have a base class impl, right? Wouldn't everyone
> then have to re-implement the Velocity initialization?
>
> >
> > The point I was trying to make was that init(config) in VelocityServlet
> > should be deprecated and changed to just call super(config) and
> that all the
> > real work should be moved to a newly-implemented init().
>
> I don't see how this just doesn't rename the problem.
>
> You still then have to do a
>
> super.init()
>
> When you implement the init() method in your derived class? Right? Am I
> missing something?
>
> I thought that Igor wanted to have a method that he could implement to do
> some 'private' initialization w/o having to remember to call
>
> super.init( config ).
>
> I thought that was a good idea -> then we have a formal initialization
> contract :
>
> init( ServletConfig ) : if you want to do the whole thing - you must call
> super.init( config ) if you want to take advantage of the base class.
>
>
> initvVelocity (ServletConfig ) : if you just want to get involved in the
> Velocity configuration
>
> loadConfiguratioN( ServletConfig ) : if you just want to manufacture a
> properties to configure velocity with, and not worry about the rest
>
> And now suggested by Igor :
>
>
> postInit( ServletConfig ) : [we can bicker about the arg...] for
> post setup
> app specific configuration w/o worrying about the other stuff.
>
I started to write my thoughts on that topic in my previous email, but I
figured it would end up being a bunch of code that I'd be better off just
writing and submitting. I should have expressed that.
In short, this is an application of the template method pattern. In
VelocityServlet, we could have:
public final void init() throws ServletException
{
preInit();
// other base-class initialization stuff before init-ing Velocity?
beforeInitVelocity();
initVelocity();
afterInitVelocity();
// other base-class initialization stuff after init-ing Velocity?
postInit();
}
That may be too many template methods, but you get the idea. There are other
things that can be done around this for flexibility as well, such as putting
the default implementations of various methods in static same-named methods
with a "Default" suffix on the name (they'd naturally have to take as
parameters any objects that are members of the class instance). Those could
go in a "VelocityServletHelpers" class which consisted solely of static
methods that would be useful to servlet authors.
Note that I've got init() as a final method. If someone needs behavior
sufficiently different from the pattern in this base class, then it's safer
for that class and this one if they're not allowed to extend it. That's
where providing the "default" implementations as static methods comes in.
Hope that's clear,
Donnie
>
> >
> > As far as knowing the formal order of events, that's why I recommended
> > asking Craig M.
>
> I did.
>
> > Not because I want to know about the Tomcat implementation
> > in particular, but because he's close enough to the spec
> process for that
> > stuff to know if it's a realized ambiguity that's been addressed in an
> > addendum, if no one's realized it yet, if all the spec writers
> assumed we
> > ignorant masses should infer the obvious, etc. ;)
>
> I searched the spec (2.3) to no avail. They did include the
> Javadoc in the
> spec, and it's the same as published, so no use :)
>
> >
> > I'm sorry for jumping in when I didn't grok the problem completely.
> >
>
> Or I don't grok it completely.
>
>
> > Donnie
> >
> >
> >>
> >>
> >>>
> >>> I'd really recommend, pending Geir's satisfaction that the above is
> >>> accurate, that we not reinvent via a "postInit" method that which
> >>> essentially already exists.
> >>
> >> I'm a little surprised, coming from you, given your beliefs re
> protected
> >> members. If we use init(), as far as I can tell, we don't
> have a formal
> >> order of events that people can depend on.
> >>
> >>>
> >>> FWIW...
> >>>
> >>> Donnie
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Igor Fedulov [mailto:ifedulov@outlook.net]
> >>>> Sent: Tuesday, January 08, 2002 11:22 PM
> >>>> To: Velocity Users List
> >>>> Subject: Re: VelocityServlet.init(ServletConfig config) question
> >>>>
> >>>>
> >>>>
> >>>>>> That is why I asked the question cuz I figured that if there is no
> >>>>>> initOther or postInit() method anywhere I then should use
> >>>> parameterless
> >>>>>> init() and use getServletConfig() method to get the config
> >>>> instance, but I
> >>>>>> figured that I would rather ask what you guys think.
> >>>>>>
> >>>>>
> >>>>> I guess I wonder about init(), because I can't tell when
> it's getting
> >>>>> called. I mean, you need to know. It's not mentioned in the spec.
> >>>>
> >>>> I didn't dig out for specs but javadocs give a very short usage
> >>>> instruction and no underlying explanation of event chain. I
> assume that
> >>>> parameterless init() gotta be called from init(config) after
> >> all is done,
> >>>> but "assumption" is a root of all errors :) So I figured since I use
> >>>> parameterless init() already (I'm converting my controller
> >>>> servlet to Velocity powered one :)) I either have to leave
> >> everything "as
> >>>> is" crossing all fingers that I didn't overwrite anything
> >> vital, or write
> >>>> my own extension of VelocityServlet overriding loadConfig (ugly
> >>>> :() or ask you
> >>>> guys to add a postInit method to init(config) that you
> >>>> have implemented...
> >>>>
> >>>> Best regards,
> >>>> --
> >>>> HTTP is a stateless protocol, and the Internet is a stateless
> >> development
> >>>> environment
> >>>> --
> >>>> Igor Fedulov
> >>>> E-mail : ifedulov@outlook.net
> >>>> Work Ph: 773.775.1595
> >>>> Home Ph: 773.281.8938
> >>>> Cell Ph: 773.580.5935
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> 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>
> >>>
> >>
> >> --
> >> Geir Magnusson Jr.
> geirm@optonline.net
> >> System and Software Consulting
> >> "We will be judged not by the monuments we build, but by the
> monuments we
> >> destroy" - Ada Louise Huxtable
> >>
> >>
> >> --
> >> 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>
> >
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> You're going to end up getting pissed at your software
> anyway, so you might as well not pay for it. Try Open Source.
>
>
>
> --
> 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: VelocityServlet.init(ServletConfig config) question
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/9/02 12:10 AM, "Donnie Hale" <do...@haleonline.net> wrote:
>
>
>> -----Original Message-----
>> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
>> Sent: Tuesday, January 08, 2002 11:40 PM
>> To: velocity-user@jakarta.apache.org
>> Subject: Re: VelocityServlet.init(ServletConfig config) question
>>
>>
>> On 1/8/02 11:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:
>>
>>> We do have Craig M. hanging about on the commons, struts, and
>> tomcat lists.
>>> I feel quite confident based on all the servlet examples I've
>> seen recently,
>>> the Struts ActionServlet, etc., that it's safe to use
>> "getServletConfig()"
>>> to get the config from within the parameter-less init() call.
>> It's not like
>>> we need the servlet to be handling requests at that point - we're still
>>> initializing. About the only important thing we have to depend
>> upon is that
>>> we can use getServletConfig().getInitParameter() and
>>> getServletConfig().getServletContext().getInitParameter(); and
>> I know those
>>> work.
>>
>> I'm sure they work.
>>
>> That's not the question.
>>
>> The question is : when is init() called? When the rest of init(
>> config ) is
>> complete? Half way though? Before? (The last two, probably not, but you
>> can't prove otherwise at the momment - and you can't appeal to the servlet
>> impl here in jakarta, as other containers which implement the
>> same API seem
>> to be able to do it diffrerently.
>>
>> If you are counting on init( config ) to configure velocity and then in
>> init() you want to work with Velocity, you better be right :)
>
> I agree 100%. I guess I'm seeing the question a little differently now, as I
> didn't think the issue was using init(config) *and* init(). I thought it was
> using init(config) *or* init(). In the *or* case, if you used just init(),
> you'd have to initialize Velocity right there before you did anything with
> it. So of course you'd know that Velocity was initialized.
Yes, but then we can't have a base class impl, right? Wouldn't everyone
then have to re-implement the Velocity initialization?
>
> The point I was trying to make was that init(config) in VelocityServlet
> should be deprecated and changed to just call super(config) and that all the
> real work should be moved to a newly-implemented init().
I don't see how this just doesn't rename the problem.
You still then have to do a
super.init()
When you implement the init() method in your derived class? Right? Am I
missing something?
I thought that Igor wanted to have a method that he could implement to do
some 'private' initialization w/o having to remember to call
super.init( config ).
I thought that was a good idea -> then we have a formal initialization
contract :
init( ServletConfig ) : if you want to do the whole thing - you must call
super.init( config ) if you want to take advantage of the base class.
initvVelocity (ServletConfig ) : if you just want to get involved in the
Velocity configuration
loadConfiguratioN( ServletConfig ) : if you just want to manufacture a
properties to configure velocity with, and not worry about the rest
And now suggested by Igor :
postInit( ServletConfig ) : [we can bicker about the arg...] for post setup
app specific configuration w/o worrying about the other stuff.
>
> As far as knowing the formal order of events, that's why I recommended
> asking Craig M.
I did.
> Not because I want to know about the Tomcat implementation
> in particular, but because he's close enough to the spec process for that
> stuff to know if it's a realized ambiguity that's been addressed in an
> addendum, if no one's realized it yet, if all the spec writers assumed we
> ignorant masses should infer the obvious, etc. ;)
I searched the spec (2.3) to no avail. They did include the Javadoc in the
spec, and it's the same as published, so no use :)
>
> I'm sorry for jumping in when I didn't grok the problem completely.
>
Or I don't grok it completely.
> Donnie
>
>
>>
>>
>>>
>>> I'd really recommend, pending Geir's satisfaction that the above is
>>> accurate, that we not reinvent via a "postInit" method that which
>>> essentially already exists.
>>
>> I'm a little surprised, coming from you, given your beliefs re protected
>> members. If we use init(), as far as I can tell, we don't have a formal
>> order of events that people can depend on.
>>
>>>
>>> FWIW...
>>>
>>> Donnie
>>>
>>>
>>>> -----Original Message-----
>>>> From: Igor Fedulov [mailto:ifedulov@outlook.net]
>>>> Sent: Tuesday, January 08, 2002 11:22 PM
>>>> To: Velocity Users List
>>>> Subject: Re: VelocityServlet.init(ServletConfig config) question
>>>>
>>>>
>>>>
>>>>>> That is why I asked the question cuz I figured that if there is no
>>>>>> initOther or postInit() method anywhere I then should use
>>>> parameterless
>>>>>> init() and use getServletConfig() method to get the config
>>>> instance, but I
>>>>>> figured that I would rather ask what you guys think.
>>>>>>
>>>>>
>>>>> I guess I wonder about init(), because I can't tell when it's getting
>>>>> called. I mean, you need to know. It's not mentioned in the spec.
>>>>
>>>> I didn't dig out for specs but javadocs give a very short usage
>>>> instruction and no underlying explanation of event chain. I assume that
>>>> parameterless init() gotta be called from init(config) after
>> all is done,
>>>> but "assumption" is a root of all errors :) So I figured since I use
>>>> parameterless init() already (I'm converting my controller
>>>> servlet to Velocity powered one :)) I either have to leave
>> everything "as
>>>> is" crossing all fingers that I didn't overwrite anything
>> vital, or write
>>>> my own extension of VelocityServlet overriding loadConfig (ugly
>>>> :() or ask you
>>>> guys to add a postInit method to init(config) that you
>>>> have implemented...
>>>>
>>>> Best regards,
>>>> --
>>>> HTTP is a stateless protocol, and the Internet is a stateless
>> development
>>>> environment
>>>> --
>>>> Igor Fedulov
>>>> E-mail : ifedulov@outlook.net
>>>> Work Ph: 773.775.1595
>>>> Home Ph: 773.281.8938
>>>> Cell Ph: 773.580.5935
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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>
>>>
>>
>> --
>> Geir Magnusson Jr. geirm@optonline.net
>> System and Software Consulting
>> "We will be judged not by the monuments we build, but by the monuments we
>> destroy" - Ada Louise Huxtable
>>
>>
>> --
>> 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>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Donnie Hale <do...@haleonline.net>.
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Tuesday, January 08, 2002 11:40 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: VelocityServlet.init(ServletConfig config) question
>
>
> On 1/8/02 11:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:
>
> > We do have Craig M. hanging about on the commons, struts, and
> tomcat lists.
> > I feel quite confident based on all the servlet examples I've
> seen recently,
> > the Struts ActionServlet, etc., that it's safe to use
> "getServletConfig()"
> > to get the config from within the parameter-less init() call.
> It's not like
> > we need the servlet to be handling requests at that point - we're still
> > initializing. About the only important thing we have to depend
> upon is that
> > we can use getServletConfig().getInitParameter() and
> > getServletConfig().getServletContext().getInitParameter(); and
> I know those
> > work.
>
> I'm sure they work.
>
> That's not the question.
>
> The question is : when is init() called? When the rest of init(
> config ) is
> complete? Half way though? Before? (The last two, probably not, but you
> can't prove otherwise at the momment - and you can't appeal to the servlet
> impl here in jakarta, as other containers which implement the
> same API seem
> to be able to do it diffrerently.
>
> If you are counting on init( config ) to configure velocity and then in
> init() you want to work with Velocity, you better be right :)
I agree 100%. I guess I'm seeing the question a little differently now, as I
didn't think the issue was using init(config) *and* init(). I thought it was
using init(config) *or* init(). In the *or* case, if you used just init(),
you'd have to initialize Velocity right there before you did anything with
it. So of course you'd know that Velocity was initialized.
The point I was trying to make was that init(config) in VelocityServlet
should be deprecated and changed to just call super(config) and that all the
real work should be moved to a newly-implemented init().
As far as knowing the formal order of events, that's why I recommended
asking Craig M. Not because I want to know about the Tomcat implementation
in particular, but because he's close enough to the spec process for that
stuff to know if it's a realized ambiguity that's been addressed in an
addendum, if no one's realized it yet, if all the spec writers assumed we
ignorant masses should infer the obvious, etc. ;)
I'm sorry for jumping in when I didn't grok the problem completely.
Donnie
>
>
> >
> > I'd really recommend, pending Geir's satisfaction that the above is
> > accurate, that we not reinvent via a "postInit" method that which
> > essentially already exists.
>
> I'm a little surprised, coming from you, given your beliefs re protected
> members. If we use init(), as far as I can tell, we don't have a formal
> order of events that people can depend on.
>
> >
> > FWIW...
> >
> > Donnie
> >
> >
> >> -----Original Message-----
> >> From: Igor Fedulov [mailto:ifedulov@outlook.net]
> >> Sent: Tuesday, January 08, 2002 11:22 PM
> >> To: Velocity Users List
> >> Subject: Re: VelocityServlet.init(ServletConfig config) question
> >>
> >>
> >>
> >>>> That is why I asked the question cuz I figured that if there is no
> >>>> initOther or postInit() method anywhere I then should use
> >> parameterless
> >>>> init() and use getServletConfig() method to get the config
> >> instance, but I
> >>>> figured that I would rather ask what you guys think.
> >>>>
> >>>
> >>> I guess I wonder about init(), because I can't tell when it's getting
> >>> called. I mean, you need to know. It's not mentioned in the spec.
> >>
> >> I didn't dig out for specs but javadocs give a very short usage
> >> instruction and no underlying explanation of event chain. I assume that
> >> parameterless init() gotta be called from init(config) after
> all is done,
> >> but "assumption" is a root of all errors :) So I figured since I use
> >> parameterless init() already (I'm converting my controller
> >> servlet to Velocity powered one :)) I either have to leave
> everything "as
> >> is" crossing all fingers that I didn't overwrite anything
> vital, or write
> >> my own extension of VelocityServlet overriding loadConfig (ugly
> >> :() or ask you
> >> guys to add a postInit method to init(config) that you
> >> have implemented...
> >>
> >> Best regards,
> >> --
> >> HTTP is a stateless protocol, and the Internet is a stateless
> development
> >> environment
> >> --
> >> Igor Fedulov
> >> E-mail : ifedulov@outlook.net
> >> Work Ph: 773.775.1595
> >> Home Ph: 773.281.8938
> >> Cell Ph: 773.580.5935
> >>
> >>
> >>
> >>
> >> --
> >> 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>
> >
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> "We will be judged not by the monuments we build, but by the monuments we
> destroy" - Ada Louise Huxtable
>
>
> --
> 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: VelocityServlet.init(ServletConfig config) question
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/8/02 11:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:
> We do have Craig M. hanging about on the commons, struts, and tomcat lists.
> I feel quite confident based on all the servlet examples I've seen recently,
> the Struts ActionServlet, etc., that it's safe to use "getServletConfig()"
> to get the config from within the parameter-less init() call. It's not like
> we need the servlet to be handling requests at that point - we're still
> initializing. About the only important thing we have to depend upon is that
> we can use getServletConfig().getInitParameter() and
> getServletConfig().getServletContext().getInitParameter(); and I know those
> work.
I'm sure they work.
That's not the question.
The question is : when is init() called? When the rest of init( config ) is
complete? Half way though? Before? (The last two, probably not, but you
can't prove otherwise at the momment - and you can't appeal to the servlet
impl here in jakarta, as other containers which implement the same API seem
to be able to do it diffrerently.
If you are counting on init( config ) to configure velocity and then in
init() you want to work with Velocity, you better be right :)
>
> I'd really recommend, pending Geir's satisfaction that the above is
> accurate, that we not reinvent via a "postInit" method that which
> essentially already exists.
I'm a little surprised, coming from you, given your beliefs re protected
members. If we use init(), as far as I can tell, we don't have a formal
order of events that people can depend on.
>
> FWIW...
>
> Donnie
>
>
>> -----Original Message-----
>> From: Igor Fedulov [mailto:ifedulov@outlook.net]
>> Sent: Tuesday, January 08, 2002 11:22 PM
>> To: Velocity Users List
>> Subject: Re: VelocityServlet.init(ServletConfig config) question
>>
>>
>>
>>>> That is why I asked the question cuz I figured that if there is no
>>>> initOther or postInit() method anywhere I then should use
>> parameterless
>>>> init() and use getServletConfig() method to get the config
>> instance, but I
>>>> figured that I would rather ask what you guys think.
>>>>
>>>
>>> I guess I wonder about init(), because I can't tell when it's getting
>>> called. I mean, you need to know. It's not mentioned in the spec.
>>
>> I didn't dig out for specs but javadocs give a very short usage
>> instruction and no underlying explanation of event chain. I assume that
>> parameterless init() gotta be called from init(config) after all is done,
>> but "assumption" is a root of all errors :) So I figured since I use
>> parameterless init() already (I'm converting my controller
>> servlet to Velocity powered one :)) I either have to leave everything "as
>> is" crossing all fingers that I didn't overwrite anything vital, or write
>> my own extension of VelocityServlet overriding loadConfig (ugly
>> :() or ask you
>> guys to add a postInit method to init(config) that you
>> have implemented...
>>
>> Best regards,
>> --
>> HTTP is a stateless protocol, and the Internet is a stateless development
>> environment
>> --
>> Igor Fedulov
>> E-mail : ifedulov@outlook.net
>> Work Ph: 773.775.1595
>> Home Ph: 773.281.8938
>> Cell Ph: 773.580.5935
>>
>>
>>
>>
>> --
>> 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>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"We will be judged not by the monuments we build, but by the monuments we
destroy" - Ada Louise Huxtable
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Donnie Hale <do...@haleonline.net>.
We do have Craig M. hanging about on the commons, struts, and tomcat lists.
I feel quite confident based on all the servlet examples I've seen recently,
the Struts ActionServlet, etc., that it's safe to use "getServletConfig()"
to get the config from within the parameter-less init() call. It's not like
we need the servlet to be handling requests at that point - we're still
initializing. About the only important thing we have to depend upon is that
we can use getServletConfig().getInitParameter() and
getServletConfig().getServletContext().getInitParameter(); and I know those
work.
I'd really recommend, pending Geir's satisfaction that the above is
accurate, that we not reinvent via a "postInit" method that which
essentially already exists.
FWIW...
Donnie
> -----Original Message-----
> From: Igor Fedulov [mailto:ifedulov@outlook.net]
> Sent: Tuesday, January 08, 2002 11:22 PM
> To: Velocity Users List
> Subject: Re: VelocityServlet.init(ServletConfig config) question
>
>
>
> > > That is why I asked the question cuz I figured that if there is no
> > > initOther or postInit() method anywhere I then should use
> parameterless
> > > init() and use getServletConfig() method to get the config
> instance, but I
> > > figured that I would rather ask what you guys think.
> > >
> >
> > I guess I wonder about init(), because I can't tell when it's getting
> > called. I mean, you need to know. It's not mentioned in the spec.
>
> I didn't dig out for specs but javadocs give a very short usage
> instruction and no underlying explanation of event chain. I assume that
> parameterless init() gotta be called from init(config) after all is done,
> but "assumption" is a root of all errors :) So I figured since I use
> parameterless init() already (I'm converting my controller
> servlet to Velocity powered one :)) I either have to leave everything "as
> is" crossing all fingers that I didn't overwrite anything vital, or write
> my own extension of VelocityServlet overriding loadConfig (ugly
> :() or ask you
> guys to add a postInit method to init(config) that you
> have implemented...
>
> Best regards,
> --
> HTTP is a stateless protocol, and the Internet is a stateless development
> environment
> --
> Igor Fedulov
> E-mail : ifedulov@outlook.net
> Work Ph: 773.775.1595
> Home Ph: 773.281.8938
> Cell Ph: 773.580.5935
>
>
>
>
> --
> 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: VelocityServlet.init(ServletConfig config) question
Posted by Igor Fedulov <if...@outlook.net>.
> > That is why I asked the question cuz I figured that if there is no
> > initOther or postInit() method anywhere I then should use parameterless
> > init() and use getServletConfig() method to get the config instance, but I
> > figured that I would rather ask what you guys think.
> >
>
> I guess I wonder about init(), because I can't tell when it's getting
> called. I mean, you need to know. It's not mentioned in the spec.
I didn't dig out for specs but javadocs give a very short usage
instruction and no underlying explanation of event chain. I assume that
parameterless init() gotta be called from init(config) after all is done,
but "assumption" is a root of all errors :) So I figured since I use
parameterless init() already (I'm converting my controller
servlet to Velocity powered one :)) I either have to leave everything "as
is" crossing all fingers that I didn't overwrite anything vital, or write
my own extension of VelocityServlet overriding loadConfig (ugly :() or ask you
guys to add a postInit method to init(config) that you
have implemented...
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet.init(ServletConfig config) question
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/8/02 11:21 AM, "Igor Fedulov" <if...@outlook.net> wrote:
>
>> I still think that this could get confusing ( because I don't know when it's
>> getting called - I mean, after all other init( Config ) work is done? Are
>> things ready? Who can be sure? <this will be another note to the servlet
>> expert group after some research :) > )
>
> That is why I asked the question cuz I figured that if there is no
> initOther or postInit() method anywhere I then should use parameterless
> init() and use getServletConfig() method to get the config instance, but I
> figured that I would rather ask what you guys think.
>
I guess I wonder about init(), because I can't tell when it's getting
called. I mean, you need to know. It's not mentioned in the spec.
>> If right, we can solve Igor's problem with stated determinism by making a
>>
>> postInit( Config )
>>
>> Method that can be overridden with a clearly defined contract that it gets
>> called at the end of the init( config )
>>
>> Of course, this means that to ensure this, we need to do some other work if
>> you don't want us to be lazy and just have the current VelocityServlet call
>> it from the end of init( Config ) :)
>
> That would be lovely :)
Great :)
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Be a giant. Take giant steps. Do giant things...
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet.init(ServletConfig config) question
Posted by Igor Fedulov <if...@outlook.net>.
> I still think that this could get confusing ( because I don't know when it's
> getting called - I mean, after all other init( Config ) work is done? Are
> things ready? Who can be sure? <this will be another note to the servlet
> expert group after some research :) > )
That is why I asked the question cuz I figured that if there is no
initOther or postInit() method anywhere I then should use parameterless
init() and use getServletConfig() method to get the config instance, but I
figured that I would rather ask what you guys think.
> If right, we can solve Igor's problem with stated determinism by making a
>
> postInit( Config )
>
> Method that can be overridden with a clearly defined contract that it gets
> called at the end of the init( config )
>
> Of course, this means that to ensure this, we need to do some other work if
> you don't want us to be lazy and just have the current VelocityServlet call
> it from the end of init( Config ) :)
That would be lovely :)
Igor Fedulov
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Donnie Hale <do...@haleonline.net>.
Well,
The Struts ActionServlet just uses init(), so I'm guessing it's safe. Maybe
the spec gives more detail than the javadocs do, but I can't imagine you'd
not be allowed to do anything that you couldn't do after calling
"super.init(config)" as in the current init(config) method. If I had to
guess, the implementation of GenericServlet.init(config) is:
public void init(ServletConfig config)
throws ServletException, IOException
{
// whatever internal stuff it needs to do with config
init();
}
and the default implementation of init() is a no-op. I suppose I could be
real ambitious and look at the Tomcat code. :)
Donnie
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Tuesday, January 08, 2002 12:17 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: VelocityServlet.init(ServletConfig config) question
>
>
> On 1/8/02 12:09 AM, "Donnie Hale" <do...@haleonline.net> wrote:
>
> > Geir,
> >
> > Sorry I wasn't more precise. HttpServlet is derived from
> GenericServlet. So
> > we wouldn't have to change the class that VelocityServlet
> extends - it would
> > still be HttpServlet and have what people expect.
>
> I see.
>
> >
> > I was just trying to make the point that the parameter-less
> init() method is
> > available from the top of the servlet hierarchy on down and that the
> > javadocs for it are in the GenericServlet class, not HttpServlet. The
> > method's docs expressly state that it exists so people don't have to
> > remember to call super.init(config).
>
>
> Right -
>
> I still think that this could get confusing ( because I don't
> know when it's
> getting called - I mean, after all other init( Config ) work is done? Are
> things ready? Who can be sure? <this will be another note to the servlet
> expert group after some research :) > )
>
> Am I right, or just too tired again... ?
>
> If right, we can solve Igor's problem with stated determinism by making a
>
> postInit( Config )
>
> Method that can be overridden with a clearly defined contract that it gets
> called at the end of the init( config )
>
> Of course, this means that to ensure this, we need to do some
> other work if
> you don't want us to be lazy and just have the current
> VelocityServlet call
> it from the end of init( Config ) :)
>
> > Donnie
> >
> >
> >> -----Original Message-----
> >> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> >> Sent: Monday, January 07, 2002 11:37 PM
> >> To: velocity-user@jakarta.apache.org
> >> Subject: Re: VelocityServlet.init(ServletConfig config) question
> >>
> >>
> >> On 1/7/02 11:30 PM, "Donnie Hale" <do...@haleonline.net> wrote:
> >>
> >>> Geir,
> >>>
> >>> As of servlet 2.2, I think, there's an init() with no parameter
> >> that you can
> >>> override instead so that you don't have to remember to call
> >>> super.init(config). It's at the "GenericServlet" level, so you
> >> can extend
> >>> either that or HttpServlet and just override init().
> >>>
> >>> I'd think any/all Velocity servlets should probably move to that.
> >>>
> >>
> >> Hm. Not so sure would make as strong a statement, as the
> VelocityServlet
> >> also plays the role of teaching device (I was hoping that
> would be more th
> >> role :)
> >>
> >> So going to GenericServlet might be confusing for people new
> to Servlets,
> >> not seeing things like HttpServletRequest and HttpServletResponse
> >> in obvious
> >> places they expect.
> >>
> >> --
> >> Geir Magnusson Jr.
> geirm@optonline.net
> >> System and Software Consulting
> >> "Now what do we do?"
> >>
> >>
> >> --
> >> 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>
> >
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> "Now what do we do?"
>
>
> --
> 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: VelocityServlet.init(ServletConfig config) question
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/8/02 12:09 AM, "Donnie Hale" <do...@haleonline.net> wrote:
> Geir,
>
> Sorry I wasn't more precise. HttpServlet is derived from GenericServlet. So
> we wouldn't have to change the class that VelocityServlet extends - it would
> still be HttpServlet and have what people expect.
I see.
>
> I was just trying to make the point that the parameter-less init() method is
> available from the top of the servlet hierarchy on down and that the
> javadocs for it are in the GenericServlet class, not HttpServlet. The
> method's docs expressly state that it exists so people don't have to
> remember to call super.init(config).
Right -
I still think that this could get confusing ( because I don't know when it's
getting called - I mean, after all other init( Config ) work is done? Are
things ready? Who can be sure? <this will be another note to the servlet
expert group after some research :) > )
Am I right, or just too tired again... ?
If right, we can solve Igor's problem with stated determinism by making a
postInit( Config )
Method that can be overridden with a clearly defined contract that it gets
called at the end of the init( config )
Of course, this means that to ensure this, we need to do some other work if
you don't want us to be lazy and just have the current VelocityServlet call
it from the end of init( Config ) :)
> Donnie
>
>
>> -----Original Message-----
>> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
>> Sent: Monday, January 07, 2002 11:37 PM
>> To: velocity-user@jakarta.apache.org
>> Subject: Re: VelocityServlet.init(ServletConfig config) question
>>
>>
>> On 1/7/02 11:30 PM, "Donnie Hale" <do...@haleonline.net> wrote:
>>
>>> Geir,
>>>
>>> As of servlet 2.2, I think, there's an init() with no parameter
>> that you can
>>> override instead so that you don't have to remember to call
>>> super.init(config). It's at the "GenericServlet" level, so you
>> can extend
>>> either that or HttpServlet and just override init().
>>>
>>> I'd think any/all Velocity servlets should probably move to that.
>>>
>>
>> Hm. Not so sure would make as strong a statement, as the VelocityServlet
>> also plays the role of teaching device (I was hoping that would be more th
>> role :)
>>
>> So going to GenericServlet might be confusing for people new to Servlets,
>> not seeing things like HttpServletRequest and HttpServletResponse
>> in obvious
>> places they expect.
>>
>> --
>> Geir Magnusson Jr. geirm@optonline.net
>> System and Software Consulting
>> "Now what do we do?"
>>
>>
>> --
>> 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>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Now what do we do?"
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Donnie Hale <do...@haleonline.net>.
Geir,
Sorry I wasn't more precise. HttpServlet is derived from GenericServlet. So
we wouldn't have to change the class that VelocityServlet extends - it would
still be HttpServlet and have what people expect.
I was just trying to make the point that the parameter-less init() method is
available from the top of the servlet hierarchy on down and that the
javadocs for it are in the GenericServlet class, not HttpServlet. The
method's docs expressly state that it exists so people don't have to
remember to call super.init(config).
Donnie
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Monday, January 07, 2002 11:37 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: VelocityServlet.init(ServletConfig config) question
>
>
> On 1/7/02 11:30 PM, "Donnie Hale" <do...@haleonline.net> wrote:
>
> > Geir,
> >
> > As of servlet 2.2, I think, there's an init() with no parameter
> that you can
> > override instead so that you don't have to remember to call
> > super.init(config). It's at the "GenericServlet" level, so you
> can extend
> > either that or HttpServlet and just override init().
> >
> > I'd think any/all Velocity servlets should probably move to that.
> >
>
> Hm. Not so sure would make as strong a statement, as the VelocityServlet
> also plays the role of teaching device (I was hoping that would be more th
> role :)
>
> So going to GenericServlet might be confusing for people new to Servlets,
> not seeing things like HttpServletRequest and HttpServletResponse
> in obvious
> places they expect.
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> "Now what do we do?"
>
>
> --
> 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: VelocityServlet.init(ServletConfig config) question
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/7/02 11:30 PM, "Donnie Hale" <do...@haleonline.net> wrote:
> Geir,
>
> As of servlet 2.2, I think, there's an init() with no parameter that you can
> override instead so that you don't have to remember to call
> super.init(config). It's at the "GenericServlet" level, so you can extend
> either that or HttpServlet and just override init().
>
> I'd think any/all Velocity servlets should probably move to that.
>
Hm. Not so sure would make as strong a statement, as the VelocityServlet
also plays the role of teaching device (I was hoping that would be more th
role :)
So going to GenericServlet might be confusing for people new to Servlets,
not seeing things like HttpServletRequest and HttpServletResponse in obvious
places they expect.
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Now what do we do?"
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: VelocityServlet.init(ServletConfig config) question
Posted by Donnie Hale <do...@haleonline.net>.
Geir,
As of servlet 2.2, I think, there's an init() with no parameter that you can
override instead so that you don't have to remember to call
super.init(config). It's at the "GenericServlet" level, so you can extend
either that or HttpServlet and just override init().
I'd think any/all Velocity servlets should probably move to that.
See:
http://java.sun.com/j2ee/j2sdkee/techdocs/api/javax/servlet/GenericServlet.h
tml
Donnie
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Monday, January 07, 2002 11:08 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: VelocityServlet.init(ServletConfig config) question
>
>
> On 1/7/02 2:00 PM, "Igor Fedulov" <if...@outlook.net> wrote:
>
> >
> > Question:
> > If I want to do some application specific initialization from MyServlet
> > which extends VelocityServlet where should I put my init code? I was
> > looking through the source and I would love to have an abstract
> hook like
> > initOther(config) placed right after initVelocity(config); in
> > init(config), or should I just simply put everything into
> > parameterless init() ?
>
>
> Well, the conventional approach would be
>
> public void init( ServletConfig config )
> throws ServletException
> {
> super.init( config );
>
> // your stuff here
> }
>
>
> This is an interesting question, especially re our conversation
> yesterday re
> Donnie's revulsion about protected members.
>
> We seem to have the same thing here : the contract of VelocityServlet can
> be seriously broken if you override init() and forget to invoke
> super.init()
>
> We could add postInit( config ) to be called at the end of
> init(), making it
> easier to ensure that people won't forget.
>
> However, this bothers me :)
>
>
> --
> 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>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet.init(ServletConfig config) question
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/7/02 2:00 PM, "Igor Fedulov" <if...@outlook.net> wrote:
>
> Question:
> If I want to do some application specific initialization from MyServlet
> which extends VelocityServlet where should I put my init code? I was
> looking through the source and I would love to have an abstract hook like
> initOther(config) placed right after initVelocity(config); in
> init(config), or should I just simply put everything into
> parameterless init() ?
Well, the conventional approach would be
public void init( ServletConfig config )
throws ServletException
{
super.init( config );
// your stuff here
}
This is an interesting question, especially re our conversation yesterday re
Donnie's revulsion about protected members.
We seem to have the same thing here : the contract of VelocityServlet can
be seriously broken if you override init() and forget to invoke super.init()
We could add postInit( config ) to be called at the end of init(), making it
easier to ensure that people won't forget.
However, this bothers me :)
--
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: VelocityServlet.init(ServletConfig config) question
Posted by Nick Bauman <ni...@cortexity.com>.
Because my framework must support both JSP and Velocity, I couldn't extend
VelocityServlet.java. Instead I rolled my own Servlet which handles both
in a correct MVC-way. Its goal is to become view-language agnostic. It's
called DynoDispatcher.java. It has a BSD-style license so copy, paste,
use, abuse, fold, spindel, mutilate at will.
http://www.cortexity.com/cgi-
py/viewcvs.cgi/ttmor/src/com/cortexity/servlet/DynoDispatcher.java?
rev=1.38&content-type=text/vnd.viewcvs-markup
The project DynoDispatcher.java participates in is called 2TMOR:
http://www.cortexity.com/projects/ttmor/
It's almost ready for a 1.0 release.
>
>> I put everything for init in the loadConfiguration() method,
>> overriding the VelocityServlet version of the method. You generally
>> have this method anyway to set the correct paths for the file resource
>> loader and velocity.properties file (see servlet example 2). This
>> method is called by the init() method of VelocityServlet, so it is run
>> at the time of servlet initialization only.
>
> Thanks, I saw that example, but the thing I'm trying to say is
> that if you look at doRequest(request, response) method of
> VelocityServlet it has a call to empty method requestCleanup(request,
> response, context) which could be overriden by subclass. The same way
> if I add call to initOther(config) method to init(config) method right
> after
> initVelocity(config) I will not have to duplicate any code which is
> already present in superclass, i.e. when you override loadConfiguration
> you are writting super.loadConfiguration(config) in your own version of
> loadConfiguration in each derivative version, that is what I want to
> avoid.
>
> Best regards,
> --
> HTTP is a stateless protocol, and the Internet is a stateless
> development environment
> --
> Igor Fedulov
> E-mail : ifedulov@outlook.net
> Work Ph: 773.775.1595
> Home Ph: 773.281.8938
> Cell Ph: 773.580.5935
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>
--
Nick Bauman
Cortexity Development
Intellectual Process is more important than
Intellectual Property -- you'll see.
http://www.cortexity.com/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet.init(ServletConfig config) question
Posted by Igor Fedulov <if...@outlook.net>.
> I put everything for init in the loadConfiguration() method, overriding
> the VelocityServlet version of the method. You generally have this method
> anyway to set the correct paths for the file resource loader and
> velocity.properties file (see servlet example 2). This method is called
> by the init() method of VelocityServlet, so it is run at the time of
> servlet initialization only.
Thanks, I saw that example, but the thing I'm trying to say is
that if you look at doRequest(request, response) method of VelocityServlet
it has a call to empty method requestCleanup(request, response, context)
which could be overriden by subclass. The same way if I add call to
initOther(config) method to init(config) method right after
initVelocity(config) I will not have to duplicate any code which is already
present in superclass, i.e. when you override loadConfiguration you are
writting super.loadConfiguration(config) in your own version of
loadConfiguration in each derivative version, that is what I want to avoid.
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet.init(ServletConfig config) question
Posted by Barbara Baughman <ba...@utdallas.edu>.
I put everything for init in the loadConfiguration() method, overriding
the VelocityServlet version of the method. You generally have this method
anyway to set the correct paths for the file resource loader and
velocity.properties file (see servlet example 2). This method is called
by the init() method of VelocityServlet, so it is run at the time of
servlet initialization only.
Barbara Baughman
University of Texas at Dallas
Systems Analyst
On Mon, 7 Jan 2002, Igor Fedulov wrote:
>
> Question:
> If I want to do some application specific initialization from MyServlet
> which extends VelocityServlet where should I put my init code? I was
> looking through the source and I would love to have an abstract hook like
> initOther(config) placed right after initVelocity(config); in
> init(config), or should I just simply put everything into
> parameterless init() ?
>
> --
> Best regards,
> --
> HTTP is a stateless protocol, and the Internet is a stateless development
> environment
> --
> Igor Fedulov
> E-mail : ifedulov@outlook.net
> Work Ph: 773.775.1595
> Home Ph: 773.281.8938
> Cell Ph: 773.580.5935
>
>
>
>
> --
> 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>