Thanks Norm. That's essentially the same reason I'd like to log the IP. The
only difference is, I'd like to do it within an interceptor (like the @LoggedIn
example given in the docs). I don't know if it's not working because you cant
do this in an Interceptor or because components.xml is wrong.
@Name("loggedInInterceptor")
| public class LoggedInInterceptor {
|
| @Logger
| private Log log;
|
| @In("#{remoteAddr}") private String ipAddress;
|
| @AroundInvoke
| public Object checkLoggedIn(InvocationContext invocation) throws
Exception {
| User user = (User)Contexts.getSessionContext().get("user");
|
| boolean isLoggedIn = user != null;
| try {
| if (isLoggedIn) {
| return invocation.proceed();
| } else {
| throw new SecurityException();
| }
| } catch (SecurityException se) {
| log.info("IP #0 is trying to access a secure location without
having logged in.", ipAddress);
| return "/login.seam";
| }
| }
| }
Given my ignorance of advanced XML, I assume I can use the default namespace,
which gives me "http://jboss.com/products/seam/components"
<?xml version="1.0" encoding="UTF-8"?>
| <components xmlns="http://jboss.com/products/seam/components"
| xmlns:core="http://jboss.com/products/seam/core"
| xmlns:security="http://jboss.com/products/seam/security"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-1.1.xsd
| http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-1.1.xsd
| http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-1.1.xsd">
| <core:init debug="true" jndi-pattern="nemoves-pws/#{ejbName}/local"/>
| <core:ejb installed="false"/>
| <factory name="remoteAddr"
value="#{facesContext.externalContext.request.remoteAddr}"/>
| </components>
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016509#4016509
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016509
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user