flex 中通过 RO 调用一个java写的Bean的时候获得IP地址的方法 .也就是获得session 和 request的方法
- @RemotingInclude
- @Transactional
- private void registerUser(TbUser tbUser,String companyId) throws Exception{
- if (logger.isDebugEnabled()) {
- logger.debug("registerUser(TbUser, String) - start"); //$NON-NLS-1$
- }
- tbUser.setUserId(UUID.randomUUID().toString());
- tbUser.setOnlineStatus(PeriodicalUserOnlineState.ONLINE );
- if (tbUser.getPassword() == null){
- tbUser.setPassword("password");
- }
- tbUser.setRegisteTime(new Timestamp(new Date().getTime()));
- tbUser.setLastLogin(new Timestamp(new Date().getTime()));
- tbUser.setLoginCount(0);
- tbUser.setLastLogonIp(FlexContext.getHttpRequest().getRemoteAddr());
- tbUser.setRegisteIp(tbUser.getLastLogonIp());
- user.addUser(tbUser);
- }
其中
FlexContext.getHttpRequest() 可以获得HttpRequest
FlexContext.getHttpRequest().getSession(); 可以获得session