Token 就是令牌的意思,我拿token來做驗證就不需要多次輸入用戶名和密碼,可以實現單點登陸、outh認證等功能。
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
是不是應用停了quartz沒停,可以設置一個application exit https://docs.spring.io/spring... 試試看
flush()不行么
try_files是可以的,不會響應30x跳轉
location /oper/ {
try_files $uri /index.html;
}
也可以用rewrite
location /oper/ {
rewrite /oper/ /index.html last;
}
對比下兩者的優(yōu)缺點:try_files可以兼顧文件存在的情況,不過會多一些磁盤操作rewrite無磁盤操作,不過無法兼顧文件存在的情況
如果是單純的需要將/oper/開頭的所有請求返回/index.html,建議使用rewrite
一些以實際工作為導向。
不需要學習struts1了,花的時間不值得。實際中用到的很少,除非一些老的項目需要你去維護。
這種web mvc框架,可以學習下struts2或者spring mvc,熟悉其中一種,道理都是相通的,實際工作中用到其他的再學習下,上手很快的。
就我本人來說,一開始就學習struts2的,工作中用struts2用了2年左右,后來公司用spring mvc了,找點資料看看,就直接上手了。
暫時使用JSDoc加上vue插件來完成系統注釋文檔的自動生成
>>> import re
>>> s='''
1
2
3
1
2
3
4
1
2
3
4
5
1
'''
>>> re.findall(r'1[^1]*',s)
['1\n2\n3\n', '1\n2\n3\n4\n', '1\n2\n3\n4\n5\n', '1\n']
#或者
>>> re.findall(r'(1\n)([^1]*)',s)
[('1\n', '2\n3\n'), ('1\n', '2\n3\n4\n'), ('1\n', '2\n3\n4\n5\n'), ('1\n', '')]小程序有個wss協議地址要添加,請問服務器怎么搭建這個wss協議呢?
意思是開啟這個wss還是要搭建起來?
好像wokerman一樣,是不是開啟了就等于搭建好了?
補充:WSS協議介紹
public static final String DEFAULT_ERROR_VIEW = "error/400";
檢查一下路徑和頁面的位置
先用FileInputStream把文件讀到一個byte[]里,再反復用ByteArrayInputStream讀取這個byte[]。
需注意的是,在異步函數中更新數據的時候,必須手動調用$apply方法,才會觸發(fā)臟數據檢查流程的運行。
this.$apply();
HTTP無狀態(tài)決定了本質上無法繼續(xù)上次的HTTP請求。
首先,客戶端先發(fā)送了一個請求,這個請求的header中包含了一個屬性expect: 100-continue。這種情況一般出現于上傳大容量body或者是需要驗證的時候。這時服務器會讀取請求的header并返回一個100 continue的響應,如果服務器可以提供這項服務的話??蛻舳嗽賹ttp請求發(fā)送回去。然后服務器會讀取請求的body并且在成功后返回200狀態(tài)碼。
如果出于驗證的目的發(fā)出expect:100-continue,那么你只需在認證通過之后的下一次請求中攜帶上你的認證信息(authorization等等)即可。
如果是出于詢問服務器是否能夠完成自己的請求,比如是不是能夠向它發(fā)送一個類型為video/mp4的大文件時,則第二次正常發(fā)送body為這個文件的http請求即可。這里使用expect:100-continue的原因在于避免大文件傳送失敗帶來的帶寬浪費。第一次發(fā)送的詢問請求可以只有一個header,如果服務器拒絕提供這個服務,則無需繼續(xù)發(fā)送大文件。
this.$refs.upload.clearFiles()
代碼中有很多問題,基本上思路就是錯的。1,讀文件有問題,txt2String中System.lineSeparator()應該加s后面。2,分割字符串有問題,count函數str.split("b");未考慮其它分隔符的情況,正確的做法是用正則表達式str.split("\s");。3,初始化后,list.size()=0,當然不會進入循環(huán)。
如果只想要代碼的話看這里,java 字符串詞頻統計實例代碼
下面代碼是連接中的內容
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WordsStatistics {
class Obj {
int count ;
Obj(int count){
this.count = count;
}
}
public List<WordCount> statistics(String word) {
List<WordCount> rs = new ArrayList<WordCount>();
Map <String,Obj> map = new HashMap<String,Obj>();
if(word == null ) {
return null;
}
word = word.toLowerCase();
word = word.replaceAll("'s", "");
word = word.replaceAll(",", "");
word = word.replaceAll("-", "");
word = word.replaceAll("\\.", "");
word = word.replaceAll("'", "");
word = word.replaceAll(":", "");
word = word.replaceAll("!", "");
word = word.replaceAll("\n", "");
String [] wordArray = word.split(" ");
for(String simpleWord : wordArray) {
simpleWord = simpleWord.trim();
if (simpleWord != null && !simpleWord.equalsIgnoreCase("")) {
Obj cnt = map.get(simpleWord);
if ( cnt!= null ) {
cnt.count++;
}else {
map.put(simpleWord, new Obj(1));
}
}
}
for(String key : map.keySet()) {
WordCount wd = new WordCount(key,map.get(key).count);
rs.add(wd);
}
Collections.sort(rs, new java.util.Comparator<WordCount>(){
@Override
public int compare(WordCount o1, WordCount o2) {
int result = 0 ;
if (o1.getCount() > o2.getCount() ) {
result = -1;
}else if (o1.getCount() < o2.getCount()) {
result = 1;
}else {
int strRs = o1.getWord().compareToIgnoreCase(o2.getWord());
if ( strRs > 0 ) {
result = 1;
}else {
result = -1 ;
}
}
return result;
}
});
return rs;
}
public static void main(String args[]) {
String word = "Pinterest is might be aa ab aa ab marketer's dream - ths site is largely used to curate products " ;
WordsStatistics s = new WordsStatistics();
List<WordCount> rs = s.statistics(word);
for(WordCount word1 : rs) {
System.out.println(word1.getWord()+"*"+word1.getCount());
}
}
}
View - Tool Windows - Structure
ctrl+shift+s保存下在運行試試
怎么取值的,貼下代碼唄?
ImeiInfo ii = new ImeiInfo();
ii.setImeiValue("6214831270561122");
//這樣就取出來了?
String getImei = ii.getImeiValue();
檢查一下阿里云的centos網絡,訪問外網是否是通的。
試過在module1-service中添加自定義datasource(只支持properties,Yml可能能實現,但還不太會寫),可以實現(此種方式不清楚是否會影響原來spring datasource機制,對spring原理不熟)
代碼如下:
@Component
@ConfigurationProperties(prefix = "spring.datasource")
@PropertySource("classpath:service-jdbc.properties")
public class MyDataSourceProperties {
private String url;
...
}
@EnableConfigurationProperties(MyDataSourceProperties.class)
public class MyDataSourceConfig {
@Autowired
private MyDataSourceProperties myDataSourceProperties;
@Bean
@Primary
public DataSource dataSource() {
return DataSourceBuilder.create(myDataSourceProperties.getClassLoader()).type(myDataSourceProperties.getType()).driverClassName(myDataSourceProperties.determineDriverClassName()).url(myDataSourceProperties.determineUrl()).username(myDataSourceProperties.determineUsername()).password(myDataSourceProperties.determinePassword()).build();
}
}
完整代碼:https://gitee.com/soft_xiang/...
在module1-service中自定義properties bean(此種方法較好,推薦),代碼如下
@Configuration
public class ServiceConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("application-module1-service.yml"));
configurer.setProperties(yaml.getObject());
return configurer;
}
}
由第二種用法引起的新的問題:
項目中如果存在多環(huán)境配置文件,如application-module1-service-dev.yml/application-module1-service-test.yml/application-module1-service/-release.yml時,怎樣根據module1-web中配置的spring.profiles.active加載對應的配置文件?
思路為在加載文件時使用SpringContextUtil獲取配置文件中的active,在properties()中根據active加載文件
代碼如下:
SpringContextUtil.java
@Order(Integer.MIN_VALUE)
@Component
public class SpringContextUtil implements ApplicationContextAware {
private static ApplicationContext context = null;
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.context = applicationContext;
}
/// 獲取當前環(huán)境
public static String getActiveProfile() {
return context.getEnvironment().getActiveProfiles()[0];
}
/// 獲取當前環(huán)境
public static String[] getActiveProfiles() {
return context.getEnvironment().getActiveProfiles();
}
}
ServiceConfig
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
String path = "application-module1-service.yml";
try {
String profile = SpringContextUtil.getActiveProfile();
if (StringUtils.isNotBlank(profile)) {
path = "application-module1-service-" + profile + ".yml";
}
}catch (NullPointerException e){
e.printStackTrace();
System.out.println("SpringContextUtil...未加載...");
}
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource(path));//File引入
configurer.setProperties(yaml.getObject());
return configurer;
}
完整代碼:https://gitee.com/soft_xiang/...
然而這里會有循環(huán)依賴問題
運行代碼會有
SpringContextUtil...未加載...
沒有實現根據active加載對應配置文件
北大青鳥APTECH成立于1999年。依托北京大學優(yōu)質雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數據專業(yè)的國家
達內教育集團成立于2002年,是一家由留學海歸創(chuàng)辦的高端職業(yè)教育培訓機構,是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學校辦產業(yè)為響應國家深化產教融合/校企合作的政策,積極推進“中國制造2025”,實現中華民族偉大復興的升級產業(yè)鏈。利用北京大學優(yōu)質教育資源及背
博為峰,中國職業(yè)人才培訓領域的先行者
曾工作于聯想擔任系統開發(fā)工程師,曾在博彥科技股份有限公司擔任項目經理從事移動互聯網管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責任公司從事總經理職務負責iOS教學及管理工作。
浪潮集團項目經理。精通Java與.NET 技術, 熟練的跨平臺面向對象開發(fā)經驗,技術功底深厚。 授課風格 授課風格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網頁制作和網頁游戲開發(fā)。
具有10 年的Java 企業(yè)應用開發(fā)經驗。曾經歷任德國Software AG 技術顧問,美國Dachieve 系統架構師,美國AngelEngineers Inc. 系統架構師。