REST API查询包含逻辑或无效的参数值

问题描述

如下面的代码所示,我试图创建简单的Restful API以基于listofvalues获取值,但是当我尝试使用值的编码表示形式调用服务时,例如http:// localhost:8180 / app / test / 32768 / LMN / find?value1 = 51%7C0090320%7C51%7C21940077 [按位编码或作为%7c]我可以看到我能够调用Controller并获得所需的结果,但是当我通过非编码表示时价值之类的东西,例如http:// localhost:8180 / app / test / 32768 / LMN / find?listofValue = 51 | 0090320 | 51 | 21940077我可以看到我们根本无法触及控制器本身。>

所以有人可以指导我在这里识别我的错误,因为没有编码表示的按位或操作数不起作用。

即http:// localhost:8180 / app / test / 32768 / LMN / find?listofValue = 51 | 0090320 | 51 | 21940077

下面是使用的代码段:

接口:

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;

interface abc
{
@GET
    @Produces({ "application/xml","application/json" })
    @Path("/test/{pathPara1}/{pathPara2}/find")
    public abstract Response method1(@PathParam("pathPara1") String pathPara1,@PathParam("pathPara2") String pathPara2,@Context UriInfo segment)
}

班级:

 class def implements abc
    {
    public  Response method1(@PathParam("pathPara1") String pathPara1,@Context UriInfo segment)
                                                     {
                                                     System.out.println("method started")
                                                     }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)