Package com.maxmind.geoip2

Examples of com.maxmind.geoip2.MeTest


    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PREHOME.getVelocityPage());

    final String remoteAddress = requestUtil.getRemoteAddr(request);
        model.addAttribute(ModelConstants.GEOLOC_REMOTE_ADDRESS, remoteAddress);
       
    final Country country = geolocService.geolocAndGetCountry(remoteAddress);
        model.addAttribute(ModelConstants.GEOLOC_COUNTRY, country);

        final City city = geolocService.geolocAndGetCity(remoteAddress);
        model.addAttribute(ModelConstants.GEOLOC_CITY, city);
View Full Code Here


     */
    public GeolocData getGeolocData(final String remoteAddress) throws Exception {
        GeolocData geolocData = null;
        if(!remoteAddress.equals("127.0.0.1")){
            geolocData = new GeolocData();
            final Country country = geolocAndGetCountry(remoteAddress);
            geolocData.setRemoteAddress(remoteAddress);
            if(country != null
                    && StringUtils.isNotEmpty(country.getIsoCode())){
                geolocData.setCountry(country);
                final City city = geolocAndGetCity(remoteAddress);
                geolocData.setCity(city);
            }
        }
View Full Code Here

   
    /**
     *
     */
    public String geolocAndGetCountryIsoCode(final String customerRemoteAddr) throws Exception {
        final Country country = geolocAndGetCountry(customerRemoteAddr);
        return country.getIsoCode();
    }
View Full Code Here

     */
    protected EngineEcoSession handleGeolocData(final HttpServletRequest request, EngineEcoSession engineEcoSession, final GeolocData geolocData) throws Exception {
        if (geolocData != null) {
            // FIND LATITUDE/LONGITUDE BY CITY/COUNTRY
            City city = geolocData.getCity();
            Country country = geolocData.getCountry();
            GeolocCity geolocCity = geolocService.getGeolocCityByCityAndCountry(city.getName(), country.getName());
            if (geolocCity != null) {
                geolocData.setLatitude(geolocCity.getLatitude());
                geolocData.setLongitude(geolocCity.getLongitude());
            } else {
                // LATITUDE/LONGITUDE DOESN'T EXIST - WE USE GOOGLE GEOLOC TO FOUND IT
                geolocCity = geolocService.geolocByCityAndCountry(city.getName(), country.getName());
                if (geolocCity != null) {
                    geolocData.setLatitude(geolocCity.getLatitude());
                    geolocData.setLongitude(geolocCity.getLongitude());
                }
            }
View Full Code Here

        // STEP 2 - TRY TO GEOLOC THE CUSTOMER AND SET THE RIGHT MARKET AREA
        final GeolocData geolocData = engineEcoSession.getGeolocData();
        MarketArea marketAreaGeoloc = null;
        if(geolocData != null){
            final Country country = geolocData.getCountry();
            if(country != null && StringUtils.isNotEmpty(country.getIsoCode())){
                List<MarketArea> marketAreas = marketService.getMarketAreaByGeolocCountryCode(country.getIsoCode());
                if(marketAreas != null && marketAreas.size() == 1){
                    marketAreaGeoloc = marketAreas.get(0);
                } else {
                    // WE HAVE MANY MARKET AREA FOR THE CURRENT COUNTRY CODE - WE SELECT THE DEFAULT MARKET PLACE ASSOCIATE
                    for (Iterator<MarketArea> iterator = marketAreas.iterator(); iterator.hasNext();) {
View Full Code Here

     * returns an empty {@link Subdivision} object.
     */
    @JsonIgnore
    public Subdivision getMostSpecificSubdivision() {
        if (this.subdivisions.isEmpty()) {
            return new Subdivision();
        }
        return this.subdivisions.get(this.subdivisions.size() - 1);
    }
View Full Code Here

TOP

Related Classes of com.maxmind.geoip2.MeTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.