List of usage examples for javax.servlet ServletContext getAttribute
public Object getAttribute(String name);
null
if there is no attribute by that name. From source file:com.rapid.core.Application.java
public void close(ServletContext servletContext) { // get the logger Logger logger = (Logger) servletContext.getAttribute("logger"); // closing //from w ww . j a v a 2 s. c o m logger.debug("Closing " + _id + "/" + _version + "..."); // if we got some if (_databaseConnections != null) { // loop them for (DatabaseConnection databaseConnection : _databaseConnections) { // close database connection try { // call the close method databaseConnection.close(); // log logger.debug("Closed " + databaseConnection.getName()); } catch (SQLException ex) { logger.error("Error closing database connection " + databaseConnection.getName() + " for " + _id + "/" + _version, ex); } } } // close form adapter if (_formAdapter != null) { try { // call the close method _formAdapter.close(); // log logger.debug("Closed form adapter"); } catch (Exception ex) { logger.error("Error closing form adapter for " + _id + "/" + _version, ex); } } }
From source file:org.eclipse.equinox.http.servlet.tests.ServletTest.java
public void test_commonsFileUpload() throws Exception { Servlet servlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override//from ww w . j a va 2 s . co m protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { boolean isMultipart = ServletFileUpload.isMultipartContent(req); Assert.assertTrue(isMultipart); DiskFileItemFactory factory = new DiskFileItemFactory(); ServletContext servletContext = this.getServletConfig().getServletContext(); File repository = (File) servletContext.getAttribute("javax.servlet.context.tempdir"); factory.setRepository(repository); ServletFileUpload upload = new ServletFileUpload(factory); List<FileItem> items = null; try { @SuppressWarnings("unchecked") List<FileItem> parseRequest = upload.parseRequest(req); items = parseRequest; } catch (FileUploadException e) { e.printStackTrace(); } Assert.assertNotNull(items); Assert.assertFalse(items.isEmpty()); FileItem fileItem = items.get(0); String submittedFileName = fileItem.getName(); String contentType = fileItem.getContentType(); long size = fileItem.getSize(); PrintWriter writer = resp.getWriter(); writer.write(submittedFileName); writer.write("|"); writer.write(contentType); writer.write("|" + size); } }; Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); Map<String, List<Object>> map = new HashMap<String, List<Object>>(); map.put("file", Arrays.<Object>asList(getClass().getResource("blue.png"))); Map<String, List<String>> result = requestAdvisor.upload("Servlet16/do", map); Assert.assertEquals("200", result.get("responseCode").get(0)); Assert.assertEquals("blue.png|image/png|292", result.get("responseBody").get(0)); }
From source file:com.rapid.core.Application.java
public void setSecurityAdapter(ServletContext servletContext, String securityAdapterType) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, IOException { // set the security adaper type from the incoming parameter _securityAdapterType = securityAdapterType; // if it was null update to rapid if (_securityAdapterType == null) _securityAdapterType = "rapid"; // get a map of the security adapter constructors HashMap<String, Constructor> constructors = (HashMap<String, Constructor>) servletContext .getAttribute("securityConstructors"); // get the constructor for our type Constructor<SecurityAdapter> constructor = constructors.get(_securityAdapterType); // if we couldn't find a constructor for the specified type if (constructor == null) { // set the type to rapid _securityAdapterType = "rapid"; // instantiate a rapid security adapter _securityAdapter = new RapidSecurityAdapter(servletContext, this); } else {//from w w w . ja v a2s . c o m // instantiate the specified security adapter _securityAdapter = constructor.newInstance(servletContext, this); } }
From source file:com.rapid.core.Application.java
public void setFormAdapter(ServletContext servletContext, String formAdapterType) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, IOException { // set the security adaper type from the incoming parameter _formAdapterType = formAdapterType;//from w w w . j av a 2 s .c om // if it was null if (_formAdapterType == null || "".equals(_formAdapterType)) { // clear the current one _formAdapter = null; } else { // get a map of the form adapter constructors HashMap<String, Constructor> constructors = (HashMap<String, Constructor>) servletContext .getAttribute("formConstructors"); // get the constructor for our type Constructor<FormAdapter> constructor = constructors.get(_formAdapterType); // if we got this constructor if (constructor != null) { // instantiate the specified form adapter _formAdapter = constructor.newInstance(servletContext, this); } else { // revert to rapid form adapter _formAdapter = new RapidFormAdapter(servletContext, this); } } }
From source file:org.entando.entando.plugins.jpcomponentinstaller.aps.system.services.installer.DefaultComponentInstaller.java
private void installPlugin(AvailableArtifact availableArtifact, String version, InputStream is) throws Exception { ServletContext servletContext = ((ConfigurableWebApplicationContext) this._applicationContext) .getServletContext();/*from ww w . j ava 2s . co m*/ String filename = availableArtifact.getGroupId() + "_" + availableArtifact.getArtifactId() + "_" + version + ".war"; String artifactName = availableArtifact.getArtifactId(); String appRootPath = servletContext.getRealPath("/"); File destDir = new File(appRootPath); String tempDirPath = appRootPath + "componentinstaller" + File.separator + artifactName; File artifactFile = new File(appRootPath + "componentinstaller" + File.separator + filename); FileUtils.copyInputStreamToFile(is, artifactFile); this.extractArchiveFile(artifactFile, tempDirPath); File artifactFileRootDir = new File( artifactFile.getParentFile().getAbsolutePath() + File.separator + artifactName); List<File> tilesFiles = (List<File>) FileUtils.listFiles(artifactFileRootDir, FileFilterUtils.suffixFileFilter("-tiles.xml"), FileFilterUtils.trueFileFilter()); if (tilesFiles == null) { tilesFiles = new ArrayList<File>(); } File tempArtifactRootDir = this.extractAllJars(destDir, artifactName); List<File> pluginSqlFiles = (List<File>) FileUtils.listFiles(tempArtifactRootDir, new String[] { "sql" }, true); List<File> pluginXmlFiles = (List<File>) FileUtils.listFiles(tempArtifactRootDir, new String[] { "xml" }, true); List<File> mainAppJarLibraries = (List<File>) FileUtils.listFiles( new File(destDir.getAbsolutePath() + File.separator + "WEB-INF" + File.separator + "lib"), new String[] { "jar" }, true); List<File> pluginJarLibraries = (List<File>) FileUtils.listFiles(artifactFileRootDir, new String[] { "jar" }, true); pluginJarLibraries = filterOutDuplicateLibraries(mainAppJarLibraries, pluginJarLibraries); FileUtils.copyDirectory(artifactFileRootDir, destDir); List<File> allFiles = new ArrayList<File>(); File systemParamsFile = FileUtils.getFile(destDir + File.separator + "WEB-INF" + File.separator + "conf", "systemParams.properties"); allFiles.add(systemParamsFile); allFiles.addAll(pluginJarLibraries); allFiles.addAll(pluginSqlFiles); allFiles.addAll(pluginXmlFiles); //The classloader's content is stored in servlet context and //updated every time so the classloader will eventually contain //the classes and resources of all the installed plugins List<URL> urlList = (List<URL>) servletContext.getAttribute("pluginInstallerURLList"); if (urlList == null) { urlList = new ArrayList<URL>(); servletContext.setAttribute("pluginInstallerURLList", urlList); } Set<File> jarSet = (Set<File>) servletContext.getAttribute("pluginInstallerJarSet"); if (jarSet == null) { jarSet = new HashSet<File>(); servletContext.setAttribute("pluginInstallerJarSet", jarSet); } jarSet.addAll(pluginJarLibraries); URLClassLoader cl = getURLClassLoader(urlList, allFiles.toArray(new File[0]), servletContext); loadClasses(jarSet.toArray(new File[0]), cl); servletContext.setAttribute("componentInstallerClassLoader", cl); ComponentManager.setComponentInstallerClassLoader(cl); //load plugin and dependencies contexts File componentFile = this.getFileFromArtifactJar(tempArtifactRootDir, "component.xml"); String componentToInstallName = this.getComponentName(componentFile); InitializerManager initializerManager = (InitializerManager) this._applicationContext .getBean("InitializerManager"); initializerManager.reloadCurrentReport(); SystemInstallationReport currentReport = initializerManager.getCurrentReport(); if (null != currentReport.getComponentReport(componentToInstallName, false)) { currentReport.removeComponentReport(componentToInstallName); this.saveReport(currentReport); initializerManager.reloadCurrentReport(); } List<String> components = this.getAllComponents(artifactFileRootDir); Properties properties = new Properties(); properties.load(new FileInputStream(systemParamsFile)); for (String componentName : components) { List<String> configLocs = new ArrayList<String>(); InitializerManager currenInitializerManager = (InitializerManager) _applicationContext .getBean("InitializerManager"); currentReport = currenInitializerManager.getCurrentReport(); ComponentInstallationReport cir = currentReport.getComponentReport(componentName, false); if (null != cir && cir.getStatus().equals(SystemInstallationReport.Status.UNINSTALLED)) { currentReport.removeComponentReport(componentName); this.saveReport(currentReport); currenInitializerManager.reloadCurrentReport(); } configLocs = this.getConfigPaths(artifactFileRootDir, componentName); if (configLocs.isEmpty()) { continue; } ClassPathXmlApplicationContext newContext = (ClassPathXmlApplicationContext) loadContext( (String[]) configLocs.toArray(new String[0]), cl, componentName, properties); this.reloadActionsDefinitions(newContext); this.reloadResourcsBundles(newContext, servletContext); TilesContainer container = TilesAccess.getContainer(servletContext); this.reloadTilesDefinitions(tilesFiles, container); currenInitializerManager.reloadCurrentReport(); ComponentManager componentManager = (ComponentManager) _applicationContext.getBean("ComponentManager"); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(newContext.getClassLoader()); componentManager.refresh(); } catch (Exception e) { throw e; } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } } }
From source file:com.rapid.core.Application.java
public void initialise(ServletContext servletContext, boolean createResources) throws JSONException, InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, SecurityException, NoSuchMethodException, IOException { // get the logger Logger logger = (Logger) servletContext.getAttribute("logger"); // trace log that we're initialising logger.trace("Initialising application " + _name + "/" + _version); // initialise the security adapter setSecurityAdapter(servletContext, _securityAdapterType); // initialise the form adapter setFormAdapter(servletContext, _formAdapterType); // initialise the resource includes collection _resources = new Resources(); // if there is any app JavaScript functions - this is for backwards compatibility as _functions have been moved to JavaScript resources if (_functions != null) { // initialise app resources if need be if (_appResources == null) _appResources = new Resources(); // add _functions as JavaScript resource to top of list _appResources.add(0, new Resource("Application functions", 1, _functions)); // remove the _functions _functions = null;/*from w w w. ja va 2s .c o m*/ } // if the created date is null set to today if (_createdDate == null) _createdDate = new Date(); // when importing an application we need to initialise but don't want the resource folders made in the old applications name if (createResources) { // get the jsonControls JSONArray jsonControls = (JSONArray) servletContext.getAttribute("jsonControls"); // get the jsonActions JSONArray jsonActions = (JSONArray) servletContext.getAttribute("jsonActions"); // string builders for the different sections in our rapid.js file StringBuilder resourceJS = new StringBuilder(); StringBuilder initJS = new StringBuilder(); StringBuilder dataJS = new StringBuilder(); StringBuilder actionJS = new StringBuilder(); // string builder for our rapid.css file StringBuilder resourceCSS = new StringBuilder(); // check controls if (jsonControls != null) { // check control types if (_controlTypes != null) { // remove the page control (if it's there) _controlTypes.remove("page"); // add it to the top of the list _controlTypes.add(0, "page"); // collection of dependent controls that need adding ArrayList<String> dependentControls = new ArrayList<String>(); // loop control types used by this application for (String controlType : _controlTypes) { // loop all available controls for (int i = 0; i < jsonControls.length(); i++) { // get the control JSONObject jsonControl = jsonControls.getJSONObject(i); // check if we're on the type we need if (controlType.equals(jsonControl.optString("type"))) { // look for any dependent control types JSONObject dependantTypes = jsonControl.optJSONObject("dependentTypes"); // if we got some if (dependantTypes != null) { // look for an array JSONArray dependantTypesArray = dependantTypes.optJSONArray("dependentType"); // if we got one if (dependantTypesArray != null) { // loop the array for (int j = 0; j < dependantTypesArray.length(); j++) { String dependantType = dependantTypesArray.getString(j); if (!_controlTypes.contains(dependantType) && !dependentControls.contains(dependantType)) dependentControls.add(dependantType); } } else { // just use the object String dependantType = dependantTypes.getString("dependentType"); if (!_controlTypes.contains(dependantType) && !dependentControls.contains(dependantType)) dependentControls.add(dependantType); } } // we're done break; } // available control type check } // available control types loop } // application control types loop // now add all of the dependent controls _controlTypes.addAll(dependentControls); // loop control types used by this application for (String controlType : _controlTypes) { // loop all available controls for (int i = 0; i < jsonControls.length(); i++) { // get the control JSONObject jsonControl = jsonControls.getJSONObject(i); // check if we're on the type we need if (controlType.equals(jsonControl.optString("type"))) { // add any resources (actions can have them too) addResources(jsonControl, "control", resourceJS, resourceCSS); // get any initJavaScript String js = jsonControl.optString("initJavaScript", ""); // check we got some if (js.length() > 0) { initJS.append("\nfunction Init_" + jsonControl.getString("type") + "(id, details) {\n"); initJS.append(" " + js.trim().replace("\n", "\n ")); initJS.append("\n}\n"); } // check for a getData method String getDataFunction = jsonControl.optString("getDataFunction"); // if there was something if (getDataFunction != null) { // clean and print! (if not an empty string) if (getDataFunction.trim().length() > 0) dataJS.append("\nfunction getData_" + controlType + "(ev, id, field, details) {\n " + getDataFunction.trim().replace("\n", "\n ") + "\n}\n"); } // check for a setData method String setDataFunction = jsonControl.optString("setDataJavaScript"); // if there was something if (setDataFunction != null) { // clean and print! (if not an empty string) if (setDataFunction.trim().length() > 0) dataJS.append("\nfunction setData_" + controlType + "(ev, id, field, details, data, changeEvents) {\n " + setDataFunction.trim().replace("\n", "\n ") + "\n}\n"); } // retrieve any runtimeProperties JSONObject jsonRuntimePropertyCollection = jsonControl .optJSONObject("runtimeProperties"); // check we got some if (jsonRuntimePropertyCollection != null) { // get the first one JSONObject jsonRuntimeProperty = jsonRuntimePropertyCollection .optJSONObject("runtimeProperty"); // get an array JSONArray jsonRunTimeProperties = jsonRuntimePropertyCollection .optJSONArray("runtimeProperty"); // initialise counters int index = 0; int count = 0; // if we got an array if (jsonRunTimeProperties != null) { // retain the first entry in the object jsonRuntimeProperty = jsonRunTimeProperties.getJSONObject(0); // retain the size count = jsonRunTimeProperties.length(); } do { // get the type String type = jsonRuntimeProperty.getString("type"); // get the get function String getFunction = jsonRuntimeProperty.optString("getPropertyFunction", null); // print the get function if there was one if (getFunction != null) dataJS.append("\nfunction getProperty_" + controlType + "_" + type + "(ev, id, field, details) {\n " + getFunction.trim().replace("\n", "\n ") + "\n}\n"); // get the set function String setFunction = jsonRuntimeProperty.optString("setPropertyJavaScript", null); // print the get function if there was one if (setFunction != null) dataJS.append("\nfunction setProperty_" + controlType + "_" + type + "(ev, id, field, details, data, changeEvents) {\n " + setFunction.trim().replace("\n", "\n ") + "\n}\n"); // increment index index++; // get the next one if (index < count) jsonRuntimeProperty = jsonRunTimeProperties.getJSONObject(index); } while (index < count); } // we're done with this jsonControl break; } } // jsonControls loop } // control types loop } // control types check } // jsonControls check // check actions if (jsonActions != null) { // check action types if (_actionTypes != null) { // collection of dependent controls that need adding ArrayList<String> dependentActions = new ArrayList<String>(); // loop control types used by this application for (String actionType : _actionTypes) { // loop all available controls for (int i = 0; i < jsonActions.length(); i++) { // get the action JSONObject jsonAction = jsonActions.getJSONObject(i); // check if we're on the type we need if (actionType.equals(jsonAction.optString("type"))) { // look for any dependant control types JSONObject dependantTypes = jsonAction.optJSONObject("dependentTypes"); // if we got some if (dependantTypes != null) { // look for an array JSONArray dependantTypesArray = dependantTypes.optJSONArray("dependentType"); // if we got one if (dependantTypesArray != null) { // loop the array for (int j = 0; j < dependantTypesArray.length(); j++) { String dependantType = dependantTypesArray.getString(j); if (!_actionTypes.contains(dependantType) && !dependentActions.contains(dependantType)) dependentActions.add(dependantType); } } else { // just use the object String dependantType = dependantTypes.getString("dependentType"); if (!_actionTypes.contains(dependantType) && !dependentActions.contains(dependantType)) dependentActions.add(dependantType); } } // we're done break; } } } // now add all of the dependent controls _controlTypes.addAll(dependentActions); // loop action types used by this application for (String actionType : _actionTypes) { // loop jsonActions for (int i = 0; i < jsonActions.length(); i++) { // get action JSONObject jsonAction = jsonActions.getJSONObject(i); // check the action is the one we want if (actionType.equals(jsonAction.optString("type"))) { // add any resources (controls can have them too) addResources(jsonAction, "action", resourceJS, resourceCSS); // get action JavaScript String js = jsonAction.optString("actionJavaScript"); // only produce rapid action is this is rapid app if (js != null && ("rapid".equals(_id) || !"rapid".equals(actionType))) { // clean and print! (if not an empty string) if (js.trim().length() > 0) actionJS.append("\n" + js.trim() + "\n"); } // move onto the next action type break; } } // jsonActions loop } // action types loop } // action types check } // jsonAction check // assume no theme css String themeCSS = null; // assume no theme name String themeName = null; // check the theme type if (_themeType != null) { // get the themes List<Theme> themes = (List<Theme>) servletContext.getAttribute("themes"); // check we got some if (themes != null) { // loop them for (Theme theme : themes) { // check type if (_themeType.equals(theme.getType())) { // retain the theme CSS themeCSS = theme.getCSS(); // retain the name themeName = theme.getName(); // get any resources addResources(theme.getResources(), "theme", themeName, null, resourceJS, resourceCSS); // we're done break; } } } } // put the appResources at the end so they can be overrides if (_appResources != null) { for (Resource resource : _appResources) { // create new resource based on this one (so that the dependancy doesn't get written back to the application.xml file) Resource appResource = new Resource(resource.getType(), resource.getContent(), ResourceDependency.RAPID); // if the type is a file or link prefix with the application folder switch (resource.getType()) { case Resource.JAVASCRIPTFILE: case Resource.CSSFILE: // files are available on the local file system so we prefix with the webfolder appResource.setContent(getWebFolder(this) + (resource.getContent().startsWith("/") ? "" : "/") + resource.getContent()); break; case Resource.JAVASCRIPTLINK: case Resource.CSSLINK: // links are not so go in as-is appResource.setContent(resource.getContent()); break; } // add new resource based on this one but with Rapid dependency _resources.add(appResource); } } // create folders to write the rapid.js file String applicationPath = getWebFolder(servletContext); File applicationFolder = new File(applicationPath); if (!applicationFolder.exists()) applicationFolder.mkdirs(); // write the rapid.js file FileOutputStream fos = new FileOutputStream(applicationPath + "/rapid.js"); PrintStream ps = new PrintStream(fos); // write the rapid.min.js file FileOutputStream fosMin = new FileOutputStream(applicationPath + "/rapid.min.js"); PrintWriter pw = new PrintWriter(fosMin); // file header ps.print( "\n/* This file is auto-generated on application load and save - it is minified when the application status is live */\n"); // check functions if (_functions != null) { if (_functions.length() > 0) { // header (this is removed by minify) ps.print("\n\n/* Application functions JavaScript */\n\n"); // insert params String functionsParamsInserted = insertParameters(servletContext, _functions); // print ps.print(functionsParamsInserted); // print minify Minify.toWriter(functionsParamsInserted, pw, Minify.JAVASCRIPT); } } // check resource js if (resourceJS.length() > 0) { // header ps.print("\n\n/* Control and Action resource JavaScript */\n\n"); // insert params String resourceJSParamsInserted = insertParameters(servletContext, resourceJS.toString()); // print ps.print(resourceJS.toString()); // print minify Minify.toWriter(resourceJSParamsInserted, pw, Minify.JAVASCRIPT); } // check init js if (initJS.length() > 0) { // header ps.print("\n\n/* Control initialisation methods */\n\n"); // insert params String initJSParamsInserted = insertParameters(servletContext, initJS.toString()); // print ps.print(initJS.toString()); // print minify Minify.toWriter(initJSParamsInserted, pw, Minify.JAVASCRIPT); } // check datajs if (dataJS.length() > 0) { // header ps.print("\n\n/* Control getData and setData methods */\n\n"); // insert params String dataJSParamsInserted = insertParameters(servletContext, dataJS.toString()); // print ps.print(dataJS.toString()); // print minify Minify.toWriter(dataJSParamsInserted, pw, Minify.JAVASCRIPT); } // check action js if (actionJS.length() > 0) { // header ps.print("\n\n/* Action methods */\n\n"); // insert params String actionParamsInserted = insertParameters(servletContext, actionJS.toString()); // print ps.print(actionJS.toString()); // print minify Minify.toWriter(actionParamsInserted, pw, Minify.JAVASCRIPT); } // close debug writer and stream ps.close(); fos.close(); // close min writer and stream pw.close(); fosMin.close(); // get the rapid CSS into a string and insert parameters String resourceCSSWithParams = insertParameters(servletContext, resourceCSS.toString()); String appThemeCSSWithParams = insertParameters(servletContext, themeCSS); String appCSSWithParams = insertParameters(servletContext, _styles); // write the rapid.css file fos = new FileOutputStream(applicationPath + "/rapid.css"); ps = new PrintStream(fos); ps.print( "\n/* This file is auto-generated on application load and save - it is minified when the application status is live */\n\n"); if (resourceCSSWithParams != null) { ps.print(resourceCSSWithParams.trim()); } if (appThemeCSSWithParams != null) { ps.print("\n\n/* " + themeName + " theme styles */\n\n"); ps.print(appThemeCSSWithParams.trim()); } if (appCSSWithParams != null) { ps.print("\n\n/* Application styles */\n\n"); ps.print(appCSSWithParams.trim()); } ps.close(); fos.close(); // minify it to a rapid.min.css file Minify.toFile(resourceCSSWithParams + appCSSWithParams, applicationPath + "/rapid.min.css", Minify.CSS); // check the status if (_status == STATUS_LIVE) { // add the application js min file as a resource _resources.add(new Resource(Resource.JAVASCRIPTFILE, getWebFolder(this) + "/rapid.min.js", ResourceDependency.RAPID)); // add the application css min file as a resource _resources.add(new Resource(Resource.CSSFILE, getWebFolder(this) + "/rapid.min.css", ResourceDependency.RAPID)); } else { // add the application js file as a resource _resources.add(new Resource(Resource.JAVASCRIPTFILE, getWebFolder(this) + "/rapid.js", ResourceDependency.RAPID)); // add the application css file as a resource _resources.add(new Resource(Resource.CSSFILE, getWebFolder(this) + "/rapid.css", ResourceDependency.RAPID)); } // loop all resources and minify js and css files for (Resource resource : _resources) { // get the content (which is the filename) String fileName = resource.getContent(); // only interested in js and css files switch (resource.getType()) { case Resource.JAVASCRIPTFILE: // get a file for this File jsFile = new File( servletContext.getRealPath("/") + (fileName.startsWith("/") ? "" : "/") + fileName); // if the file exists, and it's in the scripts folder and ends with .js if (jsFile.exists() && fileName.startsWith("scripts/") && fileName.endsWith(".js")) { // derive the min file name by modifying the start and end String fileNameMin = "scripts_min/" + fileName.substring(8, fileName.length() - 3) + ".min.js"; // get a file for minifying File jsFileMin = new File(servletContext.getRealPath("/") + "/" + fileNameMin); // if this file does not exist if (!jsFileMin.exists()) { // make any dirs it may need jsFileMin.getParentFile().mkdirs(); // minify to it Minify.toFile(jsFile, jsFileMin, Minify.JAVASCRIPT); } // if this application is live, update the resource to the min file if (_status == STATUS_LIVE) resource.setContent(fileNameMin); } break; case Resource.CSSFILE: // get a file for this File cssFile = new File( servletContext.getRealPath("/") + (fileName.startsWith("/") ? "" : "/") + fileName); // if the file exists, and it's in the scripts folder and ends with .js if (cssFile.exists() && fileName.startsWith("styles/") && fileName.endsWith(".css")) { // derive the min file name by modifying the start and end String fileNameMin = "styles_min/" + fileName.substring(7, fileName.length() - 4) + ".min.css"; // get a file for minifying File cssFileMin = new File(servletContext.getRealPath("/") + "/" + fileNameMin); // if this file does not exist if (!cssFileMin.exists()) { // make any dirs it may need cssFileMin.getParentFile().mkdirs(); // minify to it Minify.toFile(cssFile, cssFileMin, Minify.CSS); } // if this application is live, update the resource to the min file if (_status == STATUS_LIVE) resource.setContent(fileNameMin); } break; } } // loop resources // a list for all of the style classes we're going to send up with _styleClasses = new ArrayList<String>(); // populate the list of style classes by scanning the global styles scanStyleClasses(_styles, _styleClasses); // and any theme scanStyleClasses(appThemeCSSWithParams, _styleClasses); // remove any that have the same name as controls if (jsonControls != null) { // loop them for (int i = 0; i < jsonControls.length(); i++) { // remove any classes with this controls type _styleClasses.remove(jsonControls.getJSONObject(i).getString("type")); } } } // create resources // empty the list of page variables so it's regenerated _pageVariables = null; // debug log that we initialised logger.debug( "Initialised application " + _name + "/" + _version + (createResources ? "" : " (no resources)")); }
From source file:com.quix.aia.cn.imo.mapper.UserMaintenance.java
/** * <p>This method checks USer id and Password and sets values to bean and * also set last time login Date & Time</p> * @param User user object/*w w w . j a v a 2 s. c om*/ * @param requestParameters Servlet Request Parameter * @return User object */ // public User authenticateUser(String userID, String password) { // log.log(Level.INFO,"UserMaintenance --> authenticateUser "); // // ArrayList<User> list = new ArrayList(); // User user=null; // Query query=null; // Session session = null; // Transaction tx; // try{ // // session = HibernateFactory.openSession(); // tx= session.beginTransaction(); // String psw=PasswordHashing.EncryptBySHA2(password); // query = session.createQuery(" from User where status = 1 and staffLoginId=:LoginId and password=:psw "); // query.setParameter("LoginId",userID.toUpperCase()); // query.setParameter("psw",psw ); // // list=(ArrayList<User>) query.list(); // // if(list.size()==0){ // query = session.createQuery(" from User where status = 1 and staffLoginId=:LoginId "); // query.setParameter("LoginId",userID.toUpperCase()); // list=(ArrayList<User>) query.list(); // User tempUser=new User(); // if(list.size()!=0){ // tempUser=list.get(0); // query = session.createQuery("UPDATE User SET faildLogin=:failLogin where status = 1 and user_no=:userno "); // query.setParameter("failLogin", new Date()); // query.setParameter("userno", tempUser.getUser_no()); // query.executeUpdate(); // tx.commit(); // // } // // return user; // }else{ // user = new User(); // user = list.get(0); // // if(user.getSscCode() > 0) // user.setSscLevel(true); // else if(user.getCityCode() > 0) // user.setCityLevel(true); // else if(user.getBranchCode() > 0) // user.setBranchLevel(true); // else if(user.getDistrict() > 0) // user.setDistrictLevel(true); // else if(user.getBuCode() > 0) // user.setBuLevel(true); // } // // query = session.createQuery("UPDATE User SET lastLogIn=:lastLogin where status = 1 and user_no=:userno "); // query.setParameter("lastLogin", new Date()); // query.setParameter("userno", user.getUser_no()); // query.executeUpdate(); // tx.commit(); // // // log.log(Level.INFO,"authenticateUser Successfully ................. "); // } // catch(Exception e) // { // log.log(Level.INFO,"authenticateUser Failed ................. "); // e.printStackTrace(); // // }finally{ // try{ // HibernateFactory.close(session); // }catch(Exception e){ // // e.printStackTrace(); // } // // } // return user; // } public User authenticateUser(String userID, String password, String branch, ServletContext context) { log.log(Level.INFO, "UserMaintenance --> authenticateUser "); ArrayList<User> list = new ArrayList(); User user = null; Query query = null; Session session = null; Transaction tx; UserRest userRest = null; UserAuthResponds userAuth = new UserAuthResponds(); if ("admin".equalsIgnoreCase(userID) && "P@ssword1".equals(password)) { user = new User(); user.setBranchCode(0); user.setBranchLevel(false); user.setBuCode(0); user.setStaffName("Admin"); user.setBuLevel(true); // user.setChannelCode("2|3|"); user.setCityCode("0"); user.setCityLevel(false); user.setContactNo("0000000000"); user.setDepartment(0); user.setDistrict(0); user.setDistrictLevel(false); user.setEmail("admin@email.com"); user.setPassword(password); user.setSscCode("0"); user.setSscLevel(false); user.setOfficeCode("0"); user.setOfficeLevel(false); user.setBranchCode(0); user.setBranchLevel(false); user.setStaffLoginId("Admin"); user.setStatus(true); user.setStatusPsw(true); user.setUser_no(0); user.setUserType("AD"); user.setCho(true); log.log(Level.INFO, "authenticateUser Successfully ................. "); } else { GsonBuilder builder = new GsonBuilder(); HttpClient httpClient = new DefaultHttpClient(); try { String co = ""; // userID="NSNP306"; // password="A111111A"; AamData aamData = new AamData(); co = branch; // co="0986"; Map<String, String> map = (Map<String, String>) context .getAttribute(ApplicationAttribute.CONFIGURATION_PROPERTIES_MAP); // String userAuthUrl = ResourceBundle.getBundle("configurations").getString("userAuthUrl"); // String userAuthUrl = map.get("userAuthUrl"); String userAuthUrlFinal = ""; // String userAuthEnvironment = map.get("userAuthEnvironment"); // String userAuthEnvironment = context.getInitParameter("userAuthEnvironment"); Context envEntryContext = (Context) new InitialContext().lookup("java:comp/env"); String userAuthEnvironment = (String) envEntryContext.lookup("userAuthEnvironment"); if ("internet".equalsIgnoreCase(userAuthEnvironment)) { userAuthUrlFinal = map.get("userAuthUrlInternet") + "&co=" + co + "&account=" + userID + "&password=" + password; } else { userAuthUrlFinal = map.get("userAuthUrl") + "&co=" + co + "&account=" + userID + "&password=" + password; } log.log(Level.INFO, "UserAuthUrl : " + userAuthUrlFinal + " :- userAuthEnvironment : " + userAuthEnvironment, ""); HttpGet getRequest = new HttpGet(userAuthUrlFinal); getRequest.addHeader("accept", "application/json"); HttpResponse response = httpClient.execute(getRequest); if (response.getStatusLine().getStatusCode() != 200) { throw new RuntimeException( "Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); String output; log.log(Level.INFO, "UserMaintenance --> Output from Server .... "); // System.out.println("Output from Server .... \n"); if ((output = br.readLine()) != null) { //System.out.println(output); Gson googleJson = new Gson(); userAuth = googleJson.fromJson(output, UserAuthResponds.class); System.out.println("Success " + userAuth.getSuccess()); if (userAuth.getSuccess().equals("1")) { String content = userAuth.getContent(); content = AESPasswordManager.getInstance().decryptPassword(content); builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() { @Override public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return LMSUtil.convertDateToyyyy_mm_dd(json.getAsString()); } }); googleJson = builder.create(); // content="{\"BRANCH\":\"0986\",\"CITY\":NULL,\"SSC\":NULL,\"USERTYPE\":NULL,\"USERID\":\"000015710\",\"USERNAME\":\" \",\"USERSTATUS\":\"A\",\"TEAMCODE\":\"G00000060\",\"TEAMNAME\":\" \",\"OFFICECODE\":\"YA01\",\"OFFICENAME\":\" \",\"CERTIID\":\"310110198008080808 \",\"DATEOFBIRTH\":\"1980-08-08\",\"GENDER\":\"F \",\"CONTRACTEDDATE\":\"2002-10-01 12:00:00.0\",\"TITLE\":\"L3\",\"DTLEADER\":NULL}"; userRest = googleJson.fromJson(content, UserRest.class); if ("STAFF".equalsIgnoreCase(userRest.getUSERTYPE())) { // // aamData = AamDataMaintenance.retrieveDataToModel(userID); // // // user = new User(); // if(aamData.getBranchCode()==null){ // user.setBranchCode(0); // }else{ // user.setBranchCode(aamData.getBranchCode()); // } // // if(aamData.getOfficeCode()==null){ // user.setOfficeCode(0); // }else{ // user.setOfficeCode(Integer.parseInt(aamData.getOfficeCode())); // } // // if(aamData.getDistrictCode()==null){ // user.setDistrict(0); // }else{ // user.setDistrict(aamData.getDistrictCode()); // } // // if(aamData.getCityCode()==null){ // user.setCityCode(0); // }else{ // user.setCityCode(aamData.getCityCode()); // } // // if(aamData.getBuCode()==null){ // user.setBuCode(0); // }else{ // user.setBuCode(aamData.getBuCode()); // } // if(aamData.getSscCode()==null){ // user.setSscCode(0); // }else{ // user.setSscCode(aamData.getSscCode()); // } // // user.setStaffLoginId(aamData.getAgentCode()); // // user.setUserType(userRest.getUSERTYPE()); // if(userRest.getUSERSTATUS()!=null){ // if(userRest.getUSERSTATUS().equalsIgnoreCase("A")){ // user.setStatus(true); // }else{ // user.setStatus(false); // } // }else{ // user.setStatus(false); // } // // if(aamData.getAgentName()==null){ // user.setStaffName(""); // }else{ // user.setStaffName(aamData.getAgentName()); // } // // if(user.getOfficeCode() > 0) // user.setOfficeLevel(true); // if(user.getSscCode() > 0) // user.setSscLevel(true); // // else if(user.getCityCode() > 0) // user.setCityLevel(true); // else if(user.getBranchCode() > 0) // user.setBranchLevel(true); // else if(user.getDistrict() > 0) // user.setDistrictLevel(true); // else if(user.getBuCode() > 0) // user.setBuLevel(true); session = HibernateFactory.openSession(); tx = session.beginTransaction(); //String psw=PasswordHashing.EncryptBySHA2(password); query = session.createQuery(" from User where status = 1 and staffLoginId=:LoginId "); query.setParameter("LoginId", userID.toUpperCase()); //query.setParameter("psw",psw ); list = (ArrayList<User>) query.list(); if (list.size() == 0) { // query = session.createQuery(" from User where status = 1 and staffLoginId=:LoginId "); // query.setParameter("LoginId",userID.toUpperCase()); // list=(ArrayList<User>) query.list(); // User tempUser=new User(); // if(list.size()!=0){ // tempUser=list.get(0); // query = session.createQuery("UPDATE User SET faildLogin=:failLogin where status = 1 and user_no=:userno "); // query.setParameter("failLogin", new Date()); // query.setParameter("userno", tempUser.getUser_no()); // query.executeUpdate(); // tx.commit(); // // } // return user; } else { user = new User(); user = list.get(0); if (!user.getOfficeCode().trim().equals("0")) user.setOfficeLevel(true); else if (!user.getSscCode().trim().equals("0")) user.setSscLevel(true); else if (!user.getCityCode().trim().equals("0")) user.setCityLevel(true); else if (user.getBranchCode() > 0) user.setBranchLevel(true); else if (user.getDistrict() > 0) user.setDistrictLevel(true); else if (user.getBuCode() > 0) user.setBuLevel(true); } query = session.createQuery( "UPDATE User SET lastLogIn=:lastLogin where status = 1 and user_no=:userno "); query.setParameter("lastLogin", new Date()); query.setParameter("userno", user.getUser_no()); query.executeUpdate(); tx.commit(); log.log(Level.INFO, "authenticateUser Successfully ................. "); } else { log.log(Level.INFO, "Login Failed............"); } } else { log.log(Level.INFO, "Login Failed............"); } } } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("UserMaintenance", Level.SEVERE + "", errors.toString()); } finally { httpClient.getConnectionManager().shutdown(); HibernateFactory.close(session); } } return user; }
From source file:com.redsqirl.CanvasBean.java
public String[] getPositions() throws Exception { logger.warn("getPositions"); FacesContext fCtx = FacesContext.getCurrentInstance(); ServletContext sc = (ServletContext) fCtx.getExternalContext().getContext(); String selecteds = (String) sc.getAttribute("selecteds"); logger.warn("getPositions " + selecteds); /*if(getDf() != null){ logger.warn('a');/* ww w. j av a2s .c om*/ }else{ logger.warn('b'); }*/ return getPositions(getDf(), getNameWorkflow(), selecteds); }
From source file:org.apache.tapestry.engine.AbstractEngine.java
/** * Invoked from {@link #service(RequestContext)} to ensure that the engine's * instance variables are setup. This allows the application a chance to * restore transient variables that will not have survived deserialization. * * Determines the servlet prefix: this is the base URL used by * {@link IEngineService services} to build URLs. It consists * of two parts: the context path and the servlet path. * * <p>The servlet path is retrieved from {@link HttpServletRequest#getServletPath()}. * * <p>The context path is retrieved from {@link HttpServletRequest#getContextPath()}. * * <p>The global object is retrieved from {@link IEngine#getGlobal()} method. * * <p>The final path is available via the {@link #getServletPath()} method. * * <p>In addition, this method locates and/or creates the: * <ul>// w w w. j av a 2s . c o m * <li>{@link IComponentClassEnhancer} * <li>{@link Pool} * <li>{@link ITemplateSource} * <li>{@link ISpecificationSource} * <li>{@link IPageSource} * <li>{@link IEngineService} {@link Map} * <ll>{@link IScriptSource} * <li>{@link IComponentMessagesSource} * <li>{@link IPropertySource} * </ul> * * <p>This order is important, because some of the later shared objects * depend on some of the earlier shared objects already having * been located or created * (especially {@link #getPool() pool}). * * <p>Subclasses should invoke this implementation first, then perform their * own setup. * **/ protected void setupForRequest(RequestContext context) { HttpServlet servlet = context.getServlet(); ServletContext servletContext = servlet.getServletContext(); HttpServletRequest request = context.getRequest(); HttpSession session = context.getSession(); if (session != null) _sessionId = context.getSession().getId(); else _sessionId = null; // Previously, this used getRemoteHost(), but that requires an // expensive reverse DNS lookup. Possibly, the host name lookup // should occur ... but only if there's an actual error message // to display. if (_clientAddress == null) _clientAddress = request.getRemoteAddr(); // servletPath is null, so this means either we're doing the // first request in this session, or we're handling a subsequent // request in another JVM (i.e. another server in the cluster). // In any case, we have to do some late (re-)initialization. if (_servletPath == null) { // Get the path *within* the servlet context // In rare cases related to the tagsupport service, getServletPath() is wrong // (its a JSP, which invokes Tapestry as an include, thus muddling what // the real servlet and servlet path is). In those cases, the JSP tag // will inform us. String path = (String) request.getAttribute(Tapestry.TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE); if (path == null) path = request.getServletPath(); // Get the context path, which may be the empty string // (but won't be null). _contextPath = request.getContextPath(); _servletPath = _contextPath + path; } String servletName = context.getServlet().getServletName(); if (_propertySource == null) { String name = PROPERTY_SOURCE_NAME + ":" + servletName; _propertySource = (IPropertySource) servletContext.getAttribute(name); if (_propertySource == null) { _propertySource = createPropertySource(context); servletContext.setAttribute(name, _propertySource); } } if (_enhancer == null) { String name = ENHANCER_NAME + ":" + servletName; _enhancer = (IComponentClassEnhancer) servletContext.getAttribute(name); if (_enhancer == null) { _enhancer = createComponentClassEnhancer(context); servletContext.setAttribute(name, _enhancer); } } if (_pool == null) { String name = POOL_NAME + ":" + servletName; _pool = (Pool) servletContext.getAttribute(name); if (_pool == null) { _pool = createPool(context); servletContext.setAttribute(name, _pool); } } if (_templateSource == null) { String name = TEMPLATE_SOURCE_NAME + ":" + servletName; _templateSource = (ITemplateSource) servletContext.getAttribute(name); if (_templateSource == null) { _templateSource = createTemplateSource(context); servletContext.setAttribute(name, _templateSource); } } if (_specificationSource == null) { String name = SPECIFICATION_SOURCE_NAME + ":" + servletName; _specificationSource = (ISpecificationSource) servletContext.getAttribute(name); if (_specificationSource == null) { _specificationSource = createSpecificationSource(context); servletContext.setAttribute(name, _specificationSource); } } if (_pageSource == null) { String name = PAGE_SOURCE_NAME + ":" + servletName; _pageSource = (IPageSource) servletContext.getAttribute(name); if (_pageSource == null) { _pageSource = createPageSource(context); servletContext.setAttribute(name, _pageSource); } } if (_scriptSource == null) { String name = SCRIPT_SOURCE_NAME + ":" + servletName; _scriptSource = (IScriptSource) servletContext.getAttribute(name); if (_scriptSource == null) { _scriptSource = createScriptSource(context); servletContext.setAttribute(name, _scriptSource); } } if (_serviceMap == null) { String name = SERVICE_MAP_NAME + ":" + servletName; _serviceMap = (Map) servletContext.getAttribute(name); if (_serviceMap == null) { _serviceMap = createServiceMap(); servletContext.setAttribute(name, _serviceMap); } } if (_stringsSource == null) { String name = STRINGS_SOURCE_NAME + ":" + servletName; _stringsSource = (IComponentMessagesSource) servletContext.getAttribute(name); if (_stringsSource == null) { _stringsSource = createComponentStringsSource(context); servletContext.setAttribute(name, _stringsSource); } } if (_dataSqueezer == null) { String name = DATA_SQUEEZER_NAME + ":" + servletName; _dataSqueezer = (DataSqueezer) servletContext.getAttribute(name); if (_dataSqueezer == null) { _dataSqueezer = createDataSqueezer(); servletContext.setAttribute(name, _dataSqueezer); } } if (_global == null) { String name = GLOBAL_NAME + ":" + servletName; _global = servletContext.getAttribute(name); if (_global == null) { _global = createGlobal(context); servletContext.setAttribute(name, _global); } } if (_resourceChecksumSource == null) { String name = RESOURCE_CHECKSUM_SOURCE_NAME + ":" + servletName; _resourceChecksumSource = (ResourceChecksumSource) servletContext.getAttribute(name); if (_resourceChecksumSource == null) { _resourceChecksumSource = createResourceChecksumSource(); servletContext.setAttribute(name, _resourceChecksumSource); } } String encoding = request.getCharacterEncoding(); if (encoding == null) { encoding = getOutputEncoding(); try { request.setCharacterEncoding(encoding); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(Tapestry.format("illegal-encoding", encoding)); } catch (NoSuchMethodError e) { // Servlet API 2.2 compatibility // Behave okay if the setCharacterEncoding() method is unavailable } catch (AbstractMethodError e) { // Servlet API 2.2 compatibility // Behave okay if the setCharacterEncoding() method is unavailable } } }
From source file:com.liferay.portal.servlet.MainServlet.java
public void init(ServletConfig config) throws ServletException { synchronized (MainServlet.class) { super.init(config); Config.initializeConfig();//from w ww . ja va 2 s .c o m com.dotmarketing.util.Config.setMyApp(config.getServletContext()); // Need the plugin root dir before Hibernate comes up try { APILocator.getPluginAPI() .setPluginJarDir(new File(config.getServletContext().getRealPath("WEB-INF/lib"))); } catch (IOException e1) { Logger.debug(InitServlet.class, "IOException: " + e1.getMessage(), e1); } // Checking for execute upgrades try { StartupTasksExecutor.getInstance().executeUpgrades(config.getServletContext().getRealPath(".")); } catch (DotRuntimeException e1) { throw new ServletException(e1); } catch (DotDataException e1) { throw new ServletException(e1); } // Starting the reindexation threads ClusterThreadProxy.createThread(); if (Config.getBooleanProperty("DIST_INDEXATION_ENABLED")) { ClusterThreadProxy.startThread(Config.getIntProperty("DIST_INDEXATION_SLEEP", 500), Config.getIntProperty("DIST_INDEXATION_INIT_DELAY", 5000)); } ReindexThread.startThread(Config.getIntProperty("REINDEX_THREAD_SLEEP", 500), Config.getIntProperty("REINDEX_THREAD_INIT_DELAY", 5000)); try { EventsProcessor.process(new String[] { StartupAction.class.getName() }, true); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } // Context path ServletConfig sc = getServletConfig(); ServletContext ctx = getServletContext(); String ctxPath = GetterUtil.get(sc.getInitParameter("ctx_path"), "/"); ctx.setAttribute(WebKeys.CTX_PATH, StringUtil.replace(ctxPath + "/c", "//", "/")); ctx.setAttribute(WebKeys.CAPTCHA_PATH, StringUtil.replace(ctxPath + "/captcha", "//", "/")); ctx.setAttribute(WebKeys.IMAGE_PATH, StringUtil.replace(ctxPath + "/image", "//", "/")); // Company id _companyId = ctx.getInitParameter("company_id"); ctx.setAttribute(WebKeys.COMPANY_ID, _companyId); // Initialize portlets try { String[] xmls = new String[] { Http.URLtoString(ctx.getResource("/WEB-INF/portlet.xml")), Http.URLtoString(ctx.getResource("/WEB-INF/portlet-ext.xml")), Http.URLtoString(ctx.getResource("/WEB-INF/liferay-portlet.xml")), Http.URLtoString(ctx.getResource("/WEB-INF/liferay-portlet-ext.xml")) }; PortletManagerUtil.initEAR(xmls); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } // Initialize portlets display try { String xml = Http.URLtoString(ctx.getResource("/WEB-INF/liferay-display.xml")); Map oldCategories = (Map) WebAppPool.get(_companyId, WebKeys.PORTLET_DISPLAY); Map newCategories = PortletManagerUtil.getEARDisplay(xml); Map mergedCategories = PortalUtil.mergeCategories(oldCategories, newCategories); WebAppPool.put(_companyId, WebKeys.PORTLET_DISPLAY, mergedCategories); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } // Initialize skins // // try { // String[] xmls = new String[] { Http.URLtoString(ctx.getResource("/WEB-INF/liferay-skin.xml")), // Http.URLtoString(ctx.getResource("/WEB-INF/liferay-skin-ext.xml")) }; // // SkinManagerUtil.init(xmls); // } catch (Exception e) { // Logger.error(this, e.getMessage(), e); // } // Check company try { CompanyLocalManagerUtil.checkCompany(_companyId); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } // Check web settings try { String xml = Http.URLtoString(ctx.getResource("/WEB-INF/web.xml")); _checkWebSettings(xml); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } // Scheduler // try { // Iterator itr = // PortletManagerUtil.getPortlets(_companyId).iterator(); // // while (itr.hasNext()) { // Portlet portlet = (Portlet)itr.next(); // // String className = portlet.getSchedulerClass(); // // if (portlet.isActive() && className != null) { // Scheduler scheduler = // (Scheduler)InstancePool.get(className); // // scheduler.schedule(); // } // } // } // catch (ObjectAlreadyExistsException oaee) { // } // catch (Exception e) { // Logger.error(this,e.getMessage(),e); // } // Message Resources MultiMessageResources messageResources = (MultiMessageResources) ctx.getAttribute(Globals.MESSAGES_KEY); messageResources.setServletContext(ctx); WebAppPool.put(_companyId, Globals.MESSAGES_KEY, messageResources); // Current users WebAppPool.put(_companyId, WebKeys.CURRENT_USERS, new TreeMap()); // HttpBridge TaskController.bridgeUserServicePath = "/httpbridge/home"; TaskController.bridgeHttpServicePath = "/httpbridge/http"; TaskController.bridgeGotoTag = "(goto)"; TaskController.bridgeThenTag = "(then)"; TaskController.bridgePostTag = "(post)"; // Process startup events try { EventsProcessor.process(PropsUtil.getArray(PropsUtil.GLOBAL_STARTUP_EVENTS), true); EventsProcessor.process(PropsUtil.getArray(PropsUtil.APPLICATION_STARTUP_EVENTS), new String[] { _companyId }); } catch (Exception e) { Logger.error(this, e.getMessage(), e); } PortalInstances.init(_companyId); } }