Michael Schembri

Greenhorn
+ Follow
since Aug 18, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Michael Schembri

This ajax calls are made in an authetnicated page. I'm looking into this for when the session times out. the idea is that i would refresh the entire page if user gets a 403, requiring the user to login.

I tried to check for roles from a servlet that does nto fall under the security-constraint and as you pointed out it didn't work. I was going to return the 403 if a custom user session object is null.
12 years ago
I have setup my web.xml with a login page, however, I would like the server to return a 403 status for certain servlets that are used for async calls.

Servlets requiring authentication are all mapped as /restricted/*

I can only think of 2 options:

1. mapping async servlets outside of "restricted" and checking for the roles in the servlets

2. handling redirect to login page in servlets that forward to a page

Is there any other way I can do this and whilst keeping access control consistent throughout?
12 years ago
Looked into your suggestion to go for a surrogate pk, makes more sense, tnx.. the unique constraint for composite can be enforced at hibernate level using @UniqueConstraint

13 years ago
Thanks, I tried it out and it works

Ok: GenericDao<OrderLinePK, OrderLine>
Error: GenericDao<OrderLinePK, Customer>

13 years ago
My question is not related to the hibernate/database aspect, I only mentioned that to explain what I would like to achieve.

see comments in the code below

13 years ago
Ok, here's some background info. GenericDao is later implemented as a generic hibernate data access object that uses hibernateTemplate. the get method in hibernateTemplate accepts a serializable parameter as an ID.

The composite key OrderLinePK is a serializable class used to represent the composite key in OrderLine. I would like to amend GenericDao to support keys other than Long ids.

13 years ago
I am using sample code from a spring persistence book that uses 2 interfaces: DomainObject and GenericDao

The problem is that the interfaces assume that the id of the domain object is always a long integer. In my case I have a domain object that has a composite key (OrderLinePK). I thought that I could fix this by implementing generics in DomainObject

The problem is how am I going to amend GenericDao to use DomainObject's generic parameter.

I know I could easily scrap the DomainObject and GenericDao interfaces, but would like to see how i can adapt the code for my requirements.
13 years ago
The problem was that I was setting the managed property with the domain object returned by the service layer. so the jsf framework was referencing a different object.

I had to use the facescontext to set the authenticatedUser managed bean.

So rather than exposing the persistance domain object, you keep an instance somewhere in the backing bean (e.g. for any possible updates to the record)?
14 years ago
JSF
The problem was that I (wrongly) assumed that setting the managed property would also set the managed bean injected into the property. In hindsight it makes sense that it wouldn't work.

it would have been nice to have a backing bean without jsf specific code (facesContext).. but i guess it's asking too much

RE controller, thanks for clearing it up.. is there a better naming convention?
14 years ago
JSF
Thanks, j2ee/Spring Security is on my to do list, I just started with a login page as it was the simplest scenario I could think of.

the authenticatedUser bean is in session scope, and the loginController is in the request scope..

it seems like it's working the other way round.. the controller instance is the same in login.jsp and welcome.jsp, whereas authenticatedUser is empty in welcome.jsf

Am I missing something?
14 years ago
JSF
I'm new to jsf and am trying to get started with a basic app using jsf, hibernate and spring.

basically, loginController has a method login() that sets the authenticatedUser property with the domain object returned by the service class.

in the "success" page, loginController is the same instance as in the login page, so i can access the user details using loginController.authenticatedUser, but authenticatedUser is empty..

so #{authenticatedUser.email} returns blank but #{loginController.authenticatedUser.email} returns the email for the user..

when injecting a managed bean into another, does jsf inject an object reference or a "copy" of the bean?

14 years ago
JSF