Skip to content

Tag: java

Get cookie value in java

I’ve initialized cooke like this in my JSP, So, all the cookies created will have the same name, but different value for different user access time. At the ending of java servlet I want to deactivate/kill the cookie that has been passed at the beginning of java servlet and say if they are 5 users using …

How to create a SSO Service Provider?

I am new to the concept of Single Sign On. We already have a Java web application which manages its user. Now the requirement is that the authentication will be provided by the SSO Idp at customer end (using SAML) after which the request will be forwarded to our application. Since I haven’t implemented …

Spock throw exception test

I test Java code with Spock. I test this code: I wrote test: And it fails because AnotherCustomExceptio is thrown. But in the try{}catch block I catch this exception and throw a CustomException so I expected that my method will throw CustomException and not AnotherCustomExceptio. How do I test it? Answer I be…

Wildfly configuration with DataSource

this is the first time I am trying to setup datasource in my Wildfly server. I tried to follow some tutorials which I found on Google but it still doesn’t work. I am working on a web service but I keep getting some errors when I deploy my .war file. Here is the latest log when app is deployed: persisten…

Can an interface method have a body?

I know that an interface is like a 100% pure abstract class. So, it can’t have method implementation in it. But, I saw a strange code. Can anyone explain it? Code Snippet: EDIT: My IDE is Intellij Idea 13.1. The project SDK is java 7 <1.7.0_25>. The IDE is not showing any compiler error. But, When…