List of usage examples for org.springframework.web.servlet.support RequestContextUtils getLocale
public static Locale getLocale(HttpServletRequest request)
From source file:org.kuali.mobility.tags.angular.PageTag.java
public void doTag() throws JspException { String appcacheEnabled;/*from w w w . ja va2 s . c o m*/ PageContext pageContext = (PageContext) getJspContext(); HttpServletRequest hsr = (HttpServletRequest) pageContext.getRequest(); ServletContext servletContext = pageContext.getServletContext(); WebApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(servletContext); setKmeProperties((Properties) ac.getBean("kmeProperties")); CoreService coreService = (CoreService) ac.getBean("coreService"); Properties kmeProperties = (Properties) ac.getBean("kmeProperties"); Locale locale = RequestContextUtils.getLocale((HttpServletRequest) pageContext.getRequest()); MessageSource ms = (MessageSource) ac.getBean("messageSource"); User user = (User) pageContext.getSession().getAttribute(AuthenticationConstants.KME_USER_KEY); String contextPath = servletContext.getContextPath(); appcacheEnabled = kmeProperties.getProperty("appcache.enabled", "true"); JspWriter out = pageContext.getOut(); StringBuilder builder = new StringBuilder(); try { builder.append("<!DOCTYPE html>"); builder.append("<html"); if (!appcacheEnabled.equals("false")) { LOG.debug("Appcache Enabled"); builder.append(" manifest=\"CONTEXT_PATH/kme.appcache\""); } if (null != getNgAppName()) { builder.append(" ng-app=\""); builder.append(getNgAppName()); builder.append("\""); } builder.append(">"); builder.append("<head>"); builder.append("<title>"); builder.append(getTitle()); builder.append("</title>"); builder.append("<link href=\""); builder.append(kmeProperties.getProperty("favico.url", "http://www.kuali.org/favicon.ico")); builder.append("\" rel=\"icon\" />"); builder.append("<link href=\""); builder.append(kmeProperties.getProperty("favico.url", "http://www.kuali.org/favicon.ico")); builder.append("\" rel=\"shortcut icon\" />"); builder.append("<link rel=\"apple-touch-icon\" href=\"CONTEXT_PATH/touch-icon-iphone.png\"/>"); builder.append( "<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"CONTEXT_PATH/touch-icon-ipad.png\"/>"); builder.append( "<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"CONTEXT_PATH/touch-icon-iphone-retina.png\"/>"); builder.append( "<link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"CONTEXT_PATH/touch-icon-ipad-retina.png\"/>"); builder.append( "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js\"></script>\n"); builder.append( "<script src=\"//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js\"></script>\n"); builder.append( "<script src=\"//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular-route.js\"></script>\n"); builder.append( "<script src=\"//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular-sanitize.js\"></script>\n"); builder.append("<script src=\"CONTEXT_PATH/js/jquery.cookie.js\"></script>"); builder.append("<script src=\"CONTEXT_PATH/js/ui3/ui-bootstrap-tpls-0.10.0.min.js\"></script>\n"); builder.append("<script src=\"CONTEXT_PATH/js/bootstrap.js\"></script>\n"); builder.append("<script src=\"CONTEXT_PATH/js/bootbox.js\"></script>\n"); builder.append("<!-- Latest compiled and minified CSS -->\n"); builder.append( "<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css\"/>\n"); builder.append("<link href=\"CONTEXT_PATH/css/ui3/kme.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"); builder.append( "<link href=\"CONTEXT_PATH/css/ui3/institution.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"); // Attach all CSS files for (String cssFile : getCssFilenames()) { builder.append("<link href=\"CONTEXT_PATH/css/ui3/"); builder.append(cssFile); builder.append(".css\" rel=\"stylesheet\" type=\"text/css\"/>\n"); } builder.append("<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/BrowserDetect.js\"></script>\n"); builder.append("<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/ServerDetails.js\"></script>\n"); if (isPlatform(Device.TYPE_IOS)) { if (isPhoneGap("1.4.1")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/phonegap-1.4.1.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/ChildBrowser.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/barcodescanner.js\"></script>\n"); // builder.append("<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/Connection.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/PushHandler.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/Badge.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/applicationPreferences.js\"></script>\n"); } else if (isPhoneGap("1.7.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/cordova-1.7.0.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/ChildBrowser.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/barcodescanner.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/ActionSheet.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/Badge.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/LocalNotifications.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/Notifications.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/PrintPlugin.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/1.7.0/applicationPreferences.js\"></script>\n"); } else if (isPhoneGap("2.2.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/cordova-2.2.0.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/ActionSheet.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/applicationPreferences.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/AudioStreamer.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/Badge.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/barcodescanner.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.2.0/ChildBrowser.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/PushHandler.js\"></script>\n"); } else if (isPhoneGap("2.3.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.3.0/cordova-2.3.0.js\"></script>\n"); } else if (isPhoneGap("2.4.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.4.0/cordova-2.4.0.js\"></script>\n"); } else if (isPhoneGap("2.5.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.5.0/cordova-2.5.0.js\"></script>\n"); } else if (isPhoneGap("2.6.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.6.0/cordova-2.6.0.js\"></script>\n"); } else if (isPhoneGap("2.7.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.7.0/cordova-2.7.0.js\"></script>\n"); } else if (isPhoneGap("2.8.1")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/iOS/2.8.1/cordova.js\"></script>\n"); } } else if (isPlatform(Device.TYPE_ANDROID)) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/PushConfig.js\"></script>\n"); if (isPhoneGap("2.2.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/cordova-2.2.0.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/childbrowser.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/barcodescanner.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/statusbarnotification.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/datePickerPlugin.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/applicationPreferences.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/AudioStreamer.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/GCMPlugin.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/2.2.0/CORDOVA_GCM_script.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/PushHandler.js\"></script>\n"); } else { builder.append("<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/phonegap-" + getPhonegap() + ".js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/childbrowser.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/barcodescanner.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/statusbarnotification.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/C2DMPlugin.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/PG_C2DM_script.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/android/PushHandler.js\"></script>\n"); } } else if (isPlatform(Device.TYPE_BLACKBERRY)) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/PushConfig.js\"></script>\n"); if (isPhoneGap("2.2.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/blackberry/2.2.0/cordova-2.2.0.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/blackberry/2.2.0/kme-application.js\"></script>\n"); } } else if (isPlatform(Device.TYPE_WINDOWS)) { if (isPhoneGap("2.2.0")) { builder.append( "<script type=\"text/javascript\" src=\"CONTEXT_PATH/js/windowsMobile/2.2.0/cordova-2.2.0.js\"></script>\n"); } } /* Google Analytics */ String profileId = coreService.findGoogleAnalyticsProfileId().trim(); if (!disableGoogleAnalytics && profileId.length() > 0) { String profileDomain = coreService.getGoogleAnalyticsProfileDomain().trim(); if (coreService.isGoogleUniversalAnalytics() && !profileDomain.isEmpty()) { out.println("<script type=\"text/javascript\">"); out.println("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){"); out.println("(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),"); out.println("m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)"); out.println("})(window,document,'script','//www.google-analytics.com/analytics.js','ga');"); out.println("ga('create', '" + profileId + "', '" + profileDomain + "'); "); out.println("ga('send', 'pageview');"); out.println("</script>"); } else { out.println("<script type=\"text/javascript\">"); out.println("var _gaq = _gaq || [];"); out.println("_gaq.push(['_setAccount', '" + profileId + "']);"); out.println("_gaq.push(['_trackPageview']);"); out.println("(function() {"); out.println( "var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;"); out.println( "ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';"); out.println( "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);"); out.println("})();"); out.println("</script>"); } } if (isUsesGoogleMaps()) { builder.append( "<script type=\"text/javascript\" src=\"https://maps.google.com/maps/api/js?libraries=geometry&v=3.exp&sensor=true"); if (null != getMapLocale() && !getMapLocale().isEmpty()) { builder.append("&language="); builder.append(getMapLocale()); } if (null != getMapCallbackFunction() && !getMapCallbackFunction().isEmpty()) { builder.append("&callback="); builder.append(getMapCallbackFunction()); } builder.append("\"></script>\n"); // builder.append("<script type=\"text/javascript\" src=\"//maps.google.com/maps/api/js?libraries=geometry&v=3&sensor=true\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"//google-maps-utility-library-v3.googlecode.com/svn/trunk/styledmarker/src/StyledMarker.js\"></script>\n"); builder.append( "<script type=\"text/javascript\" src=\"//google-maps-utility-library-v3.googlecode.com/svn/trunk/markerwithlabel/src/markerwithlabel.js\"></script>\n"); } if ("mapquest".equalsIgnoreCase(getKmeProperties().getProperty("maps.api"))) { builder.append( "<script type=\"text/javascript\" src=\"http://www.mapquestapi.com/sdk/js/v7.0.s/mqa.toolkit.js?key=Fmjtd%7Cluubnu6r2q%2C8n%3Do5-9uyllr\"></script>\n"); } for (String javascript : getJsFilenames()) { builder.append("<script type=\"text/javascript\" src=\"CONTEXT_PATH/"); builder.append(getToolName()); builder.append("/js/"); builder.append(javascript); builder.append(".js\"></script>\n"); } builder.append( "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\">\n"); builder.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"); builder.append("</head>"); builder.append("<body"); if (null != getToolName()) { builder.append(" id=\""); builder.append(getToolName()); builder.append("\""); } if (null != getNgControllerName()) { builder.append(" ng-controller=\""); builder.append(getNgControllerName()); builder.append("\""); } if (null != getNgInitFunction()) { builder.append(" data-ng-init=\""); builder.append(getNgInitFunction()); builder.append("()\""); } builder.append(">\n"); builder.append( " <nav class=\"kme-top-nav navbar navbar-default navbar-fixed-top\" role=\"navigation\">\n"); //back if (!isHideBackButton()) { boolean showButton = true; if (("true".equalsIgnoreCase(getKmeProperties().getProperty("shim.backbutton.ios")) && isPlatform(Device.TYPE_IOS)) || ("true".equalsIgnoreCase(getKmeProperties().getProperty("shim.backbutton.android")) && isPlatform(Device.TYPE_ANDROID))) { showButton = false; } if (showButton) { if ("left".equalsIgnoreCase(getKmeProperties().getProperty("nav.back.position"))) { builder.append(" <div class=\"nav navbar-nav pull-left kme-nav-back\">\n"); } else if ("right".equalsIgnoreCase(getKmeProperties().getProperty("nav.back.position"))) { builder.append(" <div class=\"nav navbar-nav pull-right kme-nav-back\">\n"); } else { builder.append(" <div class=\"nav navbar-nav pull-left kme-nav-back\">\n"); } builder.append(" <a ng-click=\""); if (null == getBackFunction() || getBackFunction().isEmpty()) { builder.append("kmeNavLeft"); } else { builder.append(getBackFunction()); } builder.append( "()\" class=\"ur-small-element\"><span class=\"glyphicon glyphicon-chevron-left white\"></span></a>\n"); builder.append(" </div>\n"); } } //end back //menu if (!isHideMenuButton()) { boolean showButton = true; if (("true".equalsIgnoreCase(getKmeProperties().getProperty("shim.homebutton.ios")) && isPlatform(Device.TYPE_IOS)) || ("true".equalsIgnoreCase(getKmeProperties().getProperty("shim.homebutton.android")) && isPlatform(Device.TYPE_ANDROID))) { showButton = false; } if (showButton) { if ("left".equalsIgnoreCase(getKmeProperties().getProperty("nav.menu.position"))) { builder.append(" <div class=\"nav navbar-nav pull-left dropdown kme-nav-menu\">\n"); } else if ("right".equalsIgnoreCase(getKmeProperties().getProperty("nav.menu.position"))) { builder.append(" <div class=\"nav navbar-nav pull-right dropdown kme-nav-menu\">\n"); } else { builder.append(" <div class=\"nav navbar-nav pull-right dropdown kme-nav-menu\">\n"); } builder.append( " <a class=\"dropdown-toggle ur-small-element\" href=\"#\" ><span class=\"glyphicon glyphicon-align-justify white\"></span></a>\n"); builder.append(" <ul class=\"dropdown-menu\">\n"); //home builder.append(" <li><a href=\"CONTEXT_PATH/home\">Home</a></li>\n"); //end home builder.append( " <li ng-repeat=\"menu in menuItems.menus\" ng-class=\"{divider:menu.divider}\"><a href=\"CONTEXT_PATH{{menu.url}}\" _target=\"self\">{{menu.label}}</a></li>\n"); if ("true".equalsIgnoreCase(kmeProperties.getProperty("home.preferences.enabled", "true"))) { builder.append(" <li class=\"divider\"></li>\n"); builder.append( " <li><a href=\"CONTEXT_PATH/preferences\">Preferences</a></li>\n"); } builder.append(" </ul>\n"); builder.append(" </div>\n"); } } //end menu builder.append(" <div class=\"navbar-header navbar-text \">"); builder.append(getTitle()); builder.append("</div>\n"); builder.append(" </nav>\n"); String output = builder.toString(); output = output.replaceAll("CONTEXT_PATH", contextPath); out.println(output); getJspBody().invoke(out); out.println("</body>"); out.println("</html>"); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }
From source file:org.kuali.mobility.tags.PageTag.java
public void doTag() throws JspException { PageContext pageContext = (PageContext) getJspContext(); HttpServletRequest hsr = (HttpServletRequest) pageContext.getRequest(); Cookie cks[] = hsr.getCookies();/* ww w .ja v a 2 s. c om*/ if (cks != null) { for (Cookie c : cks) { if (c.getName().equals("jqmHeader")) { jqmHeader = c.getValue(); //LOG.info("---jqmHeader: " + jqmHeader); } } } ServletContext servletContext = pageContext.getServletContext(); WebApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(servletContext); setAuthMapper((AuthenticationMapper) ac.getBean("authenticationMapper")); CoreService coreService = (CoreService) ac.getBean("coreService"); Properties kmeProperties = (Properties) ac.getBean("kmeProperties"); Locale locale = RequestContextUtils.getLocale((HttpServletRequest) pageContext.getRequest()); MessageSource ms = (MessageSource) ac.getBean("messageSource"); String msgCatString = null; User user = (User) pageContext.getSession().getAttribute(AuthenticationConstants.KME_USER_KEY); String contextPath = servletContext.getContextPath(); JspWriter out = pageContext.getOut(); try { out.println("<!DOCTYPE html>"); if (getAppcacheEnabled().isEmpty()) { setAppcacheEnabled(kmeProperties.getProperty("appcache.enabled", "true")); } LOG.info("param.appcacheEnabled: " + getAppcacheEnabled()); if (!appcacheEnabled.equals("false")) { LOG.debug("Appcache Enabled"); out.println("<html manifest=\"" + contextPath + "/" + (StringUtils.isEmpty(getAppcacheFilename()) ? "kme.appcache" : getAppcacheFilename().trim()) + "\">"); } else { LOG.debug("Appcache Disabled"); out.println("<html>"); } out.println("<head>"); out.println("<title>" + getTitle() + "</title>"); out.println( "<link href=\"" + kmeProperties.getProperty("favico.url", "http://www.kuali.org/favicon.ico") + "\" rel=\"icon\" />"); out.println( "<link href=\"" + kmeProperties.getProperty("favico.url", "http://www.kuali.org/favicon.ico") + "\" rel=\"shortcut icon\" />"); out.println("<link rel=\"apple-touch-icon\" href=\"" + contextPath + "/touch-icon-iphone.png\"/>"); out.println("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"" + contextPath + "/touch-icon-ipad.png\"/>"); out.println("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"" + contextPath + "/touch-icon-iphone-retina.png\"/>"); out.println("<link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"" + contextPath + "/touch-icon-ipad-retina.png\"/>"); out.println("<link href=\"" + contextPath + "/css/jquery.mobile.css\" rel=\"stylesheet\" type=\"text/css\" />"); out.println("<link href=\"" + contextPath + "/css/jquery-mobile-fluid960.css\" rel=\"stylesheet\" type=\"text/css\" />"); out.println("<link href=\"" + contextPath + "/css/kme.css\" rel=\"stylesheet\" type=\"text/css\" />"); out.println("<link href=\"" + contextPath + "/css/institution.css\" rel=\"stylesheet\" type=\"text/css\" />"); addTheme(); // Attach all CSS files for (String cssFile : getCssFilenames()) { out.println("<link href=\"" + contextPath + "/css/" + cssFile + ".css\" rel=\"stylesheet\" type=\"text/css\" />"); } out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.cookie.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/ServerDetails.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/custom.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.mobile.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.tmpl.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.validate.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.validate.ready.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.templates.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.transit.min.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/BrowserDetect.js\"></script>"); if (this.isNative()) { out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/PushConfig.js\"></script>"); } // out.println("<script src=\"http://jsconsole.com/remote.js?2EA94DB3-FD2F-4FF8-B41E-AB2B9A064544\"></script>"); if (isPlatform(Device.TYPE_IOS)) { if (isPhoneGap("1.4.1")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/phonegap-1.4.1.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/ChildBrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/barcodescanner.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/Connection.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/PushHandler.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/Badge.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/applicationPreferences.js\"></script>"); } else if (isPhoneGap("1.7.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/cordova-1.7.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/ChildBrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/ActionSheet.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/Badge.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/LocalNotifications.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/Notifications.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/PrintPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/applicationPreferences.js\"></script>"); } else if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/cordova-2.2.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/ActionSheet.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/applicationPreferences.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/AudioStreamer.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/Badge.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/ChildBrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/PushHandler.js\"></script>"); } else if (isPhoneGap("2.3.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.3.0/cordova-2.3.0.js\"></script>"); } else if (isPhoneGap("2.4.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.4.0/cordova-2.4.0.js\"></script>"); } else if (isPhoneGap("2.5.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.5.0/cordova-2.5.0.js\"></script>"); } else if (isPhoneGap("2.6.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.6.0/cordova-2.6.0.js\"></script>"); } else if (isPhoneGap("2.7.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.7.0/cordova-2.7.0.js\"></script>"); } else if (isPhoneGap("2.8.1")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.8.1/cordova.js\"></script>"); } } else if (isPlatform(Device.TYPE_ANDROID)) { if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/cordova-2.2.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/childbrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/statusbarnotification.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/datePickerPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/applicationPreferences.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/AudioStreamer.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/GCMPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/CORDOVA_GCM_script.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PushHandler.js\"></script>"); } else { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/phonegap-" + getPhonegap() + ".js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/childbrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/statusbarnotification.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/C2DMPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PG_C2DM_script.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PushHandler.js\"></script>"); } } else if (isPlatform(Device.TYPE_BLACKBERRY)) { if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/blackberry/2.2.0/cordova-2.2.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/blackberry/2.2.0/kme-application.js\"></script>"); } } else if (isPlatform(Device.TYPE_WINDOWS)) { if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/windowsMobile/2.2.0/cordova-2.2.0.js\"></script>"); } } /* Google Analytics */ String profileId = coreService.findGoogleAnalyticsProfileId().trim(); if (!disableGoogleAnalytics && profileId.length() > 0) { String profileDomain = coreService.getGoogleAnalyticsProfileDomain().trim(); if (coreService.isGoogleUniversalAnalytics() && !profileDomain.isEmpty()) { out.println("<script type=\"text/javascript\">"); out.println("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){"); out.println("(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),"); out.println("m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)"); out.println("})(window,document,'script','//www.google-analytics.com/analytics.js','ga');"); out.println("ga('create', '" + profileId + "', '" + profileDomain + "'); "); out.println("ga('send', 'pageview');"); out.println("</script>"); } else { out.println("<script type=\"text/javascript\">"); out.println("var _gaq = _gaq || [];"); out.println("_gaq.push(['_setAccount', '" + profileId + "']);"); out.println("_gaq.push(['_trackPageview']);"); out.println("(function() {"); out.println( "var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;"); out.println( "ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';"); out.println( "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);"); out.println("})();"); out.println("</script>"); } } if (isUsesGoogleMaps()) { if (getMapLocale() != null) { out.println( "<script type=\"text/javascript\" src=\"https://maps.google.com/maps/api/js?sensor=true&language=" + getMapLocale() + "\"></script>"); } else { out.println( "<script type=\"text/javascript\" src=\"https://maps.google.com/maps/api/js?sensor=true\"></script>"); } } // Now add all the javascripts for (String javascript : getJsFilenames()) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/" + javascript + ".js\"></script>"); } out.println( "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\">"); // out.println("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />"); // out.println("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />"); out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"); out.println("</head>"); if (getOnBodyLoad() != null) { out.println("<body onload='" + getOnBodyLoad() + "'>"); } else { out.println("<body>"); } out.println("<div data-role=\"page\" id=\"" + getId() + "\">"); LOG.info("----" + jqmHeader); if (getJqmHeader() != null && getJqmHeader().equals("hide")) { LOG.info("---- Hide Header"); out.println("<div data-role=\"header\" style=\"display:none\">"); } else if (getJqmHeader() != null && getJqmHeader().equals("fixed")) { LOG.info("---- Fixed Header"); out.println("<div data-role=\"header\" data-position=\"fixed\">"); } else { LOG.info("---- Show Header"); out.println("<div data-role=\"header\">"); } if (isLoginButton() || getAuthMapper().getLoginURL() != null) { if (user == null || user.isPublicUser()) { msgCatString = ms.getMessage("shared.login", null, "Login", locale); out.println("<a href=\"" + (getLoginButtonURL() != null ? getLoginButtonURL() : (getAuthMapper().getLoginURL() != null ? getAuthMapper().getLoginURL() : contextPath + "/login")) + "\" data-role=\"button\" data-icon=\"lock\">" + msgCatString + "</a>"); } else { msgCatString = ms.getMessage("shared.logout", null, "Logout", locale); out.println("<a href=\"" + (getLogoutButtonURL() != null ? getLogoutButtonURL() : (getAuthMapper().getLogoutURL() != null ? getAuthMapper().getLogoutURL() : contextPath + "/logout")) + "\" data-role=\"button\" data-icon=\"unlock\">" + msgCatString + "</a>"); } } if (isBackButton()) { msgCatString = ms.getMessage("shared.back", null, "Back", locale); // out.println("<a href=\"" + (getBackButtonURL() != null ? getBackButtonURL() : "javascript: history.go(-1)") + "\" class=\"ui-btn-left\" data-icon=\"back\" data-iconpos=\"notext\">" + msgCatString + "</a>"); boolean showButton = true; if (null == this.getPhonegap() || "".equalsIgnoreCase(getPhonegap())) { // showButton = true; } else { if (null != kmeProperties) { StringBuilder builder = new StringBuilder("shim.backbutton."); builder.append(this.getPlatform().toLowerCase()); if (kmeProperties.containsKey(builder.toString()) && "false".equalsIgnoreCase(kmeProperties.getProperty(builder.toString()))) { showButton = false; } } } if (showButton) { out.println("<a href=\"" + ((getBackButtonURL() != null && StringUtils.isNotBlank(getBackButtonURL())) ? getBackButtonURL() : "javascript: history.go(-1)") + "\" class=\"ui-btn-left\" data-icon=\"back\" data-iconpos=\"notext\">" + msgCatString + "</a>"); } } out.println("<h1>" + getTitle() + "</h1>"); if (isPreferencesButton()) { if (null != kmeProperties && "true".equalsIgnoreCase(kmeProperties.getProperty("home.preferences.enabled", "true"))) { msgCatString = ms.getMessage("shared.preferences", null, "Preferences", locale); out.println("<a href=\"" + (getPreferencesButtonURL() != null ? getPreferencesButtonURL() : contextPath + "/preferences") + "\" class=\"ui-btn-right\" data-icon=\"gear\" data-iconpos=\"notext\">" + msgCatString + "</a>"); } } if (isHomeButton()) { msgCatString = ms.getMessage("shared.home", null, "Home", locale); // out.println("<a href=\"" + contextPath + "/home\" class=\"ui-btn-right\" data-icon=\"home\" data-iconpos=\"notext\">" + msgCatString + "</a>"); boolean homeButton = true; if (null == this.getPhonegap() || "".equalsIgnoreCase(getPhonegap())) { // showButton = true; } else { if (null != kmeProperties) { StringBuilder builder = new StringBuilder("shim.homebutton."); builder.append(this.getPlatform().toLowerCase()); if (kmeProperties.containsKey(builder.toString()) && "false".equalsIgnoreCase(kmeProperties.getProperty(builder.toString()))) { homeButton = false; } } } if (homeButton) { out.println("<a href=\"" + contextPath + "/home\" class=\"ui-btn-right\" data-icon=\"home\" data-iconpos=\"notext\">" + msgCatString + "</a>"); } } out.println("</div>"); getJspBody().invoke(out); out.println("</div>"); out.println("</body>"); out.println("</html>"); } catch (Exception e) { LOG.error(e.getMessage(), e); } }
From source file:org.madsonic.ajax.PlayQueueService.java
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean sendM3U, int offset) throws Exception { String url = request.getRequestURL().toString(); if (sendM3U && player.isJukebox()) { jukeboxService.updateJukebox(player, offset); }/*from w w w .j a v a 2 s . co m*/ boolean isCurrentPlayer = player.getIpAddress() != null && player.getIpAddress().equals(request.getRemoteAddr()); boolean m3uSupported = player.isExternal() || player.isExternalWithPlaylist(); sendM3U = player.isAutoControlEnabled() && m3uSupported && isCurrentPlayer && sendM3U; Locale locale = RequestContextUtils.getLocale(request); List<PlayQueueInfo.Entry> entries = new ArrayList<PlayQueueInfo.Entry>(); PlayQueue playQueue = player.getPlayQueue(); String localIp = settingsService.getLocalIpAddress(); int localPort = settingsService.getPort(); for (MediaFile file : playQueue.getFiles()) { String albumUrl = url.replaceFirst("/dwr/.*", "/main.view?id=" + file.getId()); String streamUrl = url.replaceFirst("/dwr/.*", "/stream?player=" + player.getId() + "&id=" + file.getId()); String coverArtUrl = url.replaceFirst("/dwr/.*", "/coverArt.view?id=" + file.getId()); // String host = new URL(streamUrl).getHost(); // String remoteStreamUrl = streamUrl.replaceFirst(host, ip); // String remoteCoverArtUrl = coverArtUrl.replaceFirst(host, ip); // Rewrite URLs in case we're behind a proxy. if (settingsService.isRewriteUrlEnabled()) { String referer = request.getHeader("referer"); albumUrl = StringUtil.rewriteUrl(albumUrl, referer); streamUrl = StringUtil.rewriteUrl(streamUrl, referer); } String shareUrl = settingsService.getMadsonicUrl(); boolean urlRedirectionEnabled = settingsService.isUrlRedirectionEnabled(); String urlRedirectFrom = settingsService.getUrlRedirectFrom(); String urlRedirectContextPath = settingsService.getUrlRedirectContextPath(); String remoteStreamUrl = StringUtil.rewriteRemoteUrl(streamUrl, shareUrl, urlRedirectionEnabled, urlRedirectFrom, urlRedirectContextPath, localIp, localPort); String remoteCoverArtUrl = StringUtil.rewriteRemoteUrl(coverArtUrl, shareUrl, urlRedirectionEnabled, urlRedirectFrom, urlRedirectContextPath, localIp, localPort); String format = formatFormat(player, file); String username = securityService.getCurrentUsername(request); boolean starred = mediaFileService.getMediaFileStarredDate(file.getId(), username) != null; entries.add(new PlayQueueInfo.Entry(file.getId(), file.getDiscNumber(), file.getTrackNumber(), file.getTitle(), file.getArtist(), file.getAlbumName(), file.getGenre(), file.getMood(), file.getYear(), formatBitRate(file), file.getDurationSeconds(), file.getDurationString(), format, formatContentType(format), formatFileSize(file.getFileSize(), locale), starred, albumUrl, streamUrl, remoteStreamUrl, coverArtUrl, remoteCoverArtUrl, file.getRank())); } boolean isStopEnabled = playQueue.getStatus() == PlayQueue.Status.PLAYING && !player.isExternalWithPlaylist(); float gain = jukeboxService.getGain(); return new PlayQueueInfo(entries, playQueue.getIndex(), isStopEnabled, playQueue.isRepeatEnabled(), playQueue.isPandoraEnabled(), sendM3U, gain); }
From source file:org.mifos.ui.core.controller.UploadLogoController.java
@RequestMapping(value = "/uploadNewLogo.ftl", method = RequestMethod.POST) public String uploadNewLogo(@ModelAttribute LogoUpload logoUpload, BindingResult result, Model model, HttpServletRequest request) {/*from w ww . j a v a 2 s.co m*/ String[] availableContentTypes = { "image/png", "image/gif", "image/jpeg", "image/pjpeg" }; if (Arrays.asList(availableContentTypes).contains(logoUpload.getFile().getContentType())) { try { logoServiceFacade.uploadNewLogo(logoUpload.getFile()); model.addAttribute("success", true); } catch (IOException e) { result.addError(new ObjectError("logoUpload", messageSource .getMessage("admin.uploadLogo.ioexception", null, RequestContextUtils.getLocale(request)))); } } else { result.addError(new ObjectError("logoUpload", messageSource.getMessage("admin.uploadLogo.badType", null, RequestContextUtils.getLocale(request)))); } return "uploadNewLogo"; }
From source file:org.orcid.frontend.web.controllers.BaseController.java
@ModelAttribute("jsMessagesJson") public String getJavascriptMessages(HttpServletRequest request) { ObjectMapper mapper = new ObjectMapper(); Locale locale = RequestContextUtils.getLocale(request); org.orcid.pojo.Local lPojo = new org.orcid.pojo.Local(); lPojo.setLocale(locale.toString());/*from w w w .j a v a 2 s.c om*/ ResourceBundle resources = ResourceBundle.getBundle("i18n/javascript", locale, new UTF8Control()); lPojo.setMessages(OrcidStringUtils.resourceBundleToMap(resources)); String messages = ""; try { messages = StringEscapeUtils.escapeEcmaScript(mapper.writeValueAsString(lPojo)); } catch (IOException e) { LOGGER.error("getJavascriptMessages error:" + e.toString(), e); } return messages; }
From source file:org.orcid.frontend.web.controllers.HomeController.java
@RequestMapping(value = "/lang.json") @Produces(value = { MediaType.APPLICATION_JSON }) public @ResponseBody org.orcid.pojo.Local langJson(HttpServletRequest request, @RequestParam(value = "lang", required = false) String lang) throws NoSuchRequestHandlingMethodException { if (lang != null) { String orcid = getRealUserOrcid(); if (orcid != null) { OrcidProfile existingProfile = orcidProfileManager.retrieveOrcidProfile(orcid); org.orcid.jaxb.model.message.Locale locale = existingProfile.getOrcidPreferences().getLocale(); if (!locale.value().equals(lang)) { try { existingProfile.getOrcidPreferences() .setLocale(org.orcid.jaxb.model.message.Locale.fromValue(lang)); orcidProfileManager.updateOrcidPreferences(existingProfile); } catch (Exception e) { LOGGER.error("langJson exception", e); } catch (Throwable t) { LOGGER.error("langJson Throwable", t); }/*from w ww. j a v a 2s . c o m*/ } } } Locale locale = RequestContextUtils.getLocale(request); return localeManager.getJavascriptMessages(locale); }
From source file:org.orcid.frontend.web.controllers.RegistrationController.java
private ModelAndView buildVerificationView(HttpServletRequest request, String encryptedEmail, RedirectAttributes redirectAttributes) throws UnsupportedEncodingException, NoSuchRequestHandlingMethodException { try {// w w w. j a va2 s.c o m String decryptedEmail = encryptionManager .decryptForExternalUse(new String(Base64.decodeBase64(encryptedEmail), "UTF-8")); EmailEntity emailEntity = emailDao.find(decryptedEmail); String emailOrcid = emailEntity.getProfile().getId(); if (!getCurrentUserOrcid().equals(emailOrcid)) { return new ModelAndView("wrong_user"); } emailEntity.setVerified(true); emailEntity.setCurrent(true); emailDao.merge(emailEntity); profileDao.updateLocale(emailOrcid, org.orcid.jaxb.model.message.Locale .fromValue(RequestContextUtils.getLocale(request).toString())); redirectAttributes.addFlashAttribute("emailVerified", true); } catch (EncryptionOperationNotPossibleException eonpe) { LOGGER.warn("Error decypting verify email from the verify email link"); redirectAttributes.addFlashAttribute("invalidVerifyUrl", true); } return new ModelAndView("redirect:/my-orcid"); }
From source file:org.orcid.frontend.web.controllers.RegistrationController.java
private OrcidProfile confirmEmailAndClaim(String decryptedEmail, OrcidProfile orcidProfile, Claim claim, HttpServletRequest request) throws NoSuchRequestHandlingMethodException { if (orcidProfile == null) { throw new NoSuchRequestHandlingMethodException(request); }// ww w. j a va2s.c o m orcidProfileManager.addLocale(orcidProfile, RequestContextUtils.getLocale(request)); Email email = orcidProfile.getOrcidBio().getContactDetails().getEmailByString(decryptedEmail); email.setVerified(true); email.setCurrent(true); OrcidHistory orcidHistory = orcidProfile.getOrcidHistory(); orcidHistory.setClaimed(new Claimed(true)); CompletionDate completionDate = orcidHistory.getCompletionDate(); if (completionDate == null) { orcidHistory.setCompletionDate(new CompletionDate(DateUtils.convertToXMLGregorianCalendar(new Date()))); } if (claim != null) { Preferences preferences = orcidProfile.getOrcidInternal().getPreferences(); if (preferences == null) { preferences = new Preferences(); } preferences.setSendChangeNotifications( new SendChangeNotifications(claim.getSendChangeNotifications().getValue())); preferences.setSendOrcidNews(new SendOrcidNews(claim.getSendOrcidNews().getValue())); preferences.setActivitiesVisibilityDefault( new ActivitiesVisibilityDefault(claim.getActivitiesVisibilityDefault().getVisibility())); } OrcidProfile profileToReturn = orcidProfileManager.updateOrcidProfile(orcidProfile); notificationManager.sendAmendEmail(profileToReturn, AmendedSection.UNKNOWN); return profileToReturn; }
From source file:org.orcid.frontend.web.controllers.RegistrationController.java
public OrcidProfile createMinimalRegistration(HttpServletRequest request, OrcidProfile profileToSave, boolean usedCaptchaVerification) { orcidProfileManager.addLocale(profileToSave, RequestContextUtils.getLocale(request)); String sessionId = request.getSession() == null ? null : request.getSession().getId(); String email = profileToSave.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue(); LOGGER.info("About to create profile from registration email={}, sessionid={}", email, sessionId); profileToSave = registrationManager.createMinimalRegistration(profileToSave, usedCaptchaVerification); notificationManager.sendWelcomeEmail(profileToSave, profileToSave.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue()); request.getSession().setAttribute(ManageProfileController.CHECK_EMAIL_VALIDATED, false); LOGGER.info("Created profile from registration orcid={}, email={}, sessionid={}", new Object[] { profileToSave.getOrcidIdentifier().getPath(), email, sessionId }); return profileToSave; }
From source file:org.shept.org.springframework.web.bind.support.DefaultWebBindingInitializer.java
public void initBinder(WebDataBinder binder, WebRequest request) { if (logger.isInfoEnabled()) { logger.info("Register custom binding initializers"); }/*from ww w . jav a 2 s.co m*/ if (getCustomEditorsForType() != null) { for (Entry<Class<?>, PropertyEditorSupport> editorEntry : getCustomEditorsForType().entrySet()) { binder.registerCustomEditor(editorEntry.getKey(), editorEntry.getValue()); } } if (isRegisterDefaultEditors()) { Locale locale = RequestContextUtils.getLocale(((ServletWebRequest) request).getRequest()); String format = formatResolver.resolveProperty(locale, getDateTimeFormat()); binder.registerCustomEditor(Calendar.class, new CustomCalendarEditor(new SimpleDateFormat(format), true)); binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(format), true)); } }