小编Jan*_*ert的帖子

将HttpRequest注入SOAP端点

我正在寻找一种将HTTP标头信息和SOAP消息一起转发到Spring Endpoint的方法,以便能够访问IP地址等详细信息。

相关的web.xml:

<servlet>
    <servlet-name>SoapHost</servlet-name>
    <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
    <init-param>
        <param-name>transformWsdlLocations</param-name>
        <param-value>true</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>SoapHost</servlet-name>
    <url-pattern>/ws/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

SoapHost-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:sws="http://www.springframework.org/schema/web-services"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/web-services                       
       http://www.springframework.org/schema/web-services/web-services-2.0.xsd">

    <!-- To detect @Endpoint -->
    <sws:annotation-driven />

    <!-- To detect @Service, @Component etc -->
    <context:component-scan base-package="za.co.mycee.soaphost" />

    <!-- To generate dynamic wsdl for SoapHost Services -->
    <sws:dynamic-wsdl 
        id="SoapHost"
        portTypeName="SoapHost" 
        locationUri="/ws/SoapHost"
        targetNamespace="http://www.mycee.co.za/SoapHost"> 
        <sws:xsd location="/WEB-INF/SoapHost.xsd" />
    </sws:dynamic-wsdl>

    <!-- Validate Request and Response -->
    <sws:interceptors>
        <bean id="MyCeeSoapHost" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
            <property name="schema" value="/WEB-INF/SoapHost.xsd" />
            <property …
Run Code Online (Sandbox Code Playgroud)

java spring jaxb jaxb2

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

在 dart 中实例化一个泛型类

我已经使用 typedef 查看了有关 stackoverflow 的示例,但看起来它主要用于回调,因此不确定它是否与我正在处理的内容相关。我正在使用执行 RPC 的泛型实现一个类......

abstract class Message {

  int created = new DateTime.now().millisecondsSinceEpoch;
  Map map = new Map();

  Map toJson();
  void fromJson(String json){
    map = JSON.decode(json);
    this.created = map["created"];
  }

  String toString() {
    return JSON.encode(this);
  }

  Message(){
    map["created"] = created;
  }

}
Run Code Online (Sandbox Code Playgroud)

___Request 和 ___Response 都扩展了 Message:

import 'Message.dart';

class TestResponse extends Message {

  String test;
  String message;

  Map toJson() {
    map["test"] = this.test;
    return map;
  }

  fromJson(String json) {
    super.fromJson(json);
    this.test = map["test"];
    this.message = map["message"]; …
Run Code Online (Sandbox Code Playgroud)

generics dart

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

有条件地在XML ArrayList中包含bean

我想知道是否有可能根据某些属性有条件地包括春豆。

在我applicationContext.xml的清单中,我列出了我设置的bean:

<bean id="server1Config" class="... />
<bean id="server2Config" class="... />
<bean id="server3Config" class="... />
...
Run Code Online (Sandbox Code Playgroud)

然后将它们包括在列表中:

<bean class="java.util.ArrayList">
        <constructor-arg>
            <list>
                <ref bean="server1Config"/>
                <ref bean="server2Config"/>
                <ref bean="server3Config"/>
                ...
            </list>
    </constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)

我想有条件包括server1Config,server2Config,server3Config等取决于是否${includeServer1} == true${includeServer2} == true等等,如果可能的话,只有当他们被标记为包含初始化这些豆子。

澄清一下,它是ping服务,用于检查服务器是否在线,每个bean都包含特殊的url。如果我有5台服务器正在运行,我想在我的配置中设置includeServer1=true... includeServer5=true... includeServer6=false,如果我关闭server2,我想先更改includeServer2 = false,然后再关闭服务器,以免被SMSe告知server2离线。

java xml spring

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

Angular2 Dart - 获取组件的子元素

我有一个名为的组件button-search,其中包含搜索选项的下拉列表:

<button-search> 
    <item type="identifier">Identifier</item>
    <item type="title">Title</item>
    <item type="city">City</item>
    <item type="town">Town</item>
    <item type="address">Address</item>
    <item type="postal">Postal</item>
    <item type="divider"></item>
    <item type="clear">Clear Search</item>
</button-search>
Run Code Online (Sandbox Code Playgroud)

item组件不应该直接呈现任何内容,而是将复杂的参数传递给button-search组件,以便button-search组件可以按照应该呈现的方式呈现这些下拉项.

Item 定义如下:

@Component(
    selector: 'item',
    template: '')
class Item {

    @Input() String type = "type-goes-here";

}
Run Code Online (Sandbox Code Playgroud)

ButtonSearch 定义如下:

@Component(
    selector: 'button-search',
    directives: const[Item],
    template: '''
       ... enormous template ...    
    ''')
class ButtonSearch {

    ButtonSearch(@ViewChildren(Item) QueryList<Item> items){

        print(items);

    }
}
Run Code Online (Sandbox Code Playgroud)

我没有看到打印到控制台的9个项目列表,而是我所看到的[].

我试过使用String param而不是对象,但它仍然给我null.

ButtonSearch(@ViewChildren('item') QueryList<Item> items){
Run Code Online (Sandbox Code Playgroud)
  1. 我错过了什么来@ViewChildren获取所有项目和打印以外的东西[] …

dart angular-dart angular

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

锁定Kotlin中的serialVersionUID

我整个上午一直serialVersionUID在和Kotlin班级进行斗争.我有一个BaseModel扩展的Project

abstract class BaseModel<T>(
        var id: Int? = null,
        private val fileName: String,
        private val data: MutableList<T>,
        private val indices: MutableMap<Int, T>
) : Serializable {

  ...

   protected fun writeToDisk() {
       val oos = ObjectOutputStream(BufferedOutputStream(FileOutputStream(fetchFileName()))   )
       oos.writeObject(fetchData());
       oos.close();
   }


}
Run Code Online (Sandbox Code Playgroud)

而项目类:

class Project(
        var name: String = "",
        var repo: String = ""

) : BaseModel<Project>(
        data = Data.projects,
        indices = Data.projectsIndex,
        fileName = "data/projects.dat"
), Serializable {

    ...

    override fun toString(): String {
        return …
Run Code Online (Sandbox Code Playgroud)

kotlin

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

java.lang.IllegalArgumentException:Callable期望有4个参数,但提供了3个

我正在尝试使用Kotlin反射调用一个函数,但出现错误:

java.lang.IllegalArgumentException:Callable期望有4个参数,但提供了3个。

这是进行反射调用的代码:

    annotation.listeners.forEach { listener: KClass<*> ->
        listener.functions.forEach { function: KFunction<*> ->
            if (function.name == "before") {
                function.call(annotation.action, request, response)
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

我添加了类型listenerfunction只是为了使问题更易读。

这就是被调用的方法:

fun before(action: String, request: RestRequest, response: RestResponse)
Run Code Online (Sandbox Code Playgroud)

为了再次检查我的类型是否正确,我这样做:

if (function.name == "before") {
    println(annotation.action::class)
    println(request::class)
    println(response::class)
}
Run Code Online (Sandbox Code Playgroud)

打印(此before功能所需的正确类型):

class kotlin.String
class com.mycompany.RestRequest
class com.mycompany.RestResponse
Run Code Online (Sandbox Code Playgroud)

第四个参数应该是什么?

reflection kotlin

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

在Dart中禁用print()

有没有办法禁用打印功能Dart代码或以某种方式拦截它?我们团队中的一些开发人员继续使用print而不是我们构建的记录器,这意味着我们会在控制台中看到很多垃圾,除非我们进行搜索替换并查找并替换print(String)为所有代码,否则我们无法关闭它们log.info(String)

理想情况下,我们应该使用pre-commit钩子来检查已提交的代码是否包含打印,然后拒绝提交,但是似乎仅在代码级阻止打印会更快。

// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of dart.core;

/// Prints a string representation of the object to the console.
void print(Object object) {
  String line = "$object";
  if (printToZone == null) {
    printToConsole(line);
  } else {
    printToZone(line);
  }
}
Run Code Online (Sandbox Code Playgroud)

print是的一部分 …

dart

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

是否可以在元素之间对齐渐变?

我试图在日历中为过去的日子添加渐变,但渐变线未对齐看起来有点无聊。

div.month {
  flex: 1 1 auto;
  display: grid;
  grid-gap: 1px;
  grid-template-columns: repeat(7, 1fr);
  background-color: var(--color-border);

}

div.day {
  background-color: var(--color-fill);
}

div.day + .past {
  background: repeating-linear-gradient(
    -45deg,
    var(--color-fill),
    var(--color-fill) 1.5rem,
    var(--color-gradient-calendar-past) 1.5rem,
    var(--color-gradient-calendar-past) 3rem
  );
}
Run Code Online (Sandbox Code Playgroud)
<div class="month noselect">
        <div class="day void"><div class="day-number"></div></div>
        <div class="day past"><div class="day-number">1</div></div>
        <div class="day past"><div class="day-number">2</div></div>
        <div class="day past"><div class="day-number">3</div></div>
        <div class="day past"><div class="day-number">4</div></div>
        ...
        <div class="day today"><div class="day-number">17</div></div>
Run Code Online (Sandbox Code Playgroud)

如果不将日子变成正方形(aspect-ratio: 1/1),是否可以对齐这些梯度?

在此输入图像描述

我在想也许我可以让整个组件的背景变成渐变,但是如果我想在其他日子使用不同颜色的相同渐变,我就会遇到同样的问题。

在此输入图像描述

css gradient

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

Spring Integration-file:inbound-channel-adapter-删除原始文件

我有一个file:inbound-channel-adapter,它轮询目录中的文件,然后通过SFTP将其发送到服务器。上传完成后(可以正常使用),需要删除原始文件;上传原始文件后如何删除?在file:outbound-channel-adapter中,有一个我可以设置为自动删除文件的属性。

<file:inbound-channel-adapter 
    id="incomingFiles"      
    channel="myFiles"       
    directory="file:/tmp/kots">
    <int:poller id="poller" fixed-delay="1000"/>
</file:inbound-channel-adapter>

<int:channel id="myFiles"/>

....

<sftp:outbound-channel-adapter 
    id="sftpOutboundAdapter"
    channel="myFiles"
    charset="UTF-8"     
    remote-directory="/tmp/testing"     
    session-factory="sftpSessionFactory"/>
Run Code Online (Sandbox Code Playgroud)

spring spring-integration

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

Angular2*ngFor中的分组元素

我希望使用Angular2实现以下功能,对于列表中的每个条目,都有一个tr包含多个列的标记,然后是另一个tr跨越所有列的标记(或两个).

<table >
    <tbody>
        <tr>
            <td> field 1 </td>
            <td> field 2 </td>
            <td> field 3 </td>
        </tr>
        <tr>
            <td colspan="3"> Long string goes here </td>
        </tr>
        <tr>
            <td> </td>
            <td> </td>
            <td> </td>
        </tr>
        <tr>
            <td colspan="3"> </td>
        </tr>
        <tr>
            <td> </td>
            <td> </td>
            <td> </td>
        </tr>
        <tr>
            <td colspan="3"> </td>
        </tr>
        ...
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

重复单行很容易:

<tr *ngFor="let good of data['goods']; let i = index">
    <td> good['field1'] </td>
    <td> good['field2'] </td>
    <td> good['field3'] </td>
</tr> …
Run Code Online (Sandbox Code Playgroud)

dart angular

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