Retrieves the {@link java.util.TimeZone} for the given location.

@param context The {@link GeoApiContext} to make requests through.
@param location The location for which to retrieve a time zone.
@return Returns the time zone as a {@link PendingResult}.
557689
public static PendingResult<TimeZone> getTimeZone(GeoApiContext context, LatLng location) {
    return context.get(
        API_CONFIG,
        Response.class,
        "location",
        location.toString(),
        // Java has its own lookup for time -> DST, so we really only need to fetch the TZ id.
        // "timestamp" is, in effect, ignored.
        "timestamp",
        "0");
  }
1257457
public static String getClusterForLocation(URI location) {
        Matcher matcher = getLocatorMatcher(location);
        checkArgument(matcher.matches(), "Invalid location: %s", location);

        final String clusterPrefix;

        if (matcher.group("universe") != null) {
            clusterPrefix = matcher.group("universe");
        } else {
            clusterPrefix = "local";
        }

        String group = Objects.firstNonNull(matcher.group("group"), DEFAULT_GROUP);
        return format("%s_%s", clusterPrefix, group);
    }
1184680
def _get_timezone(self, location):
        

        url = self._timezone_query_base % (
            location.latitude,
            location.longitude,
            int(time()),
        )
        if self.api_key != "":
            url += "&key=%s" % self.api_key
        data = self._read_from_url(url)
        response = json.loads(data)
        if response["status"] == "OK":
            location.timezone = response["timeZoneId"]
        else:
            location.timezone = "UTC"
23285
public static GeocodingApiRequest reverseGeocode(GeoApiContext context, LatLng location) {
    GeocodingApiRequest request = new GeocodingApiRequest(context);
    request.latlng(location);
    return request;
  }
1170189
@Override
	public void findLocation(final String location) {
		showAlternativesView(false);
		GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND);
		GetLocationForStringRequest request = new GetLocationForStringRequest();
		request.setCrs(mapPresenter.getViewPort().getCrs());
		request.setLocation(location);
		request.setServicePattern(servicePattern);
		command.setCommandRequest(request);
		GeomajasServerExtension.getInstance().getCommandService().execute(command,
				new AbstractCommandCallback<GetLocationForStringResponse>() {
			public void execute(GetLocationForStringResponse response) {
				goToLocation(response, location);
			}
		});
	}
473604
private Locale getLocale(FacesContext context) {

        // PENDING(craigmcc) - JSTL localization context?
        Locale locale = this.locale;
        if (locale == null) {
            locale = context.getViewRoot().getLocale();
        }
        return (locale);

    }
251677
public static GeoLocationRequest getHttpServletRequestGeoLocation(final HttpServletRequest servletRequest) {
        if (servletRequest != null) {
            return HttpRequestUtils.getHttpServletRequestGeoLocation(servletRequest);
        }
        return null;
    }
1372071
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final Locale locale) {
		return cache.getDateTimeInstance(dateStyle, timeStyle, null, locale);
	}
606583
protected Locale getLocale(RequestContext context) {
    return this.locale != null ? this.locale : context.getExternalContext().getLocale();
  }
98625
public java.util.Date getDateWithDefaultZone() {
        LocalDate pickerDate = parentDatePicker.getDate();
        if (pickerDate == null) {
            return null;
        }
        Instant instant = pickerDate.atStartOfDay(ZoneId.systemDefault()).toInstant();
        // for backport: java.util.Date javaUtilDate = DateTimeUtils.toDate(instant);
        // for java.time: java.util.Date javaUtilDate = java.util.Date.from(instant);
        // This function was created to be compatible with both libraries.
        java.util.Date javaUtilDate = getJavaUtilDateFromInstant(instant);
        return javaUtilDate;
    }
444471
public Expression withSourceLocation(SourceLocation location) {
    checkNotNull(location);
    if (location.equals(this.location)) {
      return this;
    }
    return new Expression(resultType, features, location) {
      @Override
      protected void doGen(CodeBuilder adapter) {
        Expression.this.gen(adapter);
      }
    };
  }
415009
public Object saveState(FacesContext context) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (!initialStateMarked()) {
            Object values[] = new Object[6];
            values[0] = dateStyle;
            values[1] = locale;
            values[2] = pattern;
            values[3] = timeStyle;
            values[4] = timeZone;
            values[5] = type;
            return (values);
        }
        return null;

    }
939454
@Override
	@Pure
	public GeoLocation getGeoLocation() {
		final Rectangle2d b = getBoundingBox();
		if (b == null) {
			return new GeoLocationNowhere(getUUID());
		}
		return new GeoLocationPoint(b.getCenterX(), b.getCenterY());
	}
29778
public void setTimeZone(final TimeZone timezone) {
        if (dates == null) {
            throw new UnsupportedOperationException(
                    "TimeZone is not applicable to current value");
        }
        this.timeZone = timezone;
        if (timezone != null) {
            if (!Value.DATE_TIME.equals(getDates().getType())) {
                throw new UnsupportedOperationException(
                        "TimeZone is not applicable to current value");
            }
            dates.setTimeZone(timezone);
            getParameters().remove(getParameter(Parameter.TZID));
            final TzId tzId = new TzId(timezone.getID());
            getParameters().replace(tzId);
        } else {
            // use setUtc() to reset timezone..
            setUtc(false);
        }
    }
680320
@NonNull
  public static LocationEngine getBestLocationEngine(@NonNull Context context) {
    checkNotNull(context, "context == null");

    boolean hasGoogleLocationServices = isOnClasspath(GOOGLE_LOCATION_SERVICES);
    if (isOnClasspath(GOOGLE_API_AVAILABILITY)) {
      // Check Google Play services APK is available and up-to-date on this device
      hasGoogleLocationServices &= GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
        == ConnectionResult.SUCCESS;
    }
    return getLocationEngine(context, hasGoogleLocationServices);
  }
1193362
@Override
    public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
        URI uri = this.redirectStrategy.getLocationURI(request, response, context);

        String resultingPageUrl = uri.toString();

        DriverRequest driverRequest = ((OutgoingRequest) request).getOriginalRequest();

        // Remove context if present
        if (StringUtils.startsWith(resultingPageUrl, driverRequest.getVisibleBaseUrl())) {
            resultingPageUrl =
                    "/"
                            + StringUtils.stripStart(
                                    StringUtils.replace(resultingPageUrl, driverRequest.getVisibleBaseUrl(), ""), "/");
        }
        resultingPageUrl = ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false);

        return UriUtils.createURI(ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false));
    }
279516
public static TimeZone getBrowserTimeZone() {


        if (!StringUtils.isEmpty(fixedTimeZoneProperty)) {
            return TimeZone.getTimeZone(fixedTimeZoneProperty);
        }

        final WebBrowser webBrowser = com.vaadin.server.Page.getCurrent().getWebBrowser();
        final String[] timeZones = TimeZone.getAvailableIDs(webBrowser.getRawTimezoneOffset());
        TimeZone tz = TimeZone.getDefault();
        for (final String string : timeZones) {
            final TimeZone t = TimeZone.getTimeZone(string);
            if (t.getRawOffset() == webBrowser.getRawTimezoneOffset()) {
                tz = t;
            }
        }
        return tz;
    }