Schlagwörter » Java EE

Get External/Local Ip regardless to Network Device in Linux

#!/bin/bash
# Date:     January 2015
# Author:  Hanine HAMZIOUI
# Usage:    Get the Machine IP. Commands are fallbacks
#           Just do: $~ bash ip.sh or bash.sh local/private/host
 
COM1=$(dig +short myip.opendns.com @resolver1.opendns.com 2>/dev/null)
COM2=$(hostname -i 2>/dev/null)
COM3=$(ip route show 2>/dev/null | grep src | grep -vE 'eth1.*|lo' |  awk -Fsrc '{print $2}' | sed -e 's/ //g')
COM4=$(curl -s monip.org 2>/dev/null | grep -o -E '(+\.){3}+')
COM5=$(host `hostname -f 2>/dev/null` | awk -Fddress '{print $2}' | sed 's/ //g')
COM6=$(for i in eth0 em1 bond0; do inf=`ip -4 addr show dev $i 2>/dev/null | grep inet -m1 | cut -d/ -f1 | awk '{ print $2}'`;if [[ "$inf" =~ ?* ]]; then echo "$inf";fi ;done)
if [[ "$1" =~ local ]] ;then
    COM1=$COM3
fi
if [[ "$1" =~ private ]] ;then
    COM1=$COM2
fi
if [[ "$1" =~ host ]] ;then
    COM1=$COM5
fi
IP=''
validip()
{
    local  ip=$1
    local  stat=1
 
    if [[ $ip =~ ^{1,3}\.{1,3}\.{1,3}\.{1,3}$ ]]; then
        OIFS=$IFS
        IFS='.'
        ip=($ip)
        IFS=$OIFS
        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
        stat=$? noch 104 Wörter
Java EE

Java EE Interceptors

History

I think it’s important to take a look at the evolution of Interceptors in Java EE because of the simple fact that it started as an EJB-specific item and later evolved into a separate spec which is now open for extension by other Java EE specifications. noch 814 Wörter

Interceptors