/** * Starts the associated services. * * @throws Exception */ protected synchronized void startServices() throws Exception { if (getLogService() != null) { getLogService().start(); } if (getStatusService() != null) { getStatusService().start(); } }
/** * Stops the associated services. * * @throws Exception */ protected synchronized void stopServices() throws Exception { if (getLogService() != null) { getLogService().stop(); } if (getStatusService() != null) { getStatusService().stop(); } }
@Override protected Component createComponent() { Component component = super.createComponent(); // a bit more configuration by initParams LogService log = component.getLogService(); // allow access to the LogService in the application via the context component.getContext().getAttributes().put(LogService.class.getName(), log); // modify the logger name String loggerName = getInitParameter(LOGGER_NAME_ATTRIBUTE, LOGGER_NAME_ATTRIBUTE_DEFAULT_VALUE); log.setLoggerName(loggerName); // modify the logger pattern // note: overridden to be smaller than the restlet default value log.setResponseLogFormat(getInitParameter(LOGGER_FORMAT_ATTRIBUTE, LOGGER_FORMAT_ATTRIBUTE_DEFAULT_VALUE)); return component; } }
getLogService().setLogFormat(item.getNodeValue()); getLogService().setLoggerName(item.getNodeValue()); getLogService().setEnabled(getBoolean(item, true)); getLogService().setIdentityCheck( getBoolean(item, true));
getComponent().getLogService() .setResponseLogFormat(item.getNodeValue()); getComponent().getLogService().setLoggerName( item.getNodeValue()); getComponent().getLogService().setEnabled( getBoolean(item, true)); getComponent().getLogService().setIdentityCheck( getBoolean(item, true));
/** * Constructor. */ public Component() { super(); this.hosts = new CopyOnWriteArrayList<VirtualHost>(); this.clients = new ClientList(null); this.servers = new ServerList(null, this); this.realms = new CopyOnWriteArrayList<Realm>(); this.services = new ServiceList(getContext()); if (Engine.getInstance() != null) { // To be done before setting the helper... this.services.add(new org.restlet.service.TaskService()); this.helper = new ComponentHelper(this); Context childContext = getContext().createChildContext(); this.defaultHost = new VirtualHost(childContext); this.internalRouter = new InternalRouter(childContext); this.services.add(new LogService()); getLogService().setContext(childContext); this.services.add(new StatusService()); getStatusService().setContext(childContext); this.clients.setContext(childContext); this.servers.setContext(childContext); } }