List of usage examples for org.springframework.core.io ClassPathResource getURI
@Override public URI getURI() throws IOException
From source file:org.fusesource.stompjms.JmsTestSupport.java
protected Broker createBroker() throws Exception { ClassPathResource resource = new ClassPathResource(BROKER_CONFIG); return BrokerFactory.createBroker(resource.getURI().toString()); }
From source file:com.github.persapiens.jsfboot.jetty.JsfJettyServerCustomizer.java
@Override public void customize(Server server) { Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); final WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; try {//from w ww . java 2 s.c o m ClassPathResource classPathResource = new ClassPathResource( this.jettyProperties.getClassPathResource()); webAppContext.setBaseResource(new ResourceCollection(classPathResource.getURI().toString())); AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { webAppContext.setClassLoader(new URLClassLoader(new URL[0], this.getClass().getClassLoader())); return null; } }); LOGGER.info( "Setting Jetty classLoader to " + this.jettyProperties.getClassPathResource() + " directory"); } catch (IOException exception) { LOGGER.error("Unable to configure Jetty classLoader to " + this.jettyProperties.getClassPathResource() + " directory " + exception.getMessage()); throw new RuntimeException(exception); } }
From source file:org.openehealth.ipf.commons.ihe.ws.server.TestServers.java
private void checkServer(ServletServer server, int port) throws Exception { ClassPathResource contextResource = new ClassPathResource("test.xml"); server.setServlet(new Servlet()); server.setPort(port);/*from w w w .j a v a 2 s. c om*/ server.setContextPath("/testContext"); server.setServletPath("/testServlet/*"); server.setContextResource(contextResource.getURI().toString()); server.start(); checkPostRequest(port); server.stop(); }