setproperty
无意中使用了Tomcat SecurityManager的功能,可把我给坑惨了!
首先来看一下如下的报错,完整一点的信息,见图一:
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "PID" "write")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:792)
at org.springframework.boot.logging.LoggingSystemProperties.setSystemProperty(LoggingSystemProperties.java:137)
看完你有啥反应?
看完之后,起码明确,是Spring Boot 出现了权限问题, 咋整?百度一圈之后, 基本的方案无非是,在Tomcat/conf/catalina.policy文件里面 加权限。
于是, 加权限;再运行,又缺少另外一个权限;继续加权限, 最后, 我的Policy文件变成了图二的模样.
加到这里的时候,已经快崩溃了, 这权限加到什么时候是头啊, 为什么之前都没有这种错误呢?
电光火石之间,想起之前貌似对Tomcat 添加过security 模式, 先用systemctl status tomcat 来查看下Tomcat 服务情况, 如图三所示, 主要是上面的划线部分,在Tomcat 启动的时候, 有一个不太起眼的选项: -security
把这个选项去掉, 程序正常启动, 什么错误也不会再爆出了。
为什么呢? 这就是Tomcat 的Security Manager的功能,看看下面这个诱人的描述:
Java 的 SecurityManager 能让 Web 浏览器在它自身的沙盒中运行小型应用(applet),从而具有防止不可信代码访问本地文件系统的文件以及防止其连接到主机,而不是加载该应用的位置,等等。如同 SecurityManager 能防止不可信的小型应用在你的浏览器上运行,运行 Tomcat 时,使用 SecurityManager 也能保护服务器,使其免受木马型的 applet、JSP、JSP Bean 以及标签库的侵害,甚至也可以防止由于无意中的疏忽所造成的问题。
假设网站有一位经授权可发布 JSP 的用户,他在无意中将下面这些代码加入了 JSP 中:
<% System.exit(1); %>
每当 Tomcat 执行这个 JSP 文件时,Tomcat 都会退出。Java 的 SecurityManager 构成了系统管理员保证服务器安全可靠的另一道防线。
警告:使用 Tomcat 代码库时会执行一个安全审核。大多数关键包已受到保护,新的安全包保护机制已经实施。然而,在允许不可信用户发布 Web 应用、JSP、servlet、bean 或标签库之前,你仍要反复确定自己配置的 SecurityManager 是否满足了要求。但不管怎么说,利用 SecurityManager 来运行 Tomcat 肯定比没有它好得多。
就是这个看似很香实则没用的Tomcat Securiy Manager, 把我给整懵了! 建议大家,不是特别了解这个选项的时候, 慎用!慎用!
#Java开发# #Tomcat# #Security Manager# #permission# #权限#
#英语##学习打卡#
1.brewery 英 [ˈbruːəri] 美 [ˈbruːəri] n.啤酒厂
Our whiskey comes from the finest breweries.
我们的威士忌来自最好的酒厂。
【词根词缀】
brew酿酒 + ery场所 → 酿造厂
2.precedent 英 [ˈpresɪdənt] 美 [ˈpresɪdənt] n.先例,范例 adj.在前的,前面的
These cases set the precedent for future intellectual property legal cases.
这些案子为未来的知识产权案件开创了先例。
【词根词缀】
pre……前的,预先 + ced走 + ent名词后缀 → 走在前面的东西 → precedent先例
3.brake 英 [breɪk] 美 [breɪk] vi.刹车 n.刹车,闸
Not again?! I hate having to brake my car for cows!
不要吧,又来?我讨厌为了牛刹车!
4.exclusively 英 [ɪkˈskluːsɪvli] 美 [ɪkˈskluːsɪvli] adv.专门地;特定地
The toilet is for the mother and baby exclusively.
这个房间专供母婴专用。
5.elementary 英 [ˌelɪˈmentri] 美 [ˌelɪˈmentri] adj.基本的;初级的
The elementary students are beginning school for the first time.
小学生们正准备第一次上学。
【词根词缀】
element要素 + ary形容词后缀 → 最简单的要素 → elementary元素的,基本的
今天,简简单单用QML设计了跑在嵌入式板子上的图片轮播软件,提供给PM用于评估新产品的LCD显示效果。
代码很简单,QML仅使用了Image和Timer。
在Timer的onTriggered事件中修改Image的source。
在Component.onCompleted事件中启动Timer。
在Main.cpp程序中,遍历图片文件夹下的所有图片,保存到QStringlist对象中,得到要显示的图片的文件名列表。
再通过setContextProperty将文件名列表传递给QML。
当设置Image的source时,以下一点需要注意:
"qrc:///filepath",索引资源文件。
"网页链接绝对路径",按绝对路径索引本地文件系统中的文件。
"file:相对路径", 按相对路径索引本地文件系统中的文件。
未指定qrc或file时,则默认索引资源文件。
资源文件需要加文件加入到QT开发工程的resource中。
双向数据绑定原理之Vue3.0比vue2.0的优势有哪些?
vue2.0使用了Object.defineProperty的方法,他有哪些缺陷呢?
首先它无法检测到对象属性的新增或删除
由于js的动态性,可以为对象追加新的属性或者删除其中某个属性,
这点对经过Object.defineProperty方法建立的响应式对象来说,
只能追踪对象已有数据是否被修改,
无法追踪新增属性和删除属性, 这就需要另外处理。
其次不能监听数组的变化
vue在实现数组的响应式时,它使用了一些hack,
把无法监听数组的情况通过重写数组的部分方法来实现响应式,
这也只限制在数组的push/pop/shift/unshift/splice/sort/reverse七个方法,
其他数组方法及数组的使用则无法检测到,
vue3.0使用了proxy来代替Object.defineProperty,它有哪些优势呢?
proxy属性是ES6中新增的一个属性,
proxy属性也是一个构造函数,他也可以通过new的方式创建这个函数,
表示修改某些操作的默认行为,等同于在语言层面做出修改,
所以属于一种元编程 proxy可以理解为在目标对象之前架设一层拦截,
外界对该对象的访问,都必须经过这层拦截, 因此提出了一种机制,
可以对外界的网文进行过滤和改写,proxy这个词是代理, 用来表示由他代理某些操作,
可以译为代理器 Proxy,字面意思是代理,是ES6提供的一个新的API,
用于修改某些操作的默认行为, 可以理解为在目标对象之前做一层拦截,
外部所有的访问都必须通过这层拦截, 通过这层拦截可以做很多事情,
比如对数据进行过滤、修改或者收集信息之类
proxy代理的特点:
proxy直接代理的是整个对象而非对象属性,
proxy的代理针对的是整个对象而不是像object.defineProperty针对某个属性,
只需要做一层代理就可以监听同级结构下的所有属性变化,
包括新增的属性和删除的属性 proxy代理身上定义的方法共有13种,
其中我们最常用的就是set和get,
但是他本身还有其他的13种方法 proxy的劣势:
兼容性问题,虽然proxy相对越object.defineProperty有很有优势,
但是并不是说proxy,就是完全的没有劣势,主要表现在以下的两个方面:
1.proxy有兼容性问题,无完全的polyfill: proxy为ES6新出的API,
浏览器对其的支持情况可在w3c规范中查到,通过查找我们可以知道,
虽然大部分浏览器支持proxy特性,但是一些浏览器或者低版本不支持proxy,
因此proxy有兼容性问题,那能否像ES6其他特性有polyfill解决方案呢?,
这时我们通过查询babel文档,发现在使用babel对代码进行降级处理的时候,并没有合适的polyfill
2.第二个问题就是性能问题,proxy的性能其实比promise还差
这就需要在性能和简单实用上进行权衡,例如vue3使用proxy后,
其对对象及数组的拦截很容易实现数据的响应式,尤其是数组
虽然proxy有性能和兼容性处理,但是proxy作为新标准将受到浏览器厂商重点持续的性能优化, 性能这块会逐步得到改善
关注司达叔讲前端,走在技术最前沿
#前端##前端框架##前端开发##编程开发#
下面图片的quadrupple之中的quad-是个前缀,意思是“四”。
Quad-core processors offer few advantages for desktops. 四核给桌面电脑带来的优势不大。
quadrangle:四边形,四合院
quadruplet:四胞胎之一
quadrupple既可以作名词,也可以作形容词和动词。
This year what we produced quadruples the amount produced in 2002. 我们今年的产量是2002年的四倍。
The quadruple murder has replaced property prices as the sole topic of interest. 这四起连环谋杀案已经取代房价成为了人们惟一感兴趣的话题。
Thus he avoided the quadruple trap which was set for him. 就这样,他避开了给他设下的四个陷阱。
日积月累学习英语@区域全面经济伙伴协定助力改革! RCEP set to spur opening-up !
RCEP(Regional Comperehensive Economic Partnership)区域全面经济伙伴协定协定于2022年1月1日生效实施后,企业获得“扩市场”“固链条”“享服务”等三项服务,而对于中国消费者,RCEP的实施将带来“优质”“实惠”“便捷”.......
高质量的实施RCEP可以给中国企业扩大国际贸易和经济合作带来新的动能,有利于地区和世界经济的恢复!
High-quality implementation of the Regional Comprehensive Economic Partnership agreement in China will provide more impetus for Chinese enterprises to expand international trade and economic cooperation, thus making more contributions to regional and global economic recovery.
free trade agreement's high-level liberalization and facilitation of trade and investment,
高水平的贸易自由化和投资便利化
deeper reforms through high-level opening-up, 高水平的开发带来深化改革
high-quality development, 高质量发展
National Development and Reform Commission,国家改革委
Ministry of Industry and Information Technology, (国家)工信部(MIIT)
Chinese Academy of Social Sciences. 中国社科院
intellectual property rights protections, 知识产权保护
core technologies, 核心技术
cross-border e-commerce,跨境电商
micro, small and medium-sized enterprises,微型、小型和中型企业 (MSME)
学习英语需要日积月累,聚沙成塔!Many a little makes a mickle, and
Many grains of sand piled up makes a pagoda!
关注@安地乒旅英语Learn English togethe, and make more progress!
这几天在使用uniapp编写一些前端登录窗体验证,后端WebApi使用.Net,本来可以使用string字符串的形式,传递参数,但考虑到后期开发,可能会有在移动端做一些Form表单数据录入及提交,比方说:下订单等信息,考虑到数据文本框可能比较多,哪么如果是这样的话,是否有一种更快捷的方式提交数据,对比了一下,决定使用Data:{"username":"用户","password":"密码"} 使用Body数据结构,用类方法封装实体类,可能会好了一些,想到以后要反复重用代码,哪就先这样干吧!废话少说上代码:
1、前端:uniapp前端有两个文本框,分别是用户框,密码框,点提交后请求代码如下:
uni.request({
url: serverUrl + '//api/registLogin/Post', //请求的服务器地址
data: {
"username": username,
"password": password
},
method: "POST",
success: (res) => {
if(res.statusCode==200)//请求如果200成功,否则失败
{
var data= https://xitong.haoyundao.net/res.data;
// 获得数据后,就可以作一些判断,实现使用tab切换的api页面。
uni.switchTab({
url: "/pages/msg/more"
});
}
2、后端数据接收方法
public Object Post([FromBody] Data value) //用FromBody结构体接收
{
var MyData= https://xitong.haoyundao.net/value;
string code = MyData.username;//获取传递参数值
string pwd = MyData.password;//获取传递参数值
//这里查询,生产环境当然最好,要加入防sql注入编写习惯,这里是就不重述了
string strSql = "Select username',password From 用户登录表 Where OperatorCode='" + code + "' And Pwd='"+ pwd + "'";
DataTable dt = new DataTable();
dt = SqlClass.GetTable(strSql, "dt");
if (dt.Rows.Count > 0)
{
List userList = TableToEntity(dt); // 调用:
return userList;//增加实体类对象
}
else
{
return null;
}
}
3、实体类方法
public class Data
{
public string username{get;set;}
public string password{get;set;}
//这里是针对用户登录表,有两列,实际开发中,如果你登录用户表有多列,你就一列写一个 实 体,这个看你自己个人设计爱好了。
}
4、//把Datatable数据集,转换为实体类对象的方法
private static List TableToEntity(DataTable dt) where T : class, new()
{
Type type = typeof(T);
List list = new List();
foreach (DataRow row in dt.Rows)
{
PropertyInfo[] pArray = type.GetProperties();
T entity = new T();
foreach (PropertyInfo p in pArray)
{
if (row[p.Name] is Int64)
{
p.SetValue(entity, Convert.ToInt32(row[p.Name]), null);
continue;
}
p.SetValue(entity, row[p.Name], null);
}
list.Add(entity);
}
return list;
}
• In total, our entire string of operating companies spent $8.2 billion for property, plant and equipment in 2011, smashing our previous record by more than $2 billion. About 95% of these outlays were made in the U.S., a fact that may surprise those who believe our country lacks investment opportunities. We welcome projects abroad, but expect the overwhelming majority of Berkshire’s future capital commitments to be in America. In 2012, these expenditures will again set a record.
• Our insurance operations continued their delivery of costless capital that funds a myriad of other opportunities. This business produces “float” – money that doesn’t belong to us, but that we get to invest for Berkshire’s benefit. And if we pay out less in losses and expenses than we receive in premiums, we additionally earn an underwriting profit, meaning the float costs us less than nothing. Though we are sure to have underwriting losses from time to time, we’ve now had nine consecutive years of underwriting profits, totaling about $17 billion. Over the same nine years our float increased from $41 billion to its current record of $70 billion. Insurance has been good to us.
华慧考博复习:翻译常用词汇积累二
宏观调控 macro-control
红包 (中)red paper containing money as a gift, (贬) bribe, kickback
《红楼梦》A Dream in Red Mansions (The Story of the Stone)
红帽子企业 red cap enterprise (refers to the reputation a private enterprise enjoys by becoming attached to a government department and doing business in the name of a state-run or collective-run enterprise)
胡子工程 long-drawn-out project (a project which takes so long that young workers become bearded)
还俗 resume secular life, unfrock
"黄、赌、毒" pornography, gambling and drug abuse and trafficking
廉政、勤政、务实、高效政府 an honest, diligent, pragmatic and efficient government
廉洁奉公,以正治国 (of an official) clean and devoted, and govern the state with his own example of uprightness
联产承包责任制 system of contracted responsibility linking remuneration to output; contract system with remuneration linked to output
联合国会费 the UN membership dues (fee)
脱贫致富 cast (shake, throw) off poverty and set out on a road to prosperity
脱手 release grip
新官上任三把火 a new broom sweeps clean
形象小姐/先生 image representative of a product or a brand
选举权和被选举权 the right to vote and the right to be elected
以质量求生存、求发展、求效益 strive for survival, development and efficiency on the basis of equality
以质量求发展 strategy of development through quality; win the market with quality products
义和团运动 Boxer Uprising
义务兵役制 compulsory military service, conscription
义务教育 compulsory education
薏米 seed of Job's tears
政企分开 separate government functions from enterprise management
证券营业部 stock exchange; security exchange
知识产权 intellectual property rights
知识经济 knowledge economy , knowledge-base economy
中国经济景气监测中心 China Economic Monitoring Center
中国新经济峰会 China New Economy Summit
追赶型和跨越式发展 pursuant and leap-forward development
准博士all but dissertation (ABD)
Both of us are enthusiastic about BNSF’s future because railroads have major cost and environmental advantages over trucking, their main competitor. Last year BNSF moved each ton of freight it carried a record 500 miles>
松江区高考一模重点词汇
think highly of
高度赞扬,高度评价
participate in class activities
参与课堂活动
basic manners
基本礼貌
open a delivery company
开一个快递公司
enjoy the festival atmosphere
享受节日的氛围
set >





