Submit User IP Address to back-end


		
                                      // TO DO: Attempt an inner try catch to grab ACL data, decide how to redirect user
		try {

			// get the current database			
                                                         Database database = (Database) FacesContext.getCurrentInstance()
					.getApplication().getVariableResolver().resolveVariable(
							FacesContext.getCurrentInstance(), "database");

			// prepare to create a document
			Document submitDocument = (Document) database.createDocument();
			// submit using UserInfoform (Alternatively, one can add the Alias of
			// that form)
			submitDocument.appendItemValue("form", "UserInfo");
			// using appendItemValue to insert in the fields needed
			// notice we are referencing the field (userIP) on the Xpage
			// JavaBean variables
			 //Additional Fields...
                                                           //Additional Fields...	
			submitDocument.appendItemValue("userIP", UserIP);

			// Run a JavaAgent after all items have been submitted from the Xpage
			 database.getAgent("IntruderAlertJavaAgent").runOnServer();
			
                                                         // save the data
			submitDocument.save();

			// recycle, release memory
			submitDocument.recycle();

			// throwable initialized if there is an error
			
		} catch (NotesException e) {
			// print this error to the server
			e.printStackTrace();
		}

	}
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...