-
1. Re: Question on UserInterceptor
julien1 Jul 25, 2005 9:56 AM (in response to yxyang)it is necessary in order to keep the user settings up to date with respect to the database that may change.
but what could be improved here is to lookup the user according to its primary key and not user name, with that ID hibernate is capable to lookup users directly in the second level cache which avoid to going to the database on each request.
the first time the user is accessed, we retrieve the user and put its ID in the session. on other access we use the user ID to get the user from the session by using a session.get() instead of performing a query. -
2. Re: Question on UserInterceptor
yxyang Jul 25, 2005 10:02 AM (in response to yxyang)Hi
I checked out the jbp2.2 head. Where is the RequestController of ServerImpl set? I trace and read the source code and cannot find out where the value of RequestController is set.
thanks
yang -
3. Re: Question on UserInterceptor
julien1 Jul 25, 2005 10:06 AM (in response to yxyang)we use dependency injection and it is done by the microkernel using the file jboss-portal.sar/META-INF/jboss-service.xml
<mbean code="org.jboss.portal.server.impl.ServerImpl" name="portal:service=Server" xmbean-dd="org/jboss/portal/server/impl/ServerImpl.xml"> <depends optional-attribute-name="RequestController" proxy-type="attribute">portal:controller=Request</depends> <depends optional-attribute-name="ContainerRegistry" proxy-type="attribute">portal:service=ContainerRegistry</depends> </mbean>
means, declare the service Server and inject the services controller request and container registry in it when you deploy it. -
4. Re: Question on UserInterceptor
yxyang Jul 25, 2005 10:17 AM (in response to yxyang)I found that there are two definitions for portal:service=Server. One is in
./server/src/resources/portal-server-sar/META-INF/jboss-service.xml
the other is located in
./core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Why is this? Is the first one only for the testing of server module?
thanks
yang -
5. Re: Question on UserInterceptor
julien1 Jul 25, 2005 10:21 AM (in response to yxyang)if you search a little bit more you will find several in portlet module too.
the server one is for testing purpose.
the portlet one is for testing the portlet container.
the core one is the one we use in jboss portal core.
each config is supposed to assemble and wire components together. -
6. Re: Question on UserInterceptor
yxyang Jul 25, 2005 10:23 AM (in response to yxyang)Thanks Julien.
I hope i can catch it up and then contribute my Instant messaging server for the jboss portal.
regards
Yang -
7. Re: Question on UserInterceptor
joe_the_quick Nov 27, 2006 11:54 AM (in response to yxyang)Hi there,
We already replaced the JAAS-Loginmodule used by portal-server.war.
However, after the successful login I get the following exception:
org.jboss.portal.core.model.NoSuchUserException: No such user No such user TEST_USERNAME
org.jboss.portal.core.impl.user.UserModuleImpl.findUserByUserName(UserModuleImpl.java:123)
I found out that the UserModuleImpl looks up some user information in the JBP_USERS table (first name, last name, additional config info).
QUESTION:
What is the most clever way to replace the UserModuleImpl, as we have
this information already stored in the subject (request.getUserPrincipal()).
If I simply try to replace the "public User findUserById(String id) ..." method, I'm stuck because I don't have access to the principal (stored in the HttpServletRequest), where the required information would be stored.
Since we already did the authentication/authorization I'd like to reuse the data stored in the Principal, to avoid a second method-call for data I already have.
I also tried to comment out all User*-related Interceptors/Modules (includign dependencies in the MailModuleImpl) in jboss-service.xml, but then I get
java.lang.NullPointerException
org.jboss.portal.core.command.CoreComponentRequestContext$4.(CoreComponentRequestContext.java:161)
org.jboss.portal.core.command.CoreComponentRequestContext.(CoreComponentRequestContext.java:155)
and I'm totally stuck because I don't know what might cause this NullpointerException.
thanks a lot for any advice
Johannes -
8. Re: Question on UserInterceptor
joe_the_quick Nov 27, 2006 4:44 PM (in response to yxyang)hi there,
I've finally found out that an aspect would probably the most elegant solution for my problem:
I want to change the org.jboss.portal.core.aspects.server.UserInterceptor.
However, since its subclasses are referred in the LocaleInterceptor as well as in CoreComponentRequestContext it doesn't make sense to simply exchange it in the jboss-portal.sar/jboss-service.xml (which was the first solution I had in mind).
However, what is the most elegant way to create an aspect for the UserInterceptor-methods?
(where do I have to place what / change which configuration)?
I have read that I have to change the classes using the aopc-precompiler to intercept them using AOP. however, I don't want to change the Jboss-Classes (e.g. UserInterceptor) themselves.
any advice is very welcome.
Johannes -
9. Re: Question on UserInterceptor
julien1 Nov 30, 2006 4:39 AM (in response to yxyang)Since 2.4, I think that the UserInterceptor is not used anymore in what you said.
what do you want to intercept ?"joe_the_quick" wrote:
hi there,
I've finally found out that an aspect would probably the most elegant solution for my problem:
I want to change the org.jboss.portal.core.aspects.server.UserInterceptor.
However, since its subclasses are referred in the LocaleInterceptor as well as in CoreComponentRequestContext it doesn't make sense to simply exchange it in the jboss-portal.sar/jboss-service.xml (which was the first solution I had in mind).
However, what is the most elegant way to create an aspect for the UserInterceptor-methods?
(where do I have to place what / change which configuration)?
I have read that I have to change the classes using the aopc-precompiler to intercept them using AOP. however, I don't want to change the Jboss-Classes (e.g. UserInterceptor) themselves.
any advice is very welcome.
Johannes