Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30294 > unrolled thread

Affect headers in javax.ws.rs.core.Response

Started byRVic <rvince99@hotmail.com>
First post2014-11-06 07:02 -0800
Last post2014-11-07 07:16 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Affect headers in  javax.ws.rs.core.Response RVic <rvince99@hotmail.com> - 2014-11-06 07:02 -0800
    Re: Affect headers in  javax.ws.rs.core.Response Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-07 06:52 +0000
      Re: Affect headers in  javax.ws.rs.core.Response Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-07 07:16 +0000

#30294 — Affect headers in javax.ws.rs.core.Response

FromRVic <rvince99@hotmail.com>
Date2014-11-06 07:02 -0800
SubjectAffect headers in javax.ws.rs.core.Response
Message-ID<4237d50b-39d3-4ea3-a693-eeddb5ec3e41@googlegroups.com>
I have an application that gets called as a Restful service, which makes a call out to a dll, and passes back the value returned from the third-party dll running on a remote server(the dll returns a javax.ws.rs.core.Response object, my Java application which calls it, must also return this type of object, so it just passes it along).

However, I need to amend some values in the headers of this object, removing some (like X-Powered-by :" ASP.NET" ) and to amend the Content-Type header. I see there are methods to access the headers for javax.ws.rs.core.Response, but none to amend them (change or delete)..

Any ideas how I might accomplish this? Thank you.

[toc] | [next] | [standalone]


#30304

FromAndreas Leitgeb <avl@auth.logic.tuwien.ac.at>
Date2014-11-07 06:52 +0000
Message-ID<slrnm5or1q.r49.avl@login.logic.tuwien.ac.at>
In reply to#30294
RVic <rvince99@hotmail.com> wrote:
> I have an application that gets called as a Restful service, which makes a call out to a dll, and passes back the value returned from the third-party dll running on a remote server(the dll returns a javax.ws.rs.core.Response object, my Java application which calls it, must also return this type of object, so it just passes it along).
>
> However, I need to amend some values in the headers of this object, removing some (like X-Powered-by :" ASP.NET" ) and to amend the Content-Type header. I see there are methods to access the headers for javax.ws.rs.core.Response, but none to amend them (change or delete)..
>
> Any ideas how I might accomplish this? Thank you.

If it doesn't have "official" modifiers, you might try 
to use reflection on it.

[toc] | [prev] | [next] | [standalone]


#30305

FromAndreas Leitgeb <avl@auth.logic.tuwien.ac.at>
Date2014-11-07 07:16 +0000
Message-ID<slrnm5ose5.r49.avl@login.logic.tuwien.ac.at>
In reply to#30304
Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> wrote:
> RVic <rvince99@hotmail.com> wrote:
>> I have an application that gets called as a Restful service, which makes a call out to a dll, and passes back the value returned from the third-party dll running on a remote server(the dll returns a javax.ws.rs.core.Response object, my Java application which calls it, must also return this type of object, so it just passes it along).
>>
>> However, I need to amend some values in the headers of this object, removing some (like X-Powered-by :" ASP.NET" ) and to amend the Content-Type header. I see there are methods to access the headers for javax.ws.rs.core.Response, but none to amend them (change or delete)..
>>
>> Any ideas how I might accomplish this? Thank you.
>
> If it doesn't have "official" modifiers, you might try 
> to use reflection on it.

update: I now googled the Response class, and saw that 
it is abstract, so, obviously the object you get is of
some (maybe non-public) sub-class.  That subclass might
have modifying accessors, which might help a lot.

I'd recommend dump the name of the actual class to a log
file, and try to find the actual definition of the class
(even if non-public).  It's probably still easier to call
non-public methods of non-public classes, than to dig
around in the fields directly.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web