Servlet vs RESTful

RESTful is more an architecture style than a different technology. In server perspective, it is designed to be entirely stateless and self-contained on a per-request basis (i.e. there are no sessions). In client perspective, it’s more a way of getting information in different formats via URLs with (self-documenting) path parameters instead of request parameters. Surely … Read more

How to implement “Stay Logged In” when user login in to the web application

Java EE 8 and up If you’re on Java EE 8 or newer, put @RememberMe on a custom HttpAuthenticationMechanism along with a RememberMeIdentityStore. @ApplicationScoped @AutoApplySession @RememberMe public class CustomAuthenticationMechanism implements HttpAuthenticationMechanism { @Inject private IdentityStore identityStore; @Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext context) { Credential credential = context.getAuthParameters().getCredential(); if (credential != null) { … Read more

JSF request scoped bean keeps recreating new Stateful session beans on every request?

Stateful session beans (SFSB) are not exactly what you think they are. You seem to think that they behave somehow like session scoped JSF managed beans. This is untrue. The term “session” in EJBs has an entirely different meaning than the HTTP session which you’ve had in mind. The “session” in EJBs must be interpreted … Read more

java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException

Just implement Serializable If you’re getting a NotSerializableException like follows, java.io.NotSerializableException: bean.ProjectAreaBean then it simply means that the class as identified by the fully qualified name in the exception message (which is bean.ProjectAreaBean in your case) does not implement the Serializable interface while it is been expected by the code behind. Fixing it is relatively … Read more