@Get public Representation getAPIInfo() throws IOException { TemplateRepresentation r = new TemplateRepresentation("net/ontopia/topicmaps/rest/resources/info.html", MediaType.TEXT_HTML); r.getEngine().addProperty(VelocityEngine.RESOURCE_LOADER, "classpath"); r.getEngine().addProperty("classpath." + VelocityEngine.RESOURCE_LOADER + ".class", ClasspathResourceLoader.class.getName()); Map<Restlet, String> allRoutes = new HashMap<>(); list(allRoutes, getApplication().getInboundRoot(), ""); Map<String, Object> data = new HashMap<>(); data.put("util", this); data.put("root", getApplication().getInboundRoot()); data.put("routes", allRoutes); data.put("cutil", ClassUtils.class); r.setDataModel(data); return r; }
/** * 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(); } }
application.getInboundRoot(), null /*
application.getInboundRoot(), null /*
application.getInboundRoot(), null /*
application.getInboundRoot(), null /*
application.getInboundRoot(), null /*
Reference ref = new Reference("riap://application" + HttpOAuthHelper.getAuthPage(getContext())); getLogger().fine("Name = " + getApplication().getInboundRoot()); ref.addQueryParameter("client", session.getClientId());
setInboundNext(getHelped().getInboundRoot());
request.getResourceRef().setBaseRef( request.getResourceRef().getHostIdentifier()); application.getInboundRoot().handle(request, response);