Tag: java

Serving Files using Jersey Web Service (JAX-RS)

There are a lot of tutorials out there explaining how to send binary data (i.e. application/octet-stream) as response for Jersey web services (Java JAX-RS). Two possible solutions are based on either returning a Response or StreamingObject containing the appropriate binary data stream. Below you find a simple example for both scenarios: Additional checks have been […]

Bugfix für urbanairship-java SDK JsonParseExceptionBugfix for urbanairship-java SDK JsonParseException

There (still) exists a bug in urbanairship-java SDK related to parsing valid ISO8601 dates. The original bug report can be found here: GSon date parsing error. The Cause ISO8601 states that for date-time strings the separator “T” can be left out. Unfortunately the urbanairship-java SDK expects only fully qualified ISO8601 strings. Thus, when it receives […]

Custom Response Types in Jersey SecurityContext

Sometimes you might need to return custom response types in your SecurityContext implementation when using Jersey RESTFul web services. Basically, there are two options available to do so: Use javax.ws.rs.core.Response and throw a WebApplicationException or write your own ExceptionMapper Throw WebApplicationException Custom ExceptionMapper The other (even nicer option) is to write your own ExceptionMapper: