而我似乎无法理解这种变量声明:
_, prs := m["example"]
Run Code Online (Sandbox Code Playgroud)
究竟什么是" _,做"以及为什么他们宣布这样的变量而不是
prs := m["example"]
Run Code Online (Sandbox Code Playgroud)
(我发现它是Go by Example:Maps的一部分)
我使用的是Jersey 2.9,我创建了一个过滤器,它将获取一个加密的标头值,并对其进行解密,然后将其传递给被调用的端点.我不知道如何做到这一点,我一直在互联网上搜索,但没有真正找到我想做的具体例子.调用过滤器,我只是将值从它传递到端点时出现问题.
你们能帮帮我吧!
以下是一些示例代码:
public class MyFilter implements ContainerRequestFilter
{
@Override
public void filter(ContainerRequestContext requestContext) throws WebApplicationException {
String EncryptedString = requestContext.getHeaderString("Authentication");
/* Doing some methods to remove encryption */
/* Get a string which I want to pass to the endpoint which was called on, in this example: localhost:4883/rest/test */
}
}
@Path("rest")
public class restTest
{
@Path("test")
@GET
@Produces(MediaType.APPLICATION_JSON)
public String Testing(){
/* Process the value from the MyFilter */
}
}
Run Code Online (Sandbox Code Playgroud)