Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 651

add parameter to an http header using java webservice

$
0
0

i have this http header :

    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.

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 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


Viewing all articles
Browse latest Browse all 651

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>