/** * Creates a outbound root Restlet that will receive all outgoing calls from * ClientResource. In general, instances of {@link Router} and * {@link Filter} classes will be used. The default implementation returns a * Restlet giving access to the the outbound service layer and finally to * the {@link Context#getClientDispatcher()}. * <p> * This method is intended to be overridden by subclasses but in order to * benefit from the outbound service filtering layer, the original outbound * root must be careful attached again at the end of the user filtering * layer. * * @return The outbound root Restlet. */ public Restlet createOutboundRoot() { return getHelper().getFirstOutboundFilter(); }
@Override public void setContext(Context context) { super.setContext(context); getHelper().setContext(context); getServices().setContext(context); }
/** * Starts the application, all the enabled associated services then the * inbound and outbound roots. */ @Override public synchronized void start() throws Exception { if (isStopped()) { if (isDebugging()) { getLogger().log( Level.INFO, "Starting " + getClass().getName() + " application in debug mode"); } else { getLogger().log(Level.INFO, "Starting " + getClass().getName() + " application"); } if (getHelper() != null) { getHelper().start(); } getServices().start(); if (getInboundRoot() != null) { getInboundRoot().start(); } if (getOutboundRoot() != null) { getOutboundRoot().start(); } // Must be invoked as a last step super.start(); } }
/** * Stops the application, the inbound and outbound roots then all the * enabled associated services. Finally, it clears the internal cache of * annotations. */ @Override public synchronized void stop() throws Exception { if (isStarted()) { // Must be invoked as a first step super.stop(); if (getOutboundRoot() != null) { getOutboundRoot().stop(); } if (getInboundRoot() != null) { getInboundRoot().stop(); } getServices().stop(); if (getHelper() != null) { getHelper().stop(); } // Clear the annotations cache AnnotationUtils.getInstance().clearCache(); } }