标签: chain

JAX-WS:在代码中定义服务器端处理程序链,而不是在外部xml中定义

我想为我的jax-ws webservice启用http压缩.我发现我必须使用可以修改http标头的自定义处理程序链.

我找到的所有教程都引用了注释@HandlerChain,指向处理程序链配置xml文件但我的问题是我的webservice必须尽可能轻量级,因此我无法在外部xml文件中定义我的处理程序链.

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

        final Endpoint ep = Endpoint.publish("http://localhost:8878/mywebservice",
                new WebserviceImpl() );
        final Binding binding = ep.getBinding();
        final List<Handler> handlerChain = binding.getHandlerChain();
        handlerChain.add(new MySuperbSOAPHandler());
        binding.setHandlerChain(handlerChain);
Run Code Online (Sandbox Code Playgroud)

有谁知道如何做到这一点?它甚至可能吗?

soap http jax-ws handler chain

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

如何存储功能链的数据?

一个简单的功能如下:

const L = a => L;
Run Code Online (Sandbox Code Playgroud)

形式

L
L(1)
L(1)(2)
...
Run Code Online (Sandbox Code Playgroud)

这似乎形成一个列表,但实际数据根本不存储,所以如果需要存储数据,例如[1,2],完成任务的最聪明的做法是什么?

const L = (a) => {
 // do somthing
  return L;
};
Run Code Online (Sandbox Code Playgroud)

我更喜欢这种简洁的箭头功能样式,并且不希望尽可能地破坏外部结构.当然,我理解一些外部结构修改是必需的,但我很好奇什么是可能的,特别是在功能风格而不是OO.

该规范仅用于存储功能链的数据.

有任何想法吗?谢谢.

最初最简单的方法是:

const L = (a) => {
  L.val = a;
  return L;
};
L.val = L;
Run Code Online (Sandbox Code Playgroud)

可以做一些,但没有数据积累.

{ [Function: L] val: [Circular] }
{ [Function: L] val: 1 }
{ [Function: L] val: 2 }
Run Code Online (Sandbox Code Playgroud)

注意:

每个列表应该独立于积累.

L(3)(4)
Run Code Online (Sandbox Code Playgroud)

将返回[3,4][2,3,3,4]与之前累积的其他列表.

高级主题!

如何存储Monoidal List功能链的数据?

javascript functional-programming list object chain

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

在链接日期选择器中设置最大日期

我用“从日期”和“到日期”制作了一个范围日期选择器。

这里代码:

From <input type="text" id="from" name="from" style="width: 80px" readonly>
To <input type="text" id="to" name="to" style="width: 80px" readonly>

<script>
$(function() {
    $( "#from" ).datepicker({
        showOn: "button",
        buttonImage: "images/calendar.png",
        buttonImageOnly: true,
        minDate: 0,
        changeMonth: true,
        beforeShowDay: $.datepicker.noWeekends,
        onSelect: function( selectedDate ) {
            $( "#to" ).datepicker( "option", "minDate", selectedDate );
        }
    });
    $( "#to" ).datepicker({
        showOn: "button",
        buttonImage: "images/calendar.png",
        buttonImageOnly: true,
        changeMonth: true,
        beforeShowDay: $.datepicker.noWeekends,
        onSelect: function( selectedDate ) {
            $( "#from" ).datepicker( "option", "maxDate", selectedDate );
        }
    });
});
</script>
Run Code Online (Sandbox Code Playgroud)

我想要做的是:当用户选择特定日期时 …

jquery datepicker chain maxdate

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

Nginx 不提供中间证书

我正在尝试在 Nginx 上安装 ssl 证书(实际上是 laravel forge)。我已将证书与中间证书连接起来,并且在 Nginx 错误日志中没有收到任何错误。但是,它在移动版 chrome 中不受信任 - 仅适用于台式机。

查看 Qualys ssl 测试,据说该链不完整。我不明白如何。

这是我的 Nginx 配置

server {
listen 80;
server_name **********.com;
return 301 https://**********.com$request_uri;
}

server {
listen 443 ssl;
server_name **********.com;
root /home/forge/**********.com/public;

# FORGE SSL (DO NOT REMOVE!)
ssl on;
ssl_certificate /etc/nginx/ssl/**********.com/1086/server.pem;
ssl_certificate_key /etc/nginx/ssl/**********.com/1086/server.key;

index index.html index.htm index.php;

charset utf-8;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; …
Run Code Online (Sandbox Code Playgroud)

ssl nginx chain

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

安卓。ConstraintLayout:约束结束不起作用

我需要使用 来创建链ConstraintLayout。我希望将 TextView 附加到左侧,文本后紧跟一个ImageView,另一个ImageView附加到屏幕的右侧。看一个例子。

在此输入图像描述

如果TextView包含长文本,我需要将文本转到另一行。也就是说,TextView不与右侧的图像视图重叠,但仅限于边距。看一个例子。

在此输入图像描述

这是我的代码:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:ignore="MissingPrefix">

    <TextView
        android:id="@+id/tvTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/text"
        android:textColor="@color/black"
        android:textSize="@dimen/text_size_14"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0" />

    <ImageView
        android:id="@+id/ivFirst"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="16dp"
        android:src="@drawable/ic_first"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/ivSecond"
        app:layout_constraintHorizontal_bias="0"
        app:layout_constraintStart_toEndOf="@id/tvTitle"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0" />

    <ImageView
        android:id="@+id/ivSecond"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_second"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0" />
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

如果文本不长,则一切正常,但如果文本很长,则它会叠加在屏幕上ImageView并超出屏幕。我尝试使用链条但没有任何效果。请帮我。

android margins chain android-layout android-constraintlayout

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

如何在 Rust 中的列表上链接运算符?寻找与 kotlin 代码等效的代码

我在 kotlin 中有以下代码,我试图找到 rust 等效项,但不理解 rust 中要转换的链接机制。

val windowSize = 2
val result = listOf(1, 2, 3, 4, 5, 6)
  .windowed(windowSize, 1) ; [[1,2], [2,3], [3,4], [4,5], [5,6]]
  .map { it.sum() }        ; [  3,     5,     7,     9,     11]
  .windowed(2, 1)          ; [[3,5], [5,7], [7,9], [9,11] ]
  .count { it[0] < it[1] } ; 4

;; result = 4, as there are 4 sequences that have first number less than 2nd,
;; when considering a sliding window over the original …
Run Code Online (Sandbox Code Playgroud)

chain rust kotlin

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

如何在工作完成前重新运行hadoop中的整个map/reduce?

我使用Java使用Hadoop Map/Reduce

假设,我已完成整个地图/减少工作.有没有什么方法可以重复整个地图/减少部分,而不会结束工作.我的意思是,我不想使用不同作业的任何链接,但只希望map/reduce部分重复.

谢谢!

java hadoop mapreduce chain

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

如何在没有链接的情况下调用函数链中的任何函数?

对不起,如果我的问题不够明确.我会把我的代码放在这里......

var chain = {
    'fn_1' : {
             //fn_1 code here
             chain.fn_2();},
    'fn_2' : {
             //fn_2 code here
             chain.fn_3();}

...and so on
}
Run Code Online (Sandbox Code Playgroud)

让我们说如果我调用chain.fn_1(),有没有办法可以在不调用chain.fn_2()的情况下执行此操作?

我现在能想到的是一面旗帜,但每个功能可能会有很多过剩的旗帜.你们有什么想法吗?

javascript function object literals chain

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

链接方法和传递变量

假设我有这个:

class "classname"
{

    ....

    public function section($id)
    {
        // variable method name
        $this->section->$id = new stdClass();
        return $this;
    }

    public function subsection()
    {
        // $id is not available here
        $this->section->$id->subsection = array();
        return $this;
    }

    ....

}
Run Code Online (Sandbox Code Playgroud)

当我打电话时:

$classname->section("test")
    ->subsection();
Run Code Online (Sandbox Code Playgroud)

它不起作用,因为 $id 不是全局的,也不是在第二个链链接中设置的。我是否必须手动将其传递给 ->subsection($id) 或者是否有更通用/更干净的方法将其传递到那里?

我在这里尝试完成的是创建一个具有多个部分的(大)对象。在这些部分中,对象和/或数组涉及更多(链接的)方法。

php oop class chain

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

如何在PHP中跟踪类链中的根对象

class Header
{
    public function __construct()
    {
        global $app;
        print($app->config);
    }
}

class Modules
{
    public function __construct()
    {
        $this->header = new Header();
    }
}

class Project
{
    public $config = "config";

    public function __construct()
    {
        $this->modules = new Modules();
    }
}

$app = new Project();
Run Code Online (Sandbox Code Playgroud)

现在,如果我想从范围内访问根对象(Project类的实例,即)Header,我必须记住我为实例选择的名称(可能会有所不同)并使用global关键字引用它.但我觉得这只是一个快速修复.我需要一种可靠的方法来访问根对象,从中构造当前对象(及其父对象).

换句话说,我需要访问$app内部,$app->modules->header给出名称app本身是可变的事实,链的长度也是动态的.

我可以访问父级的命名空间,parent::但是有类似的东西会很高兴first_ancestor::.

php oop inheritance chain

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

如何将ruby中的方法链接传递给一个方法的输出到连续方法

如何将方法的结果传递给ruby中的另一个方法?例如:

class D
  def initialize(text)
    @text = text
  end

  def a s
    "hello #{s}"    
  end

  def b s
    "hi #{s}"
  end
end
Run Code Online (Sandbox Code Playgroud)

所以,我想要做的是将方法a的输出传递给方法b.所以基本上(如果方法不在类中)我可以执行以下操作:

puts b(a "Tom") #=>hi hello Tom
Run Code Online (Sandbox Code Playgroud)

但是,即使这不在一个类中,如果有很多方法也不会很好看,所以必须有更优雅的方法来做到这一点.那么hi hello Tom通过将方法a和b应用于类D的实例来获得输出的正确方法是什么?

更新我只是想让它更清晰一些.例如,在F#中,您可以执行以下操作:

let a s = "hello " + s
let b s = "hi " + s
"Tom" |> a |> b #=> hello hi Tom
Run Code Online (Sandbox Code Playgroud)

这里我们定义了函数a和b,然后将结果传递给下一个函数.我知道它是一种功能性语言,所以做事的方式会有所不同.但我只是想知道Ruby中是否有这样的技巧?

ruby methods chain

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

为什么较新版本的C++不允许在类声明中定义纯方法?

为什么MSVC++ 2015及其早期版本允许在pure virtual method类声明中定义,但On GCC 4.9和我想MSVC++ 2017不允许:

    #include <iostream>     

    class A{
        public:
            virtual void Foo() = 0;
    };

    class B: public A {
        public:
            virtual void Foo() = 0 { std::cout << "B::Foo()" << std::endl;
            }; // Allowed on MSVC 2015 and old versions

            //virtual void Foo() = 0; // on newer versions
    };

    //void B::Foo(){
    //  std::cout << "B::Foo()" << std::endl;
    //}     // Ok here!

    class C : public B{
        public:
            void Foo(){
                B::Foo(); …
Run Code Online (Sandbox Code Playgroud)

c++ oop chain

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

Python 将多个函数链接到一个函数中

我有几个字符串处理函数,例如:

def func1(s):
    return re.sub(r'\s', "", s)

def func2(s):
    return f"[{s}]"
...
Run Code Online (Sandbox Code Playgroud)

我想将它们组合成一个管道函数:my_pipeline(),以便我可以将其用作参数,例如:

class Record:
    def __init__(self, s):
        self.name = s
    
    def apply_func(self, func):
        return func(self.name)

rec = Record(" hell o")
output = rec.apply_func(my_pipeline)
# output = "[hello]"
Run Code Online (Sandbox Code Playgroud)

目标是用作my_pipeline参数,否则我需要一一调用这些函数。

谢谢。

python pipeline function chain

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