Skip to content
Advertisement

How to create REST API with optional parameters?

I need to implement an API with these path params. Can the second and third params by optional? So the client need not pass these, but have to pass the first and last. If this is not possible, then is it recommended to rearrange the params in this way? How to provide the optional params? Answer You can match the

Java: Importing StringUtils

I am trying to import StringUtils. My first step was downloading ‘commons-lang3-3.4.jar’ which I included in the same directory as my PersonTester.java file that I am working on. In my PersonTester.java in which I intend to use StringUtils, I include: When I try and compile I get the following error: import org.apache.commons.lang3.StringUtils; When I comment out the import statement and

Android Studio FloatingActionButton error

I installed Android Studio yesterday, and after battling multiple java and other errors, I have come to an error that I cannot seem to fix. I have not added anything or done any code, I have simply just started a new project and I get this error in the Preview over the phone: Rendering Problems: Followed by a bunch of

exception android.support.multidex.MultiDexApplication cannot be cast class

I have a problem, my app generate this exception,and i don’t understand. I have implement the multiDexEnabled in my build.gradle My Class Java } file Gradle Manifest.xml Answer I think you should extend the AnalyticsApplication class into your own class, like this: After this, you must change your AndroidManifest.xml file to this: Please, check this link for more information: http://developer.android.com/reference/android/support/multidex/MultiDex.html

How can i remove unnecessary top padding in cardview?

I managed to implement Cardviews in my app, but the cardview show an unnecessary padding in the top. What i want to achieve is to get a header image like this : Here’s my cardview Layout file : This is the code of the RecyclerView : android:layout_height=”match_parent” android:padding=”16dp”> I manage to change the attribute cardUseCompatPadding but that not affect the

Retrofit: How to wait for response

I have AsyncTask and the doInBackground method inside which, I sending POST request using Retrofit. My code looks like: The problem is: Retrofit sending request asynchronously and while it, the doInBackground method returning the value. So I need to send a request in the same thread with all executions in the sequence. One by one. And returning from doInBackground occurs

UnrecognizedPropertyException: Unrecognized field not marked as ignorable at Source: org.apache.catalina.connector.CoyoteInputStream@14ec141

I am making rest web-services my code is: but when i call it with this Json : I’m getting following Exception: javax.servlet.ServletException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field “userId” (Class com.tazligen.model.GroupMemberMap), not marked as ignorable at [Source: org.apache.catalina.connector.CoyoteInputStream@14ec141; line: 2, column: 15] (through reference chain: com.tazligen.model.GroupMemberMap[“userId”]) My GrouMemberMap model class is : I have tried another method just like this : with json

Spring Data MongoDB Annotation @CreatedDate isn’t working, when ID is assigned manually

I’m trying to use auditing to save dateCreated and dateUpdated in my objects, but since I set ID manually, there’s some additional work. Following Oliver Gierke’s suggestion in DATAMONGO-946 I’m trying to figure out how to correctly implement it. As original poster in Jira task above, I’ve downloaded example from here https://github.com/spring-guides/gs-accessing-data-mongodb.git and modified it a bit: and and a

Advertisement