8 Replies Latest reply on Feb 5, 2014 3:35 AM by l.sroka

    Resteasy header in custom ContextMapper don't work - i think ?

    l.sroka

      Hello, like in title i have little test on adding custom header to rest response.
      I have test it with https://addons.mozilla.org/pl/firefox/addon/restclient/ and i dont see in response headers my custom header.
      Also in firebug http://127.0.0.1:8080/test/rest/api

       

      here it is my custom context mapper:

      public class MyTestComposer extends RESTEasyContextMapper{

       

          @Override

          public void mapFrom(RESTEasyBindingData source, Context context) throws Exception {

              System.out.println("mapFrom:");

              super.mapFrom(source, context);

           

          }

       

          @Override

          public void mapTo(Context context, RESTEasyBindingData target) throws Exception {

              System.out.println("mapTo");

              super.mapTo(context, target);     

              target.addHeader("test-my-head", "lol");     

          }

      }

      All simple app in attachment.

       

      I saw in Setting headers on the request of a Client REST binding. that it is possible to add this header in custommapper.

       

      1.  Re: Setting headers on the request of a Client REST binding.

         Keith Babo Master

       

      You can also implement your own context mapper to add the headers.  Or you could just set the context properties in whatever code is invoking the REST reference binding.

       

      What i am doing wrong ?

       

      SY version 1.1.0 with eap 6.1