小编use*_*381的帖子

Gradle脚本要在没有任何第三方插件的情况下调用REST Web服务,任何指针?

嗨,我需要调用REST服务作为buildscript(Gradle)的一部分,没有任何第三方插件,我怎么能使用Groovy来做到这一点?

(我的第一次尝试)

repositories {
    mavenCentral()
}
      dependencies {  
            complie "org.codehaus.groovy.modules.http-builder:http-builder:0.5.2"  
    }  

task hello {
    def http = new HTTPBuilder("http://myserver.com:8983/solr/select?q=*&wt=json")
    http.auth.basic 'username', 'password'
    http.request(GET, JSON ) { req ->
    }
}
Run Code Online (Sandbox Code Playgroud)

rest groovy gradle

26
推荐指数
5
解决办法
3万
查看次数

standalone-full和standalonefull-ha有什么区别?

standalone-full和standalonefull-ha之间有什么区别?什么子系统不包含在standalone-full-ha中,这些子系统不能独立完整?

wildfly

5
推荐指数
2
解决办法
3240
查看次数

带有重音字符的Java Properties文件

我正在尝试从文本文件加载一个属性,但重音字符(saül)有一个不同的编码,而不是UTF-8如何避免它?

我的属性文件有一个带有重音字符的属性(saül).然而,当我远程调试时,我发现了properties.load(bufferedReader); 把它当作saül所以当我写入另一个文件时它被写成saül,我在应用程序的其他地方都有UTF-8编码.从文件中读取属性时,我不确定我做错了什么.

try {
    final String propertyFilePath = System.getProperty(JVM_ARGUMENT_NAME);
    if (StringUtils.hasText(propertyFilePath)) {
        setLocalOverride(true);
        resource = getApplicationContext().getResource(propertyFilePath);
        BufferedReader bufferedReader =
            new BufferedReader(new InputStreamReader(new FileInputStream(propertyFilePath), "UTF8"));
        properties.load(bufferedReader);
        externalFilePasswordConfigurer.afterPasswordPropertiesSet(properties);
        LOGGER.info("ExternalFilePropertyConfigurer UTF-8 Reader");
    }
    setProperties(properties);
    logProperties(properties);
} catch (Exception e) {
    LOGGER.error("ExternalFilePropertyConfigurer setter failed to set properties: ", e);
    throw new RuntimeException(e);
}
Run Code Online (Sandbox Code Playgroud)

java spring utf-8 properties-file

3
推荐指数
1
解决办法
3126
查看次数

标签 统计

gradle ×1

groovy ×1

java ×1

properties-file ×1

rest ×1

spring ×1

utf-8 ×1

wildfly ×1