小编Ana*_*man的帖子

IBM Mq消息头

我正在向远程队列发送消息,我无法控制它.

我发送一个xml文件作为消息,但当应用程序读取消息时,它会获得一个消息标题

<mcd><Msd>jms_text</Msd></mcd>  \0\0\0l<jms><Dst>queue:///TEST</Dst><Tms>1281475843707</Tms><Cid></Cid><Dlv>1</Dlv></jms>
Run Code Online (Sandbox Code Playgroud)

我不希望这个消息头存在,我发送此消息的代码如下:

Properties props = new Properties();
    props.setProperty("java.naming.factory.initial",this.initialFactory);
    props.setProperty("java.naming.provider.url", url);

    Context context = new InitialContext(props);

    QueueConnectionFactory qcf = (QueueConnectionFactory) context.lookup(this.context);
    qConn = qcf.createQueueConnection();
    queue = (Queue)context.lookup(name);
    qSession = qConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
    qConn.start();
            QueueSender send = qSession.createSender(queue);
     String text = "My xml file";
     TextMessage tm = qSession.createTextMessage(text);
     send.send(tm);
     send.close();
Run Code Online (Sandbox Code Playgroud)

我该如何避免这种情况?

head ibm-mq

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

Spring Security自定义用户授权表

我想在我的网络应用程序中使用Spring Security 3.1.我已经开始关注这个特定的教程了.

我正在使用此处使用的技术,其中身份验证提供程序是数据源

<authentication-manager>
    <authentication-provider>
        <jdbc-user-service data-source-ref="dataSource"

           users-by-username-query="
              select email,password 
              from usr where email=?" 

           authorities-by-username-query="
              select u.email, ur.authority from usr u, usr_roles ur 
              where u.usr_id = ur.usr_id and u.email =?  " 

        />
    </authentication-provider>
</authentication-manager>
Run Code Online (Sandbox Code Playgroud)

因此,如果您发现我使用该电子邮件作为我的用户名,并且我没有启用的列.

这似乎不起作用.

我的登录表单看起来像

<form name="f" action="<c:url value="j_spring_security_check" />" method="POST">
    <table>
        <tr>
        <td>User:</td>
        <td><input type="text" name="j_username" value=""></td>
        </tr>
        <tr>
        <td>Password:</td>
        <td><input type="password" name="j_password" />
        </td>
        </tr>
        <tr>
        <td colspan="2">
                <input name="submit" type="submit" value="submit" />
            </td>
        </tr>
        <tr>
        <td colspan="2">
                <input name="reset" type="reset" />
        </td> …
Run Code Online (Sandbox Code Playgroud)

spring-security

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

查询Winston日志

我正在使用winston登录node.js应用程序.

我看到有查询它的选项.

该示例显示了如何使用from和to中的选项.

我的问题是

  1. 还有什么其他选择?
  2. 如何指定应查询的文件?

logging node.js winston

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

我怎样才能得到git push要求确认或运行一些检查?

我想以某种方式自定义我的Git提示符,以便在我将某些东西推送到远程仓库之前提醒我或为我运行检查。

例如,当我跑步时

git push
Run Code Online (Sandbox Code Playgroud)

Git应该问用户

Did you run unit tests locally?
Run Code Online (Sandbox Code Playgroud)

或类似的东西,这样我就不会意外地推送未经单元测试的代码。

git git-push

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

servlet是编写Java Web应用程序的唯一方法

servlet是用Java编写Web应用程序的唯一方法吗?

java servlets

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

将JSTL与Facelets集成

我正在考虑在同一个Web项目中使用Facelets和JSTL.

整合这些有什么问题吗?

jsf jstl facelets

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

SLF4J Java日志设计

我开始使用SLF4J进行日志记录,而对我来说第一件事就是下面这段代码

public class MyClass
{
   private static final logger = org.slf4j.LoggerFactory.getLogger(MyClass.class)
}
Run Code Online (Sandbox Code Playgroud)

使用类作为参数来获取记录器实例的设计原则或逻辑是什么?

java logging slf4j

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

Java字符串字符编码 - 用于法语 - 荷兰语语言环境

我有以下代码

public static void main(String[] args) throws UnsupportedEncodingException {
        System.out.println(Charset.defaultCharset().toString());

        String accentedE = "é";

        String utf8 = new String(accentedE.getBytes("utf-8"), Charset.forName("UTF-8"));
        System.out.println(utf8);
        utf8 = new String(accentedE.getBytes(), Charset.forName("UTF-8"));
        System.out.println(utf8);
        utf8 = new String(accentedE.getBytes("utf-8"));
        System.out.println(utf8);
        utf8 = new String(accentedE.getBytes());
        System.out.println(utf8);
}
Run Code Online (Sandbox Code Playgroud)

以上的输出如下

windows-1252
é
?
é
é
Run Code Online (Sandbox Code Playgroud)

有人可以帮我理解这是做什么的吗?为何输​​出?

java character-encoding

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

Groovy地图创建,使用分配给上一个键的值

有没有办法在地图中使用分配给上一个键的值,例如:

def x = [
        a: someList.sum(),
        b: anotherList.sum(),
        c: someList.sum() / anotherList.sum()
]
Run Code Online (Sandbox Code Playgroud)

我希望'c'的值为a/b,所以有一个快捷方式,这样我就不必在计算'c'时重新计算总和

groovy dictionary

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

AWS ELB 间歇性 502 网关超时错误

我在部署在 3 个 EC2 实例上的 node.js 应用程序前面有一个 ELB。

我已经开始观察间歇性 HTTP 502 错误网关错误

以下是我的访问日志的摘录。这些 502 错误没有规律,所以我无法缩小原因?

ELB问题还是应用问题?

访问日志可以帮助我解决这个问题吗?

每 100 个请求中有 5 个请求会发生这种情况

*type*                     https    
*timestamp*                2019-05-08T14:50:11.438405Z  
*elb*                      <my-elb>
*client:port*              clientIp:port
*target:port*              targetIp:port
*request_processing_time*  0    
*target_processing_time*.  2.596    
*response_processing_time* -1   
*elb_status_code*          502  
*target_status_code*       -    
*received_bytes*           792  
*sent_bytes*               293  
*request*                  POST https://app/app-url/2.0/resourcepath/id/abc?queryParamA=abc&queryParamB=false&queryParamC=6b84c34 HTTP/1.1  
*user_agent*               Apache-CXF/3.2.5 
*ssl_cipher*               ssl-cipher
*ssl_protocol*             TLSv1.2  
*target_group_arn*         arn
*trace_id*                 traceId
*domain_name*              cool-domain-name
*chosen_cert_arn*          session-reused   
*matched_rule_priority*    0    
*request_creation_time*    2019-05-08T14:50:08.841000Z  
*actions_executed*         forward  
*redirect_url*             -    
*error_reason*             -
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-elb

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