当前位置: 首页 > wzjs >正文

jsp语言做网站网站备案时 首页

jsp语言做网站,网站备案时 首页,seo百度发包工具,蚌埠市建设银行官方网站Resource Resource 接口为处理和访问不同类型资源(如文件、URL、输入流等)提供了统一的 API,支持资源的存在性检查、读取、转换等操作。 public interface Resource extends InputStreamSource {boolean exists();default boolean isReadable…

Resource

Resource 接口为处理和访问不同类型资源(如文件、URL、输入流等)提供了统一的 API,支持资源的存在性检查、读取、转换等操作。

public interface Resource extends InputStreamSource {boolean exists();default boolean isReadable() {return exists();}default boolean isOpen() {return false;}default boolean isFile() {return false;}URL getURL() throws IOException;URI getURI() throws IOException;File getFile() throws IOException;default ReadableByteChannel readableChannel() throws IOException {return Channels.newChannel(getInputStream());}default byte[] getContentAsByteArray() throws IOException {return FileCopyUtils.copyToByteArray(getInputStream());}default String getContentAsString(Charset charset) throws IOException {return FileCopyUtils.copyToString(new InputStreamReader(getInputStream(), charset));}long contentLength() throws IOException;long lastModified() throws IOException;Resource createRelative(String relativePath) throws IOException;@NullableString getFilename();String getDescription();}
public interface InputStreamSource {InputStream getInputStream() throws IOException;
}
实现类描述
UrlResource用于封装 java.net.URL,可以访问任何通过 URL 访问的资源,如文件、HTTPS、FTP 等。
ClassPathResource用于从类路径加载资源,支持使用类加载器或特定类来加载资源。
FileSystemResource基于 java.io.File 的实现,支持文件系统路径,采用 Java NIO API 进行操作。
PathResource基于 java.nio.file.Path 的实现,采用 NIO API,支持文件和 URL 解析,且实现了 WritableResource 接口。
ServletContextResource用于 ServletContext 资源,解析相对路径并在 Web 应用的根目录下查找资源。
InputStreamResource封装已打开的 InputStream,适用于流式访问已打开的资源,避免多次读取。
ByteArrayResource基于给定字节数组的实现,通过 ByteArrayInputStream 来加载内容,适合加载内存中的数据。

ResourceLoader

ResourceLoader 接口用于资源加载策略,通常在 Spring 应用中用于加载文件、类路径或其他类型的资源。它的子接口和实现类则为其功能扩展,支持不同类型的应用上下文或资源解析需求。|

public interface ResourceLoader {/** Pseudo URL prefix for loading from the class path: "classpath:". */String CLASSPATH_URL_PREFIX = ResourceUtils.CLASSPATH_URL_PREFIX;Resource getResource(String location);@NullableClassLoader getClassLoader();}

DefaultResourceLoader

DefaultResourceLoader 是 Spring 中用于加载各种类型资源的默认实现,支持通过类路径、文件系统、URL 等方式加载,并允许扩展协议解析器。

// Direct Known Subclasses:
// AbstractApplicationContext, ClassRelativeResourceLoader, FileSystemResourceLoader, ServletContextResourceLoader
public class DefaultResourceLoader implements ResourceLoader {@Nullableprivate ClassLoader classLoader;private final Set<ProtocolResolver> protocolResolvers = new LinkedHashSet<>(4);private final Map<Class<?>, Map<Resource, ?>> resourceCaches = new ConcurrentHashMap<>(4);public DefaultResourceLoader() {}public DefaultResourceLoader(@Nullable ClassLoader classLoader) {this.classLoader = classLoader;}public void addProtocolResolver(ProtocolResolver resolver) {Assert.notNull(resolver, "ProtocolResolver must not be null");this.protocolResolvers.add(resolver);}@SuppressWarnings("unchecked")public <T> Map<Resource, T> getResourceCache(Class<T> valueType) {return (Map<Resource, T>) this.resourceCaches.computeIfAbsent(valueType, key -> new ConcurrentHashMap<>());}public void clearResourceCaches() {this.resourceCaches.clear();}@Overridepublic Resource getResource(String location) {Assert.notNull(location, "Location must not be null");for (ProtocolResolver protocolResolver : getProtocolResolvers()) {Resource resource = protocolResolver.resolve(location, this);if (resource != null) {return resource;}}if (location.startsWith("/")) {return getResourceByPath(location);}else if (location.startsWith(CLASSPATH_URL_PREFIX)) {return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()), getClassLoader());}else {try {// Try to parse the location as a URL...URL url = ResourceUtils.toURL(location);return (ResourceUtils.isFileURL(url) ? new FileUrlResource(url) : new UrlResource(url));}catch (MalformedURLException ex) {// No URL -> resolve as resource path.return getResourceByPath(location);}}}protected Resource getResourceByPath(String path) {return new ClassPathContextResource(path, getClassLoader());}protected static class ClassPathContextResource extends ClassPathResource implements ContextResource {public ClassPathContextResource(String path, @Nullable ClassLoader classLoader) {super(path, classLoader);}@Overridepublic String getPathWithinContext() {return getPath();}@Overridepublic Resource createRelative(String relativePath) {String pathToUse = StringUtils.applyRelativePath(getPath(), relativePath);return new ClassPathContextResource(pathToUse, getClassLoader());}}
}

ResourcePatternResolver

ResourcePatternResolverResourceLoader 的扩展接口,提供了通过模式(如 Ant 风格路径)解析位置并返回 Resource 对象的功能。它支持 classpath*: 前缀来获取类路径和模块路径中所有匹配的资源。

// "classpath:META-INF/config.xml" 只匹配 第一个 META-INF/config.xml
// "classpath*:META-INF/config.xml" 匹配 所有 JAR 包 和 所有 META-INF 目录 下的 config.xml// PathMatchingResourcePatternResolver
public interface ResourcePatternResolver extends ResourceLoader {String CLASSPATH_ALL_URL_PREFIX = "classpath*:";Resource[] getResources(String locationPattern) throws IOException;}

ResourceLoaderAware

ResourceLoaderAware 接口允许对象在 Spring 容器中获取并使用 ResourceLoader 来加载资源。

public interface ResourceLoaderAware {void setResourceLoader(ResourceLoader resourceLoader);
}

·


文章转载自:

http://X4bqkMcf.fnhxp.cn
http://KhbHhkHX.fnhxp.cn
http://Fdqjkj4C.fnhxp.cn
http://ntYWb4Dw.fnhxp.cn
http://YWIMruuk.fnhxp.cn
http://DmkzWqfK.fnhxp.cn
http://XKczm2A3.fnhxp.cn
http://1EYQmH6s.fnhxp.cn
http://PZy6xWTK.fnhxp.cn
http://POpfD2mQ.fnhxp.cn
http://wjx0Bsuf.fnhxp.cn
http://ELguhgGW.fnhxp.cn
http://vEwXoEih.fnhxp.cn
http://8jj5rLPQ.fnhxp.cn
http://LQJMlXu9.fnhxp.cn
http://j3EyGHqk.fnhxp.cn
http://Don7hwOk.fnhxp.cn
http://S63GnR9E.fnhxp.cn
http://cfSHnLjx.fnhxp.cn
http://Cs5FMbHw.fnhxp.cn
http://ltPYkViH.fnhxp.cn
http://2aBum2WA.fnhxp.cn
http://Ws4FuRWq.fnhxp.cn
http://TxF8HWpt.fnhxp.cn
http://r5xjiK0l.fnhxp.cn
http://BRuAfZX9.fnhxp.cn
http://e6YFK5mJ.fnhxp.cn
http://NlCltSRS.fnhxp.cn
http://g5TN15PG.fnhxp.cn
http://llSoPL5M.fnhxp.cn
http://www.dtcms.com/wzjs/719839.html

相关文章:

  • 发卡网站建设7az海南网络
  • 公司网站建设需要要求什么网站建设+临沂
  • 建站魔方极速网站建设注册会计师考试科目
  • 哪个网站做译员好十堰网站开发
  • 网站建设基础包括网站页面上的下载功能怎么做
  • 云南昆州建设工程有限公司网站cc0图片素材网站
  • 焦溪翠冠梨做的网站seo数据优化
  • 建设网站简单的需要多少天网站设计论文的参考文献
  • 网站高端设计上海城隍庙门票多少钱
  • 工信部的网站备案信息查询免费版企业查询
  • 石家庄企业网站seo刷关键词排名工具
  • 用源码网站好优化吗开发软件app怎么赚钱
  • 深圳市宝安区中心医院百度seo排名优化助手
  • 山如何搭建响应式网站vs2010 网站开发源码
  • 霍邱网站建设手机网站制
  • 学院网站建设总结电商网页的特点
  • 网站板块的策划方案河南周口东宇网站建设
  • 晋江文学城写作网站南京集团网站建设
  • 建设单位经常去哪个网站网站建设合同通用范本
  • 云主机搭建多个网站帝国cms做企业网站
  • 网站建设服务费进入什么科目设置一个网站到期页面
  • 长沙教育网站建设电商网站怎样优化
  • 怎么制作网站一键更新申请一个电子邮箱
  • 做视频网站视频存放在哪里网站制作有名 乐云践新专家
  • 上班没事做看什么网站自己建网站能赚钱吗
  • 中国沈阳网站在哪里下载怎么做微信小程序
  • 网站建设需要用到什么软件wordpress斌果主题
  • 网站建设为什么要推广重装wordpress
  • 推荐一本学做网站的书国外设计网站pinterest下载
  • 小程序api开发湖南seo推广多少钱