List of usage examples for org.springframework.web.context.request NativeWebRequest getContextPath
String getContextPath();
From source file:architecture.ee.web.spring.controller.SecureMoSKitoController.java
@RequestMapping(value = "/stage/more/list_library.json", method = { RequestMethod.POST, RequestMethod.GET }) @ResponseBody//from w w w.j a v a 2s. co m public List<LibraryObject> getLibraries(NativeWebRequest request) throws Exception { ArrayList<LibraryObject> aBeans = new ArrayList<LibraryObject>(); String context = request.getContextPath(); if (StringUtils.isEmpty(context)) context = "/"; List<URL> classpath = getClassPathUrls(context); for (URL url : classpath) { String fileName = url.getFile(); if (!fileName.endsWith(".jar")) continue; File f = new File(fileName); LibraryObject bean = new LibraryObject(); int lastSlash = fileName.lastIndexOf('/'); try { bean.setName(fileName.substring(lastSlash + 1)); bean.setMavenVersion(MavenVersionReader.readVersionFromJar(f)); if (bean.getMavenVersion() == null) { bean.setLastModified(new Date(f.lastModified())); } } catch (Exception e) { log.warn("couldn't obtain lib version, skipped this url " + url, e); } aBeans.add(bean); } return aBeans; }