001
014
015 package com.liferay.portal.kernel.url;
016
017 import com.liferay.portal.kernel.util.ReflectionUtil;
018
019 import java.net.MalformedURLException;
020 import java.net.URL;
021
022 import java.util.Set;
023
024 import javax.servlet.ServletContext;
025
026
029 public class ServletContextURLContainer implements URLContainer {
030
031 public ServletContextURLContainer(ServletContext servletContext) {
032 _servletContext = servletContext;
033 }
034
035 @Override
036 public URL getResource(String name) {
037 try {
038 return _servletContext.getResource(name);
039 }
040 catch (MalformedURLException mue) {
041 return ReflectionUtil.throwException(mue);
042 }
043 }
044
045 @Override
046 public Set<String> getResources(String path) {
047 return _servletContext.getResourcePaths(path);
048 }
049
050 private final ServletContext _servletContext;
051
052 }