/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
SpringBoot的filter过滤器(源代码)
共384个文件
xml:304个
java:18个
class:14个
5星 · 超过95%的资源 需积分: 5 3 下载量 174 浏览量
2023-01-27
20:20:24
上传
评论
收藏 434KB ZIP 举报
温馨提示
SpringBoot的filter过滤器 一、过滤器的作用和概述 1.1 简述 1.2 使用场景 二、自定义过滤的两种方式 2.1 第一种方式 2.1.1 启动类增加注解@ServletComponentScan 2.1.2 定义一个filter类 2.1.3. 测试 2.2 第二种方式 2.2.1 自定义fitler类 2.2.4 在启动类中进行配置 2.4.3 第二种方式的另一种写法 2.4.4. 测试 2.3 过滤器的小案例 2.3.1 场景描述 2.3.2 Controller层 2.3.3 启动类 添加注解:@ServletComponentScan //添加过滤器使用 2.3.4自定义过滤器类UserLoginFilter.java 2.3.5 templates下的index页面 2.3.6被拦截后重定向的页面 2.3.7 测试
资源推荐
资源详情
资源评论
收起资源包目录
SpringBoot的filter过滤器(源代码) (384个子文件)
UserLoginFilter.class 2KB
LoginFilter.class 2KB
SpringbootFilter02Application.class 1KB
SecondFilter.class 1KB
SecondFilter.class 1KB
MyWebMvcConfiger.class 1KB
UserController.class 1KB
SpringbootFilter03LogindemoApplication.class 1KB
SpringbootFilter01Application.class 877B
SpringbootFilter021Application.class 818B
SpringbootFilter03LogindemoApplicationTests.class 654B
SpringbootFilter021ApplicationTests.class 616B
SpringbootFilter01ApplicationTests.class 609B
SpringbootFilter02ApplicationTests.class 609B
mvnw.cmd 6KB
mvnw.cmd 6KB
mvnw.cmd 6KB
mvnw.cmd 6KB
.gitignore 333B
.gitignore 333B
.gitignore 333B
.gitignore 333B
.gitignore 268B
.gitignore 260B
.gitignore 258B
.gitignore 258B
index.html 226B
index.html 226B
login.html 182B
login.html 182B
springboot-filter03-logindemo.iml 9KB
springboot-filter01.iml 9KB
springboot-filter02.iml 9KB
springboot-filter02_1.iml 9KB
maven-wrapper.jar 50KB
maven-wrapper.jar 50KB
maven-wrapper.jar 50KB
maven-wrapper.jar 50KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
MavenWrapperDownloader.java 5KB
UserLoginFilter.java 2KB
MyWebMvcConfiger.java 1KB
LoginFilter.java 1KB
SecondFilter.java 990B
SpringbootFilter02Application.java 982B
SecondFilter.java 863B
SpringbootFilter03LogindemoApplication.java 709B
UserController.java 676B
SpringbootFilter01Application.java 497B
SpringbootFilter021Application.java 367B
SpringbootFilter03LogindemoApplicationTests.java 265B
SpringbootFilter021ApplicationTests.java 250B
SpringbootFilter01ApplicationTests.java 247B
SpringbootFilter02ApplicationTests.java 247B
HELP.md 1KB
HELP.md 1KB
HELP.md 1KB
HELP.md 1KB
README.md 32B
README.md 32B
README.md 32B
README.md 32B
mvnw 10KB
mvnw 10KB
mvnw 10KB
mvnw 10KB
application.properties 1KB
application.properties 1KB
application.properties 1KB
application.properties 1KB
application.properties 1KB
application.properties 1KB
application.properties 1KB
application.properties 1KB
maven-wrapper.properties 218B
maven-wrapper.properties 218B
maven-wrapper.properties 218B
maven-wrapper.properties 218B
workspace.xml 6KB
workspace.xml 4KB
workspace.xml 3KB
workspace.xml 3KB
pom.xml 3KB
pom.xml 3KB
pom.xml 3KB
pom.xml 3KB
jarRepositories.xml 1KB
compiler.xml 942B
compiler.xml 918B
compiler.xml 912B
compiler.xml 912B
jarRepositories.xml 864B
jarRepositories.xml 864B
jarRepositories.xml 864B
Maven__org_springframework_boot_spring_boot_configuration_processor_2_6_11.xml 779B
Maven__org_springframework_boot_spring_boot_configuration_processor_2_6_11.xml 779B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_13_3.xml 760B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_13_3.xml 760B
共 384 条
- 1
- 2
- 3
- 4
FBIHackerHarry浩
- 粉丝: 3w+
- 资源: 60
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于SimPy和贝叶斯优化的流程仿真系统.zip
- (源码)基于Java Web的个人信息管理系统.zip
- (源码)基于C++和OTL4的PostgreSQL数据库连接系统.zip
- (源码)基于ESP32和AWS IoT Core的室内温湿度监测系统.zip
- (源码)基于Arduino的I2C协议交通灯模拟系统.zip
- coco.names 文件
- (源码)基于Spring Boot和Vue的房屋租赁管理系统.zip
- (源码)基于Android的饭店点菜系统.zip
- (源码)基于Android平台的权限管理系统.zip
- (源码)基于CC++和wxWidgets框架的LEGO模型火车控制系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页