/*
* 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 下载量 4 浏览量
2023-01-27
12: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币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 安卓项目源码Android手机防火墙源码(DroidWall)
- 双buck电路并联(VDCM控制+下垂控制) 变器并联控制方案中,下垂控制是一种经典的控制策略,但下垂控制因缺少传统电机的阻尼和旋转惯量以及励磁暂态特性,因此在负载功率变化时,输出电压更容易受到影响
- 数据科学的笔记以及资料收集.zip
- unidac-10.3.0-src.zip
- 安卓项目源码Android调用C++代码和C++代码调用源码
- 机械设计自带动力索道车sw18可编辑非常好的设计图纸100%好用.zip
- 非线性磁链观测器+PLL(源码+参考文献+仿真模型) ①源码:VESC的无感非线性观测器代码,并做了简单的调试,可以做到0速启动 代码注释非常详细,快速入门 ②参考文献(英文+翻译):为VESC非
- 数据采集平台zdh,etl处理服务.zip
- 数据集,包括原始数据集、自助数据集、存储过程数据集、JSON数据集、脚本数据集、HTTP数据集、JS数据集.zip
- 安卓项目源码Android网络监视器源码
- 发动机激励噪声仿真 使用软件为hyperworks motionview 技术路线:提取载荷等效轴心载荷,并加载加速工况下的频域激励,识别车内噪声
- 文本匹配相关模型DSSM,ESIM,ABCNN,BIMPM等,数据集为LCQMC官方数据.zip
- 基于线性预测共振峰检测和基音参数的语音合成实验MATLAB代码
- 微环谐振腔的光学频率梳matlab仿真 微腔光频梳仿真 包括求解LLE方程(Lugiato-Lefever equation)实现微环中的光频梳,同时考虑了色散,克尔非线性,外部泵浦等因素,具有可延展
- 安卓项目源码Android网页浏览器源码
- 文档分类概要01234.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页