This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Jersey Response issue driving me batty!

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using jersey 1.8 from the jersey bundle and running on glassfish 3.1. I'm writing a REST web service and all has been peachy, until I need to send a specific response code. Every time I try to get a ResponseBuilder object I get a very generic jersey exception. Here's my code:



The method errors out on line 20. Note I know that this code doesn't do anything useful. I'm attempting to return a 403 response with a custom header. In my testing I deliberately call the method with parameters that will cause a ForbiddenException (a custom exception) to be thrown. Here is the error I see when I attempt to execute line 20 above:


Prior to this the method's return type was JSONObject and I wasn't attempting to modify the response in any way and life was hunky-dory. Does anyone have any ideas what I could do to make this work? I've been at it for hours.


Regards,

Manny
 
Manny Garcia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I found something that worked. I did not find any documentation that said to do it this way, but it has the virtue of working:




Regards,

Manny
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!