List of usage examples for org.springframework.web.context.support WebApplicationContextUtils findWebApplicationContext
@Nullable public static WebApplicationContext findWebApplicationContext(ServletContext sc)
From source file:org.unitedinternet.cosmo.dav.provider.CalendarCollectionProvider.java
/** * @param collectionItem//from w ww .j a v a 2 s .co m * @return */ private Calendar getCalendarFromCollection(DavRequest req, CollectionItem collectionItem) { Calendar result = new Calendar(); if (productId == null) { synchronized (this) { if (productId == null) { Environment environment = WebApplicationContextUtils .findWebApplicationContext(req.getServletContext()).getEnvironment(); productId = environment.getProperty(PRODUCT_ID_KEY); } } } result.getProperties().add(new ProdId(productId)); result.getProperties().add(Version.VERSION_2_0); result.getProperties().add(CalScale.GREGORIAN); for (Item item : collectionItem.getChildren()) { if (!NoteItem.class.isInstance(item)) { continue; } for (Stamp s : item.getStamps()) { if (BaseEventStamp.class.isInstance(s)) { BaseEventStamp baseEventStamp = BaseEventStamp.class.cast(s); result.getComponents().add(baseEventStamp.getEvent()); } } } return result; }