在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ Java問答
熊出沒 回答

Token 就是令牌的意思,我拿token來做驗證就不需要多次輸入用戶名和密碼,可以實現單點登陸、outh認證等功能。

刮刮樂 回答

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

汐顏 回答

是不是應用停了quartz沒停,可以設置一個application exit https://docs.spring.io/spring... 試試看

葬愛 回答

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協議呢?
  • 可以在Github上面搜索websocket server,選擇你熟悉的編程語言搭建。
意思是開啟這個wss還是要搭建起來?
  • 添加即可,無需搭建,如有需要可以搭建。意思是加入白名單了,后續(xù)可以在小程序中使用這個地址。
好像wokerman一樣,是不是開啟了就等于搭建好了?
補充:WSS協議介紹
  • WSS 是 Web Socket Secure 的簡稱, 它是 WebSocket 的加密版本. 我們知道 WebSocket 中的數據是不加密的, 但是不加密的數據很容易被別有用心的人竊取, 因此為了保護數據安全, 人們將 WebSocket 與 SSL 結合, 實現了安全的 WebSocket 通信, 即 WebSocket Secure. 所以說 WSS 是使用 SSL 進行加密了的 WebSocket 通信技術. 解釋來源:(https://segmentfault.com/q/10...
檸檬藍 回答
  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ā)送大文件。

故人嘆 回答

代碼中有很多問題,基本上思路就是錯的。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

枕邊人 回答

怎么取值的,貼下代碼唄?

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加載對應配置文件