/** * This implementation supports pattern matching in unexpanded WARs too. * @see PortletContextResourcePatternResolver */ @Override protected ResourcePatternResolver getResourcePatternResolver() { return new PortletContextResourcePatternResolver(this); }
/** * Recursively retrieve PortletContextResources that match the given pattern, * adding them to the given result set. * @param portletContext the PortletContext to work on * @param fullPattern the pattern to match against, * with preprended root directory path * @param dir the current directory * @param result the Set of matching Resources to add to * @throws IOException if directory contents could not be retrieved * @see org.springframework.web.portlet.context.PortletContextResource * @see javax.portlet.PortletContext#getResourcePaths */ protected void doRetrieveMatchingPortletContextResources( PortletContext portletContext, String fullPattern, String dir, Set<Resource> result) throws IOException { Set<String> candidates = portletContext.getResourcePaths(dir); if (candidates != null) { boolean dirDepthNotFixed = fullPattern.contains("**"); for (Iterator<String> it = candidates.iterator(); it.hasNext();) { String currPath = it.next(); if (currPath.endsWith("/") && (dirDepthNotFixed || StringUtils.countOccurrencesOf(currPath, "/") <= StringUtils.countOccurrencesOf(fullPattern, "/"))) { doRetrieveMatchingPortletContextResources(portletContext, fullPattern, currPath, result); } if (getPathMatcher().match(fullPattern, currPath)) { result.add(new PortletContextResource(portletContext, currPath)); } } } }
/** * Overridden version which checks for PortletContextResource * and uses {@code PortletContext.getResourcePaths} to find * matching resources below the web application root directory. * In case of other resources, delegates to the superclass version. * @see #doRetrieveMatchingPortletContextResources * @see PortletContextResource * @see javax.portlet.PortletContext#getResourcePaths */ @Override protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern) throws IOException { if (rootDirResource instanceof PortletContextResource) { PortletContextResource pcResource = (PortletContextResource) rootDirResource; PortletContext pc = pcResource.getPortletContext(); String fullPattern = pcResource.getPath() + subPattern; Set<Resource> result = new HashSet<Resource>(); doRetrieveMatchingPortletContextResources(pc, fullPattern, pcResource.getPath(), result); return result; } return super.doFindPathMatchingFileResources(rootDirResource, subPattern); }
/** * Recursively retrieve PortletContextResources that match the given pattern, * adding them to the given result set. * @param portletContext the PortletContext to work on * @param fullPattern the pattern to match against, * with preprended root directory path * @param dir the current directory * @param result the Set of matching Resources to add to * @throws IOException if directory contents could not be retrieved * @see org.springframework.web.portlet.context.PortletContextResource * @see javax.portlet.PortletContext#getResourcePaths */ protected void doRetrieveMatchingPortletContextResources( PortletContext portletContext, String fullPattern, String dir, Set<Resource> result) throws IOException { Set candidates = portletContext.getResourcePaths(dir); if (candidates != null) { boolean dirDepthNotFixed = fullPattern.contains("**"); for (Iterator it = candidates.iterator(); it.hasNext();) { String currPath = (String) it.next(); if (currPath.endsWith("/") && (dirDepthNotFixed || StringUtils.countOccurrencesOf(currPath, "/") <= StringUtils.countOccurrencesOf(fullPattern, "/"))) { doRetrieveMatchingPortletContextResources(portletContext, fullPattern, currPath, result); } if (getPathMatcher().match(fullPattern, currPath)) { result.add(new PortletContextResource(portletContext, currPath)); } } } }
/** * Overridden version which checks for PortletContextResource * and uses <code>PortletContext.getResourcePaths</code> to find * matching resources below the web application root directory. * In case of other resources, delegates to the superclass version. * @see #doRetrieveMatchingPortletContextResources * @see org.springframework.web.portlet.context.PortletContextResource * @see javax.portlet.PortletContext#getResourcePaths */ @Override protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern) throws IOException { if (rootDirResource instanceof PortletContextResource) { PortletContextResource pcResource = (PortletContextResource) rootDirResource; PortletContext pc = pcResource.getPortletContext(); String fullPattern = pcResource.getPath() + subPattern; Set<Resource> result = new HashSet<Resource>(); doRetrieveMatchingPortletContextResources(pc, fullPattern, pcResource.getPath(), result); return result; } return super.doFindPathMatchingFileResources(rootDirResource, subPattern); }
/** * This implementation supports pattern matching in unexpanded WARs too. * @see PortletContextResourcePatternResolver */ @Override protected ResourcePatternResolver getResourcePatternResolver() { return new PortletContextResourcePatternResolver(this); }
/** * This implementation supports pattern matching in unexpanded WARs too. * @see PortletContextResourcePatternResolver */ @Override protected ResourcePatternResolver getResourcePatternResolver() { return new PortletContextResourcePatternResolver(this); }
/** * This implementation supports pattern matching in unexpanded WARs too. * @see PortletContextResourcePatternResolver */ @Override protected ResourcePatternResolver getResourcePatternResolver() { return new PortletContextResourcePatternResolver(this); }
/** {@inheritDoc} */ @Override public void initialize(PortletContext context) { super.initialize(context); resolver = new PortletContextResourcePatternResolver(context); }
/** {@inheritDoc} */ @Override public void initialize(PortletContext context) { super.initialize(context); resolver = new PortletContextResourcePatternResolver(context); }