小编Man*_*anu的帖子

Jenkins UI定制

我想改变Jenkins的外观和感觉(ui自定义).此外,我想添加新的视图(比如新的html页面或网页),并导航到所需的jenkins页面等.

如果任何单个插件可以帮助我这么做,请告诉我.任何相关信息(如何通用)将非常有帮助.任何建议或链接或教程也不胜感激.

PS: - jenkins相当新鲜.来自这里的输入将帮助我在问题中添加更多细节.

我正在寻找使用以下插件指定Skinning Jenkins的文档或教程: -

https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+UI+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/JSWidgets+Plugin
Run Code Online (Sandbox Code Playgroud)

插件页面提供的信息很少,关于如何使用这些以及可以更改UI的好处和扩展.

任何文档或链接表示赞赏.

user-interface hudson jelly jenkins jenkins-plugins

10
推荐指数
1
解决办法
9698
查看次数

仅在具有Java的Tomcat 8+上启用日志记录SSL握手失败(审核目的日志)

当REST客户端尝试连接到我的应用程序时,我需要记录SSL握手是否失败.该应用程序使用Spring Boot和Java 8构建,并部署在Tomcat 8上.

在SSL握手失败的情况下,由于TLS连接中断,因此可能必须在Tomcat层或Java中完成日志记录要求,因为Tomcat在我的情况下使用底层JVM进行SSL证书验证.

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" scheme="https" secure="true" keystoreFile="keyStore-1.jks" keystorePass="password" keystoreType="jks" truststoreFile="TrustStore.jks" truststorePass="passwrd" truststoreType="jks" clientAuth="want" sslProtocol="TLSv1.2" />
Run Code Online (Sandbox Code Playgroud)

我知道启用调试级别日志记录.

-Djavax.net.debug = SSL

但这会记录大量信息并会减慢进程.并记录成功的SSL条件.有没有办法单独使用Java或Tomcat级别的最小日志来启用故障案例.

我不是从调试的角度看这个,因为SSL调试日志非常好.此要求更多来自日志记录和审计目的,并且启用调试日志不是一个可行的选项.仅记录SSL发生的错误而不是所有十六进制/证书数据的机制.

java security ssl tomcat

10
推荐指数
1
解决办法
1万
查看次数

使用JNDI在Spring Boot中配置多个DataSource

我要管理多发使用您的应用程序服务器的内置功能DataSource和使用JNDI访问它.我使用Spring JPA数据进行Spring启动.

我能够为单个数据源配置application.properties: -

spring.datasource.jndi-name=jdbc/customers
Run Code Online (Sandbox Code Playgroud)

我在context.xml文件中的配置如下: -

<Resource name="jdbc/customer" auth="Container" type="javax.sql.DataSource"
               maxTotal="100" maxIdle="30" maxWaitMillis="10000"
               username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/customer"/>
Run Code Online (Sandbox Code Playgroud)

一切正常.

但是当我无法配置两个数据源时.

我确定在context.xml文件中的配置: -

 <Resource name="jdbc/customer" auth="Container" type="javax.sql.DataSource"
                   maxTotal="100" maxIdle="30" maxWaitMillis="10000"
                   username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/customer"/>

 <Resource name="jdbc/employee" auth="Container" type="javax.sql.DataSource"
                   maxTotal="100" maxIdle="30" maxWaitMillis="10000"
                   username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/employee"/>
Run Code Online (Sandbox Code Playgroud)

我对application.properties文件配置有疑问.

我尝试了以下选项但没有成功: -

spring.datasource.jndi-name=jdbc/customers,jdbc/employee
Run Code Online (Sandbox Code Playgroud)

有关多个数据源的JNDI,请告诉我有关Spring启动的任何详细信息.我好几天都在寻找这种配置.任何形式的建议或评论都会受到高度赞赏.

根据Spring Boot文档进行第二次试验

spring.datasource.primary.jndi-name=jdbc/customer
spring.datasource.secondary.jndi-name=jdbc/project
Run Code Online (Sandbox Code Playgroud)

配置类.

@Bean
@Primary
@ConfigurationProperties(prefix="datasource.primary")
public DataSource primaryDataSource() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="datasource.secondary")
public DataSource secondaryDataSource() {
    return DataSourceBuilder.create().build();
}
Run Code Online (Sandbox Code Playgroud)

该应用程序无法启动.虽然tomcat服务器正在启动.日志中不会打印错误.

第三次试验: - …

java spring jndi spring-data spring-boot

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

在使用Java 8重新协商TLS_1.2期间,服务器证书更改受到限制

我对SSL很陌生,并且被看似已知的问题所困扰.我的应用程序是SSL客户端,并调用另一个为双向SSL启用的组件.两个组件中的证书都是正确的,有时连接工作正常.每个服务器都有自己的服务器证书和私钥,但具有相同的根证书和中间证书.

服务器中的SSL检查在Apache SW LB中完成.

                                                                            |-------------|
                                                                          / |   Tomcat1   |
                                                         |-------------| /  |-------------| 
                                             |---------->|Apache SW LB |/ 
                                             |           |-------------|\       
                                             |                           \
                                             |                            \  |-------------|
|-----------|            |------------|      |                               |  Tomcat 2   |
|SSL Client |---HTTPS--->|Hardware LB |------|                               |-------------|    
|-----------|            |------------|      |                              |-------------| 
                                             |                            / |   Tomcat3   |
                                             |           |-------------| /  |-------------|
                                             |---------->|Apache SW LB |/   
                                                         |-------------|\
                                                                         \
                                                                          \|-------------|  
                                                                           |    Tomcat4  |
                                                                           |-------------|
Run Code Online (Sandbox Code Playgroud)

有时我会收到如下错误: -

***
%% Invalidated:  [Session-10, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256]
http-nio-8443-exec-10, SEND TLSv1.2 ALERT:  fatal, description = bad_certificate
http-nio-8443-exec-10, WRITE: TLSv1.2 Alert, length …
Run Code Online (Sandbox Code Playgroud)

java apache ssl spring tomcat

6
推荐指数
1
解决办法
3484
查看次数

如何在 SpringBoot 中从属性文件加载嵌套键值对

有没有更好的方法来使用 Spring/Spring Boot 实现以键值对作为值的属性文件?我想创建一个属性文件,其中键包含几个键值对作为值。

我尝试了以下实现:-

属性文件:-

Fiat=model:pet,year:1996
Honda=model:dis,year:2000
Run Code Online (Sandbox Code Playgroud)

我有下面的类试图读取属性文件。

@Component
@PropertySources(@PropertySource("classpath:sample.properties"))
public class PropertiesExtractor {

    @Autowired
    private Environment env;

    public String pullValue(String node) {

    String value = env.getProperty(node);
    System.out.println(value);//for Fiat, i get syso as **model:pet,year:1996**
}
Run Code Online (Sandbox Code Playgroud)

}

我需要使用 java 解析这些值,以获得单独的值。这是实现这一目标的唯一出路吗?

有没有更好的方法在Java中使用嵌套属性文件?

java apache spring spring-boot

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

"type"="string"时,对于null的JSON模式验证

我想阻止json提交允许null作为它的有效值.尝试使用关键字not,但没有运气.

希望下面的json被验证为false,因为字段stats值为null.

{
  "stats": "null"
}
Run Code Online (Sandbox Code Playgroud)

请在下面找到我的架构: -

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net#",
  "type": "object",
  "additionalProperties": false,
  "maxProperties": 1,
  "properties": {
    "stats": {
      "id": "http://jsonschema.net/stats#",
      "type": "string",
      "maxLength": 5,
      "minLength": 2,
      "additionalProperties": false,
      "maxProperties": 1,
      "not": {"type":  "null"}
    }
  },

  "required": [
    "stats"
  ]
}
Run Code Online (Sandbox Code Playgroud)

虽然我给了"not":{"type":"null"},但它仍然成功验证.

validation json jsonschema

5
推荐指数
1
解决办法
8062
查看次数

Spring boot+Spring Security 应用程序的单向 SSL 和双向 SSL 端点

我有一个具有 5 个 REST API 的 Web 应用程序。所有 API 均为启用 SSL 的 HTTPS。这是 server.xml 中的连接器标签:

 <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                maxThreads="150" scheme="https" secure="true"
                keystoreFile="conf/jks/ketStore.jks" keystorePass="keystore" keystoreType="jks"
                truststoreFile="conf/jks/trustStore.jks" truststorePass="truststore" truststoreType="jks"
                clientAuth="true" sslProtocol="TLSv1.2"/>
Run Code Online (Sandbox Code Playgroud)

现在,我只需使用 onw-way SSL 通过 HTTPs 公开其中一个 API。其他 4 个 API 只能通过具有 2 路 SSL 证书的 HTTPS 进行访问。

使用 Spring boot 和 Spring 4 Security 解决此问题的最佳方法是什么?

更新

我在这方面已经取得了一些进展。我已经设置clientAuth="want"并能够访问所需的 API,而无需在客户端出示证书。但我不确定如何对其他 API 实施 2-way 并编写自定义过滤器来检查 SSL 握手。有没有办法在 Spring Security 中做到这一点。

我有以下MultiHttpSecurityConfig课程:

@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MultiHttpSecurityConfig { …
Run Code Online (Sandbox Code Playgroud)

java ssl spring spring-security spring-boot

5
推荐指数
1
解决办法
4570
查看次数

无法在 Windows 上启动 memcache

我尝试使用 cmd 中的以下命令在 Windows 32 位上启动 memcache:-

D:\sw\memcache\memcached-1.4.5-x86\memcached-x86>memcached.exe -d

这是我收到的错误:-

无法忽略 SIGHUP:结果太大

1.4.5版本启动命令有变化吗?

我也尝试了以下选项:-

B) 安装 memcached >= 1.4.5:

将 memcached windows 二进制文件提取到任意目录。在 1.4.5 或更高版本中,memcached 无法作为服务运行。它必须使用任务计划程序作为正常进程启动。要将 memcached 进程配置为每次 Windows 启动时自动运行,请运行命令提示符并键入以下内容:

schtasks /create /sc onstart /tn memcached /tr "'c:\memcached\memcached.exe' -m 512"

同时,要删除计划的 memcached 任务,请运行以下命令:

schtasks /删除/tn memcached

但随后我收到了访问被拒绝的错误消息。我们是否需要授予运行 memcahe 的任何特殊访问权限。

注意:- 我对内存缓存完全陌生。

memcached

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

Spring Boot删除Web应用程序的Whitelabel错误页面

我有一个spring boot web应用程序,我将其部署为tomcat中的war文件.我不希望用户显示白标错误页面.我已经取得了一些进展,但需要将其重新指向错误页面.

以下代码是/ error白标错误页面是自定义错误消息.但是我想将它重定向到我的Web应用程序资源中的模板文件夹下的error.jsp或error.html.我试着将@RestController更改为@Controller而没有运气.

import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CustomErrorController implements ErrorController {

    private static final String PATH = "/error";

    @RequestMapping(value = PATH)
    public String error() {
        return "Unexpected error has happened.Please contact administrator!!!";
    }

    @Override
    public String getErrorPath() {
        System.out.println("-- Error Page GET --");
            return "error";
    }

}
Run Code Online (Sandbox Code Playgroud)

依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.4</version>
</dependency>
<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-taglibs</artifactId>
    <version>4.0.1.RELEASE</version>
    <exclusions>
        <exclusion>
            <artifactId>spring-aop</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-boot spring-4

2
推荐指数
1
解决办法
2万
查看次数

为什么使用别名的本机删除查询在 Spring Data JPA 中不起作用?

在 JPA Spring 数据中使用 DELETE 别名是否有任何已知问题?这就像删除别名的魅力一样。我有一个 JPA Spring 数据本机查询,如下所示:-

    @Modifying
    @Transactional
    @Query(value = "delete from Customer d where d.name = ?1", nativeQuery = true)
    public void removeOnName(String name);
Run Code Online (Sandbox Code Playgroud)

这将引发如下异常:-

    01:11:13.616 [main] WARN  o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 1064, SQLState: 42000
01:11:13.616 [main] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'd where d.name = 'kiran'' at line 1
01:11:13.621 [main] WARN …
Run Code Online (Sandbox Code Playgroud)

java spring jpa spring-data

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

使用 secp256r1 曲线(BouncyCastle)生成 ECDSA 签名,给出长度为 127 的签名

我正在使用 secp256r1 曲线和使用 BouncyCastle 的 SHA256 算法实现 ECDSA 签名生成。

对于某些输入,签名长度为 127 个字符。我觉得开头的“0”被删除了,因为签名被存储到 ECDSASigner 类中的 BigInteger 数据类型。

我已经使用确定性方法添加了来自 rfc6979 ECDSA 签名的样本

代码的相关部分:-

//Private key used in hex format -C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721
        String secretNumberK = "09F634B188CEFD98E7EC88B1AA9852D734D0BC272F7D2A47DECC6EBEB375AAD4";
        SecureRandom secureRandom = new FixedSecureRandom(Hex.decode(secretNumber));
        ECPrivateKeyParameters ecPrivateKeySpec = Util.getECPriKeyParameter(ecPrivateKey);//it is the PrivateKey of the sample shown 
        byte[]  messageInHex = Hex.decode("test");

         ECDSASigner ecdsaSigner = new ECDSASigner();

        ecdsaSigner.init(true, new ParametersWithRandom(ecPrivateKeySpec,
                secureRandom));

         BigInteger[]  sig = ecdsaSigner.generateSignature(Util
                .generateSHAHash(messageInHex));
        flag = true;
        LOG.debug("r:: " + sig[0].toString(16).toString());
        LOG.debug("s:: " + sig[1].toString(16).toString()); …
Run Code Online (Sandbox Code Playgroud)

java cryptography bouncycastle ecdsa

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

数据表搜索问题

jquery datatable用来在应用程序中显示报告.使用数据表提供的默认搜索.搜索适用于大多数场景.但我在搜索某些单词时遇到问题.

想出<td>标签之间的内容被视为文本.因此,如果我搜索单词add,则会显示所有行.这是因为第一列具有add作为类属性的工作.同样是用的情况下href,get,id,progress等.

<tr class="odd">
   <td class=""><a href="#" class="add" onclick="getById(68)">68</a></td>
   <td class="">friw678</td>
   <td class="">windows</td>
   <td class="">
      <span title="Bangalore">Bangal..</span>
      <p>Bangalore</p>
   </td>
   <td class=" sorting_1">
      <span title="6/6/2014 1:02:52 PM">6/6/2014 1..</span>
      <p>6/6/2014 1:02:52 PM</p>
   </td>
   <td class="">
      <div class="progressBarBlueComplete  ui-progressbar ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100">
         <div class="ui-progressbar-value ui-widget-header ui-corner-left ui-corner-right" style="display: block; width: 100%;"></div>
      </div>
   </td>
   <td class="">
      <span title="COMPLETED">COMPLE..</span>
      <p>COMPLETED</p>
   </td>
   <td class="">sha5</td>
</tr> …
Run Code Online (Sandbox Code Playgroud)

html javascript datatable jquery

0
推荐指数
1
解决办法
775
查看次数