[英]add parameter to an http header using java webservice
i have this http header : 我有这个HTTP标头:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 15 Mar 2016 17:08:29 GMT
And what i want is to add 2 parameter: mytotalcount and mytotalresult. 我想要添加2个参数:mytotalcount和mytotalresult。
i have to add this into my response however it's not working i can't do: 我必须将此添加到我的响应中,但是它不起作用,我不能做:
response.Headers.Add("mytotalcount", "10");
Also can't do 也做不到
request.setAttribute("mytotalcount","10");
So i am blocked any ideas please ? 因此,请您阻止任何想法? Thanks for your help !
谢谢你的帮助 !
Here is the part of the code: 这是代码的一部分:
public class SitesResponse {
private Result result;
private List<GeographicSite> site;
public SitesResponse () {
this.result = new Result();
this.site = new ArrayList<GeographicSite>();
}
public List<GeographicSite> getSite() {
return site;
}
public void setSite(List<GeographicSite> site) {
this.site = site;
}
} Ensuite l'autre classe qui utilise SitesResponse }利用SitesResponse进行课堂教学
SitesResponse response = new SitesResponse();
et 等
if (testiing) {
try {response = siteManager.geographicSitesAPIV1(args);
response.getResult().setCode("error");
response.getResult().setLabel("no addr found");
And this is what i tried ... earlier 这就是我早先尝试过的
System.out.println(response.toString().getBytes().toString()+"azezae");
// request.Headers.Add("headername", "headervalue");
// request.setAttribute("X-Total-Count","10");
//response.setAttribute("X-Result-Count", "7");
//response.setIntHeader("mytotalcount", 5);
//////////////////////////////////////////////////:::::::
In picture where i want to add my two parameters result from SOAPui 在要添加两个参数的图片中, 来自SOAPui
Hello again Thank you for your time, i was trying to edited the wrong class so what i did you just 再次您好,谢谢您的时间,我正在尝试编辑错误的课程,所以我刚才所做的只是
resp.addIntHeader(att, 10);
resp.addIntHeader(att2, 5);
Thank you for your time and answers! 感谢您的时间和答复!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.