Rest API Matrix param annotation

I have a class called InjectDemoResource in which I have created a method getParam() which is as below As you can see I have set the path to /injectdemo and /annotations, I used the the @MatrixParam annotation in the getParam() method. I am using R...
more »

2017-02-22 23:02 (2) Answers

Spring REST caching RSS AbstractRssFeedView

I am developing a REST based webservice using springs to serve a RSS feed. Updates to the RSS are very rare (a couple of times a week) and hence I want to cache the RSS feed rather than building it every time someone requests for that. Here is my cod...
more »

2017-02-22 23:02 (1) Answers

Modify build.gradle to reference local jar

(Note that I am a novice at Eclipse / Gradle, so please bear with me.) I am trying to modify the following project because there is a customization I would like to make: In turn, I would like to the...
more »

2017-02-22 21:02 (1) Answers

Can't add header to request in RETROFIT

I use retrofit to make REST API calls. To authenticate there is used API KEY which I want include within header. I tried two approaches: Add Annotation within interface method: @GET("discover/movie") Call<PopularMovies> getPopularMovies(@Quer...
more »

2017-02-22 19:02 (0) Answers

Sorting an array and keeping original index

I am trying to make a program that will sort the array but keep track of their original indexes. I don't want to change the original array so I copied it into list[][]. public static void main(String[] args) { int array[] = {17, 10, 8, 13,...
more »

2017-02-22 19:02 (3) Answers

What is the erasure of a bounded generic type?

I have a class with generics. I know that generic type information is stripped at runtime, but this is with a bound type. I thought that at compilation java.lang.Object is replaced with the bound type. If I know that everything will always be at l...
more »

2017-02-22 18:02 (1) Answers

Generic addListener in Java

I'm working on a program that need to react to different custom events and listeners. I'm trying to make it short using generics, the fact is, I don't understand where is my mistake. Here my code : The listeners and the event : public interface M...
more »

2017-02-22 18:02 (2) Answers

JBoss 1-way and 2-way SSL symultaneously

I have a JBoss application with multiple endpoints. All these endpoints should be available to any user over one way SSL (HTTPS), except for a specific endpoint (let's call it /app/sensitive) which should only be accessed by a specific machine (ie. 2...
more »

2017-02-22 00:02 (1) Answers

How do I cast to generic type?

The following code produces an "unchecked or unsafe operation" warning, how can I cast the Object o to type T without causing the warning? I know that I could suppress the warning, but I want to know the "correct" way. public class MyType<T>...
more »

2017-02-21 22:02 (1) Answers

Too large files when downloading Piktogramms

I'm trying to download some images provided by a hoster. This is the method I use: public static void downloadImage(String imageLink, File f) throws IOException { URL url = new URL(imageLink); byte[] buffer = new byte[1024]; BufferedInpu...
more »

2017-02-21 19:02 (1) Answers