Richard-
Thanks for the suggestion. My ultimate goal is to be able to configure
the logService, as well as a lot of other stuff with a Spring
configuation.

On 8/30/07, Richard Bronkhorst <[EMAIL PROTECTED]> wrote:
> Hi tom,
>
> I had this same problem. I subclassed ServerServlet and used the new
> class in my web.xml.
> Then i overrided init:
> public void init() throws ServletException {
>                 super.init();
>                 this.getComponent().getClients().add(new 
> Client(Protocol.FILE));
>                 this.getComponent().setLogService(new LogService(false));
> }
>
> Hope this helps
>
> Richard
>
> On 8/29/07, Tom McGee <[EMAIL PROTECTED]> wrote:
> > To access and/or replace the logService.
> >
> > On 8/29/07, Thierry Boileau <[EMAIL PROTECTED]> wrote:
> > > Hi Tom,
> > >
> > > could tell us why you need to get the inner component?
> > >
> > > best regards,
> > > Thierry Boileau
> > > > I need to get the Component from an Application created by
> > > > ServerServlet. I'm currently using this code:
> > > >
> > > >
> > > >
> > > > public abstract class AbstractSpringRestletApplication extends 
> > > > Application {
> > > >
> > > > …
> > > >
> > > >    public ServletContext getServletContext(){
> > > >
> > > >       ServletContext result = null;
> > > >
> > > >          if ((this.getContext()!=null)&&(this.getContext() instanceof
> > > >
> > > >                ServletContextAdapter)) {
> > > >
> > > >                                     result =
> > > >
> > > >         ((ServletContextAdapter)this.getContext()).getServletContext();
> > > >
> > > >                }
> > > >
> > > >                return result;
> > > >
> > > >    }
> > > >
> > > > …
> > > >
> > > >    private Component component;
> > > >
> > > >
> > > >
> > > >    private void setComponent(Component c){
> > > >
> > > >      this.component = c;
> > > >
> > > >    }
> > > >
> > > > …
> > > >
> > > >             if(this.getServletContext() != null){
> > > >
> > > >
> > > > setComponent((Component)this.getServletContext().getAttribute("com.noelios.restlet.ext.servlet.ServerServlet.component"));
> > > >
> > > >             }
> > > >
> > > > …
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > Is there a better way of doing this?
> > > > If not could you make this in ServerServlet public:
> > > >  private static final String NAME_COMPONENT_ATTRIBUTE_DEFAULT =
> > > > "com.noelios.restlet.ext.servlet.ServerServlet.component";
> > > >
> > > >
> > >
> >
>
>
> --
> Richard Bronkhorst
> Software Developer
>
> Noterik BV
> P.O. Box 15189
> 1001 MD Amsterdam
> The Netherlands
>
> T: +31 (0)20 5929 966
> F: +31 (0)20 5929 969
>
> www.noterik.com / www.noterik.nl / www.streamedit.com
>

Reply via email to