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";