List of usage examples for java.util Locale US
Locale US
To view the source code for java.util Locale US.
Click Source Link
From source file:com.openedit.generators.FileGenerator.java
public SimpleDateFormatPerThread getLastModFormat() { if (fieldLastModFormat == null) { //Tue, 05 Jan 2010 14:20:51 GMT -- just english fieldLastModFormat = new SimpleDateFormatPerThread("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); //log.info( fieldLastModFormat.format(new Date()) ); }/*from ww w .j av a 2s .com*/ return fieldLastModFormat; }
From source file:at.uni_salzburg.cs.ckgroup.cscpp.viewer.json.WaypointsQuery.java
public String execute(IServletConfig config, String[] parameters) { if (mapperProxy.getEngineInfoList() == null) { return ""; }/*from ww w. j av a 2s . c om*/ // TODO do this in parallel Map<String, Object> pilotWaypoints = new LinkedHashMap<String, Object>(); int pilotNumber = 0; for (EngineInfo engineInfo : mapperProxy.getEngineInfoList()) { String waypoints = null; String pilot = String.format(Locale.US, "pilot%03d", ++pilotNumber); try { String pilotName = engineInfo.getPilotName(); String waypointsUrl = engineInfo.getWaypointsUrl(); if (waypointsUrl != null) { waypoints = HttpQueryUtils.simpleQuery(waypointsUrl); Map<String, Object> p = new LinkedHashMap<String, Object>(); p.put("name", pilotName); p.put("waypoints", parser.parse(waypoints)); pilotWaypoints.put(pilot, p); } } catch (Exception e) { LOG.info("Can not query pilot " + pilot + ": " + waypoints, e); } } return JSONValue.toJSONString(pilotWaypoints); }
From source file:org.siddhiesb.transport.http.conn.ProxyConfig.java
public HttpHost selectProxy(final HttpHost target) { if (this.proxy != null) { if (!this.proxyBypass.contains(target.getHostName().toLowerCase(Locale.US))) { return this.proxy; }/*from w ww . jav a 2s . c om*/ } return null; }
From source file:com.cloudbees.demo.beesshop.cart.ShoppingCart.java
/** * Price in dollars/* w w w .j a va 2 s.c o m*/ */ public String getPrettyPrice() { BigDecimal priceInDollars = new BigDecimal(getPriceInCents()).movePointLeft(2); return NumberFormat.getCurrencyInstance(Locale.US).format(priceInDollars); }
From source file:org.cloudfoundry.identity.uaa.web.ForwardAwareInternalResourceViewResolverTests.java
@Test public void testResolveRedirect() throws Exception { resolver.setApplicationContext(new GenericApplicationContext()); View view = resolver.resolveViewName("redirect:foo", Locale.US); assertNotNull(view);/*w w w . j ava2s . co m*/ }
From source file:org.broadleafcommerce.vendor.CyberSourceTaxServiceTest.java
@Test(groups = { "testSuccessfulCyberSourceTax" }) @Rollback(false)//from w w w. j a va2s . c om public void testSuccessfulCyberSourceTax() throws Exception { if (serviceManager.getMerchantId().equals("?")) { return; } System.out.println("***Initiating testSuccessfulCyberSourceTax***"); CyberSourceTaxRequest taxRequest = new CyberSourceTaxRequest(); taxRequest.setCurrency(Currency.getInstance(Locale.US).getCurrencyCode()); taxRequest.setNexus("CA"); taxRequest.setOrderAcceptancePostalCode("94043"); //taxRequest.setOrderOriginPostalCode("94043"); CyberSourceBillingRequest billingRequest = new CyberSourceBillingRequest(); billingRequest.setCity("Mountain View"); billingRequest.setPostalCode("94043"); billingRequest.setState("CA"); billingRequest.setStreet1("1295 Charleston Road"); billingRequest.setCountry("US"); taxRequest.setBillingRequest(billingRequest); CyberSourceTaxItemRequest itemRequest1 = new CyberSourceTaxItemRequest(); itemRequest1.setDescription("First Item"); itemRequest1.setQuantity(2L); itemRequest1.setShortDescription("firstItem"); itemRequest1.setUnitPrice(new Money(12.34)); taxRequest.getItemRequests().add(itemRequest1); CyberSourceTaxService service = (CyberSourceTaxService) serviceManager.getValidService(taxRequest); ((ServiceResponseCacheable) service).clearCache(); CyberSourceTaxResponse response = (CyberSourceTaxResponse) service.process(taxRequest); assert (response.getReasonCode().intValue() == 100); assert (!response.getRequestToken().equals("from-cache")); Money totalTaxAmount = response.getItemResponses()[0].getTotalTaxAmount(); assert (totalTaxAmount != null && totalTaxAmount.greaterThan(new Money(0D))); //confirm that we used the cache CyberSourceTaxResponse response2 = (CyberSourceTaxResponse) service.process(taxRequest); assert (response2.getReasonCode().intValue() == 100); assert (response2.getRequestToken().equals("from-cache")); Money totalTaxAmount2 = response2.getItemResponses()[0].getTotalTaxAmount(); assert (totalTaxAmount2 != null && totalTaxAmount2.greaterThan(new Money(0D))); assert (totalTaxAmount.equals(totalTaxAmount2)); }
From source file:com.graphhopper.http.I18NServlet.java
@Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try {/*from ww w . j ava 2s . c om*/ String locale = ""; String path = req.getPathInfo(); if (!Helper.isEmpty(path) && path.startsWith("/")) locale = path.substring(1); if (Helper.isEmpty(locale)) { // fall back to language specified in header e.g. via browser settings String acceptLang = req.getHeader("Accept-Language"); if (!Helper.isEmpty(acceptLang)) locale = acceptLang.split(",")[0]; } Translation tr = map.get(locale); JSONObject json = new JSONObject(); if (tr != null && !Locale.US.equals(tr.getLocale())) json.put("default", tr.asMap()); json.put("locale", locale.toString()); json.put("en", map.get("en").asMap()); writeJson(req, res, json); } catch (Exception ex) { logger.error("Error while executing request: " + req.getQueryString(), ex); writeError(res, SC_INTERNAL_SERVER_ERROR, "Problem occured:" + ex.getMessage()); } }
From source file:com.xerox.amazonws.ec2.UploadPolicy.java
public String getPolicyString() { StringBuilder json = new StringBuilder("{\n"); json.append("\"expiration\": \""); final String DateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"; SimpleDateFormat format = new SimpleDateFormat(DateFormat, Locale.US); format.setTimeZone(TimeZone.getTimeZone("GMT")); json.append(format.format(new Date(System.currentTimeMillis() + (minutesToExpiration * 60000L)))); json.append("\",\n"); json.append("\"conditions\": [\n"); json.append("{\"acl\": \""); json.append(acl);//from w w w. ja va2 s.co m json.append("\"},\n"); json.append("{\"bucket\": \""); json.append(bucket); json.append("\"},\n"); json.append("[\"starts-with\", \"$key\", \""); json.append(prefix); json.append("\"],\n"); json.append("]\n}"); logger.debug("JSON policy string = " + json.toString()); return new String(Base64.encodeBase64(json.toString().getBytes())); }
From source file:de.perdian.commons.lang.conversion.impl.converters.TestNumberToStringConverter.java
@Test public void testConvertWithPatternAndLocaleEN() { NumberToStringConverter converter = new NumberToStringConverter("0.0", new SimpleLocaleContext(Locale.US)); Assert.assertEquals("42.0", converter.convert(Integer.valueOf(42))); }
From source file:at.uni_salzburg.cs.ckgroup.cscpp.viewer.json.PositionQuery.java
public String execute(IServletConfig config, String[] parameters) throws IOException { if (mapperProxy.getEngineInfoList() == null) { return ""; }/*from w w w . j a v a 2s . c o m*/ // TODO do this in parallel Map<String, Object> pilotPositions = new LinkedHashMap<String, Object>(); int pilotNumber = 0; for (EngineInfo engineInfo : mapperProxy.getEngineInfoList()) { String position = null; String pilot = String.format(Locale.US, "pilot%03d", ++pilotNumber); try { String pilotName = engineInfo.getPilotName(); String pilotPosURL = engineInfo.getPositionUrl(); if (pilotPosURL != null) { position = HttpQueryUtils.simpleQuery(pilotPosURL); Map<String, Object> p = new LinkedHashMap<String, Object>(); p.put("name", pilotName); p.put("position", parser.parse(position)); pilotPositions.put(pilot, p); } } catch (Exception e) { LOG.info("Can not query pilot " + pilot + ": " + position, e); } } return JSONValue.toJSONString(pilotPositions); }