gpt4 book ai didi

security - 我如何更改默认的 RpcRequestBuilder?

转载 作者:行者123 更新时间:2023-12-03 22:16:03 26 4
gpt4 key购买 nike

我写了一个自定义的 RpcRequestBuilder 来进行身份验证,就像这样:

http://stuffthathappens.com/blog/2009/12/22/custom-http-headers-with-gwt-rpc

但我需要每个 GWT RPC 服务在使用之前设置我的自定义构建器,或者如果可能的话,告诉 GWT 使用我的版本作为默认版本。我该怎么做?

最佳答案

public static final UtilServiceAsync getInstance() {
if (instance == null) {
instance = (UtilServiceAsync) GWT.create(UtilService.class);
ServiceDefTarget target = (ServiceDefTarget) instance;

RpcRequestBuilder reqBuilder = new RpcRequestBuilder() {
@Override
protected RequestBuilder doCreate(String serviceEntryPoint) {
RequestBuilder rb = super.doCreate(serviceEntryPoint);
rb.setHeader("HEADER_SIGNATURE", "your token");
return rb;
}
};

target.setRpcRequestBuilder(reqBuilder);
//target.setServiceEntryPoint(GWT.getModuleBaseURL() + "springGwtServices/" + "utilService");
}
return instance;
}

关于security - 我如何更改默认的 RpcRequestBuilder?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4556669/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com