/** * Returns a class for a given qualified class name. * * @param className * The class name to lookup. * @return The class object. * @throws ClassNotFoundException */ protected Class<?> loadClass(String className) throws ClassNotFoundException { return Engine.loadClass(className); }
.getFirstValue("adapter", "org.restlet.engine.adapter.ServerAdapter"); this.adapter = (ServerAdapter) Engine.loadClass(adapterClass) .getConstructor(Context.class) .newInstance(getContext());
/** * Creates a finder for the given resource info. By default, it looks up for * an "id" attribute containing a fully qualified class name. * * @param router * The parent router. * @param resourceInfo * The WADL resource descriptor. * @return The created finder. * @throws ClassNotFoundException */ @SuppressWarnings("unchecked") protected Finder createFinder(Router router, String uriPattern, ResourceInfo resourceInfo) throws ClassNotFoundException { Finder result = null; if (resourceInfo.getIdentifier() != null) { // The "id" attribute conveys the target class name Class<? extends ServerResource> targetClass = (Class<? extends ServerResource>) Engine .loadClass(resourceInfo.getIdentifier()); result = router.createFinder(targetClass); } else { getLogger() .fine("Unable to find the 'id' attribute of the resource element with this path attribute \"" + uriPattern + "\""); } return result; }
if (jaxRsProvider instanceof String) { try { jaxRsProvider = Engine.loadClass((String) jaxRsProvider) .newInstance(); } catch (ClassNotFoundException e) {
try { X509HostnameVerifier hostnameVerifier = (X509HostnameVerifier) Engine .loadClass(getHostnameVerifier()).newInstance(); sslSocketFactory.setHostnameVerifier(hostnameVerifier); } catch (Exception e) {
/** * Configures the HTTP client. By default, it try to set the retry handler. * * @param httpClient * The HTTP client to configure. */ protected void configure(DefaultHttpClient httpClient) { if (getRetryHandler() != null) { try { HttpRequestRetryHandler retryHandler = (HttpRequestRetryHandler) Engine .loadClass(getRetryHandler()).newInstance(); this.httpClient.setHttpRequestRetryHandler(retryHandler); } catch (Exception e) { getLogger() .log(Level.WARNING, "An error occurred during the instantiation of the retry handler.", e); } } CookieSpecRegistry csr = new CookieSpecRegistry(); csr.register("ignore", new IgnoreCookieSpecFactory()); this.httpClient.setCookieSpecs(csr); }
final Class<?> targetClass = Engine.loadClass(targetClassName);
this.httpMethod.getParams().setParameter( HttpMethodParams.RETRY_HANDLER, Engine.loadClass( this.clientHelper.getRetryHandler()) .newInstance());
final Class<?> targetClass = Engine.loadClass(targetClassName);