/** * Sets the modifiable list of required client protocols. This method clears * the current list and adds all entries in the parameter list. * * @param clientProtocols * A list of required client protocols. */ public void setClientProtocols(List<Protocol> clientProtocols) { synchronized (getClientProtocols()) { if (clientProtocols != getClientProtocols()) { getClientProtocols().clear(); if (clientProtocols != null) { getClientProtocols().addAll(clientProtocols); } } } }
/** * Returns the connector service associated to a request. * * @return The connector service associated to a request. */ public static org.restlet.service.ConnectorService getConnectorService() { org.restlet.service.ConnectorService result = null; org.restlet.Application application = org.restlet.Application .getCurrent(); if (application != null) { result = application.getConnectorService(); } else { result = new org.restlet.service.ConnectorService(); } return result; }
@Override public Restlet createInboundRoot() { getConnectorService().getClientProtocols().add(Protocol.CLAP); getConnectorService().getServerProtocols().add(Protocol.HTTP); final Directory directory = new Directory(getContext(), "clap://class"); directory.setListingAllowed(true); directory.setDeeplyAccessible(true); return directory; } };
connectorService.beforeSend(responseEntity); connectorService.afterSend(responseEntity);
/** * Sets the modifiable list of required server protocols. This method clears * the current list and adds all entries in the parameter list. * * @param serverProtocols * A list of required server protocols. */ public void setServerProtocols(List<Protocol> serverProtocols) { synchronized (getServerProtocols()) { if (serverProtocols != getServerProtocols()) { getServerProtocols().clear(); if (serverProtocols != null) { getServerProtocols().addAll(serverProtocols); } } } }
if (isStarted()) { if (getConnectorService() != null) { getConnectorService().stop();
getConnectorService().start();
.getConnectorService(); if (connectorService != null) { connectorService.beforeSend(entity); connectorService.afterSend(entity);
/** * Constructor. * * @throws IOException */ public Application() throws IOException { // List of protocols required by the application. getConnectorService().getClientProtocols().add(Protocol.FILE); getConnectorService().getClientProtocols().add(Protocol.CLAP); getConnectorService().getClientProtocols().add(Protocol.HTTP); // Look for the configuration file in the classpath Properties properties = getProperties("clap://class/config/foafApplication.properties"); this.webRootPath = properties.getProperty("web.root.path"); /** Create and chain the Objects and Data facades. */ this.dataFacade = new ObjectsFacade(new ListFacade()); try { final File templateDir = new File(webRootPath + "/tmpl"); this.fmc = new freemarker.template.Configuration(); this.fmc.setDirectoryForTemplateLoading(templateDir); } catch (Exception e) { getLogger().severe("Unable to configure FreeMarker."); e.printStackTrace(); } getMetadataService().addExtension("rdf", MediaType.APPLICATION_RDF_XML, true); getTunnelService().setExtensionsTunnel(true); }
.getClientProtocols() != null) { for (Protocol clientProtocol : application .getConnectorService().getClientProtocols()) { boolean clientFound = false; .getServerProtocols() != null) { for (Protocol serverProtocol : application .getConnectorService().getServerProtocols()) { boolean serverFound = false;
/** * Constructor. * * @param context * The context to use based on parent component context. This * context should be created using the * {@link Context#createChildContext()} method to ensure a proper * isolation with the other applications. */ @SuppressWarnings("deprecation") public Application(Context context) { super(context); if (Engine.getInstance() != null) { this.helper = Engine.getInstance().createHelper(this); } this.name = null; this.description = null; this.author = null; this.owner = null; this.root = null; this.connectorService = new ConnectorService(); this.converterService = new org.restlet.service.ConverterService(); this.decoderService = new DecoderService(); this.metadataService = new MetadataService(); this.rangeService = new RangeService(); this.statusService = new StatusService(); this.taskService = new TaskService(); this.tunnelService = new TunnelService(true, true); }
/** * Default Constructor. * * Adds the necessary file protocols and sets up the template location. */ public OasRestletExampleTestApplication() { // List of protocols required by the application this.getConnectorService().getClientProtocols().add(Protocol.HTTP); this.getConnectorService().getClientProtocols().add(Protocol.CLAP); // Define extensions for RDF and Javascript // getMetadataService().addExtension("rdf", MediaType.APPLICATION_RDF_XML, true); // getMetadataService().addExtension("json", MediaType.APPLICATION_JSON, true); // getMetadataService().addExtension("ttl", MediaType.APPLICATION_RDF_TURTLE, true); // getMetadataService().addExtension("n3", MediaType.TEXT_RDF_N3, true); // getMetadataService().addExtension("nt", MediaType.TEXT_RDF_NTRIPLES, true); // // this.getMetadataService().addExtension("js", MediaType.TEXT_JAVASCRIPT, true); // Automagically tunnel client preferences for extensions through the // tunnel // getTunnelService().setExtensionsTunnel(true); }
this.services.add(new EncoderService(false)); this.services.add(new RangeService()); this.services.add(new ConnectorService()); this.services.add(connegService); this.services.add(converterService);
this.getConnectorService().getClientProtocols().add(Protocol.HTTP); this.getConnectorService().getClientProtocols().add(Protocol.CLAP);
.getChild(); if (!application.getConnectorService().getClientProtocols() .contains(protocol)) { getLogger()