`
yjgyjg4
  • 浏览: 118951 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

liferay json

    博客分类:
  • ajax
阅读更多
来源于网络,备用
Index: trunk/portlets/mail-portlet/docroot/WEB-INF/src/com/liferay/mail/util/MailBoxManager.java
===================================================================
diff -u -N -r16075 -r16083
--- trunk/portlets/mail-portlet/docroot/WEB-INF/src/com/liferay/mail/util/MailBoxManager.java	(.../MailBoxManager.java)	(revision 16075)
+++ trunk/portlets/mail-portlet/docroot/WEB-INF/src/com/liferay/mail/util/MailBoxManager.java	(.../MailBoxManager.java)	(revision 16083)
@@ -22,8 +22,23 @@
 
 package com.liferay.mail.util;
 
+import com.liferay.mail.model.MailAccount;
+import com.liferay.portal.kernel.util.ContentTypes;
+import com.liferay.portal.kernel.util.GetterUtil;
+import com.liferay.portal.kernel.util.StringPool;
+import com.liferay.portal.kernel.util.StringUtil;
+import com.liferay.portal.kernel.util.Validator;
+import com.liferay.portal.model.User;
+import com.liferay.util.JSONUtil;
+
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPSSLStore;
+import com.sun.mail.imap.IMAPStore;
+
 import java.io.IOException;
+
 import java.text.SimpleDateFormat;
+
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -43,9 +58,9 @@
 import javax.mail.URLName;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage.RecipientType;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimeMessage.RecipientType;
 import javax.mail.search.AndTerm;
 import javax.mail.search.BodyTerm;
 import javax.mail.search.FromStringTerm;
@@ -56,26 +71,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.json.JSONArray;
-import org.json.JSONObject;
 import org.json.JSONException;
+import org.json.JSONObject;
 
-import com.liferay.util.JSONUtil;
-import com.liferay.portal.kernel.util.ContentTypes;
-import com.liferay.portal.kernel.util.GetterUtil;
-import com.liferay.portal.kernel.util.StringPool;
-import com.liferay.portal.kernel.util.StringUtil;
-import com.liferay.portal.kernel.util.Validator;
-import com.liferay.portal.model.User;
-import com.liferay.mail.model.MailAccount;
-import com.liferay.util.mail.JavaMailUtil;
-import com.sun.mail.imap.IMAPFolder;
-import com.sun.mail.imap.IMAPSSLStore;
-import com.sun.mail.imap.IMAPStore;
-
 /**
- * Used as a fascade to the JavaMail API.  All JavaMail objects are wrappered in
- * model classes and returned out of this utility fascade.
  *
  * <a href="MailBoxManager.java.html"><b><i>View Source</i></b></a>
  *
@@ -84,24 +85,16 @@
  */
 public class MailBoxManager {
 
-	private MailAccount _defaultMailAccount;
-    private Session _session = null;
-    private Store _store = null;
-	private User _user;
+	public static String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
 
-	private String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
-
     public MailBoxManager(User user, int accountId) {
 
-    	// get mail settings for account number for user
-
     	_user = user;
 
     	_defaultMailAccount = new MailAccount(user, accountId);
     }
 
     public void deleteMessage(Folder folder, Message message) {
-
         try {
         	if (!folder.isOpen()) {
         		folder.open(Folder.READ_WRITE);
@@ -111,8 +104,8 @@
 
 			folder.close(true);
 		}
-		catch (MessagingException ex) {
-		    System.out.println(ex.getMessage());
+		catch (MessagingException me) {
+			_log.error(me.getMessage());
         }
 	}
 
@@ -146,29 +139,20 @@
 
 			folder.close(true);
 		}
-		catch (MessagingException ex) {
-		    System.out.println(ex.getMessage());
+		catch (MessagingException me) {
+			_log.error(me.getMessage());
         }
 	}
 
-    /*
-     * Create folder if it does not exist
-     */
 	public void createFolder(String folderName) throws Exception {
 
-		Folder newFolder = _getStore().getFolder(folderName);
+		Folder newFolder = getStore().getFolder(folderName);
 
 		if (!newFolder.exists()) {
 			newFolder.create(Folder.HOLDS_MESSAGES);
 		}
 	}
 
-    /**
-     *
-     *
-     * @param addresses
-     * @return
-     */
 	public String getAddressesAsString(Address[] addresses) {
         StringBuffer sb = new StringBuffer();
 
@@ -196,46 +180,32 @@
 	}
 
 	public Part getAttachment(
-			String folderName, int messageUid, String contentPath) 
-		throws MessagingException { 
-	
+			String folderName, int messageUid, String contentPath)
+		throws MessagingException {
+
 		Message message = getMessageByUid(folderName, messageUid);
-		
-		return _getMessagePart(message, contentPath);
+
+		return getMessagePart(message, contentPath);
 	}
-	
-	/**
-	 * Gets a list of folders (and subfolders) from store
-	 *
-	 * @return
-	 * @throws MessagingException
-	 */
+
 	public List getFolders() throws MessagingException {
-		Store store = _getStore();
+		Store store = getStore();
 		IMAPFolder rootFolder = (IMAPFolder)store.getDefaultFolder();
 
 		List allFolders = new ArrayList();
-		
-		_getFolders(allFolders, rootFolder.list());
-		
+
+		getFolders(allFolders, rootFolder.list());
+
 		return allFolders;
 	}
 
-	/**
-	 * Gets the specified folder (not opened)
-	 *
-	 * @param folderName
-	 * @return
-	 * @throws Exception
-	 */
     public Folder getFolder(String folderName) throws MessagingException {
-        // Open the Folder
-        Folder folder = _getStore().getDefaultFolder();
+		Folder folder = getStore().getDefaultFolder();
 
         folder = folder.getFolder(folderName);
 
         if (folder == null) {
-            System.out.println("Invalid folder: " + folderName);
+			_log.error("Invalid folder: " + folderName);
         }
 
         return folder;
@@ -294,60 +264,31 @@
 
     	JSONObject jsonFolderObj = new JSONObject();
 
-		Date startTimer = new Date();
-    	
     	if (folder.getType() != Folder.HOLDS_FOLDERS) {
     		folder.open(Folder.READ_ONLY);
 
-    		JSONUtil.put(jsonFolderObj, "newMessages", folder.getUnreadMessageCount());
+    		JSONUtil.put(
+				jsonFolderObj, "newMessages", folder.getUnreadMessageCount());
     		JSONUtil.put(jsonFolderObj, "name", folder.getFullName());
-    	
+
     		Message[] messages = folder.getMessages();
-    		
+
     		JSONUtil.put(jsonFolderObj, "messageCount", messages.length);
 
-    		/*
-    		JSONArray jsonUidList = new JSONArray();
-
-    		if (messages.length > 0) {
-				for (int i = 0; i < messages.length; i++) {
-					jsonUidList.put(i, folder.getUID(messages[i]));
-				}
-    		}
-
-    		jsonFolderObj.put("uidList", jsonUidList);
-    		*/
-    		
     		folder.close(false);
 
-    		Date endTimer = new Date();
-
-    		int elapsedSeconds = 
-    			((endTimer.getMinutes() * 60) + endTimer.getSeconds()) - 
-    			((startTimer.getMinutes() * 60) + startTimer.getSeconds());
-    		
-    		System.out.println("get jsonfolder[" + folder.getFullName() + "] with messages[" + messages.length + "] took " + elapsedSeconds + " seconds");
-    		//System.out.println("get jsonfolder[" + folder.getFullName() + "] took " + elapsedSeconds + " seconds");
-    		
     		return jsonFolderObj;
     	}
 
     	return null;
     }
 
     public String getJsonFolders() throws MessagingException {
-
-    	// Get folder listing
-
 		List folders = getFolders();
 
-		// Create json object
-
 		JSONObject jsonObj = new JSONObject();
 		JSONArray jsonArray = new JSONArray();
 
-		// Loop through all folders
-
 		for (int i = 0; i < folders.size() ; i++) {
 			IMAPFolder folder = (IMAPFolder)folders.get(i);
 
@@ -366,8 +307,6 @@
     		IMAPFolder folder, Message message, boolean isSummary)
     	throws MessagingException {
 
-		Date startTimer = new Date();
-
 		String read = "read";
 
 		if (!message.isSet(Flags.Flag.SEEN)) {
@@ -377,48 +316,35 @@
 		SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm");
 		String date = format.format(message.getSentDate());
 
-		// create json object
-
 		JSONObject jsonObj = new JSONObject();
 
 		JSONUtil.put(jsonObj, "date", date);
 		JSONUtil.put(jsonObj, "from", getAddressesAsString(message.getFrom()));
 		JSONUtil.put(jsonObj, "hasAttachment", false);
 		JSONUtil.put(jsonObj, "isHtml", "undetermined");
-		JSONUtil.put(jsonObj, "msgNum", String.valueOf(message.getMessageNumber()));
+		JSONUtil.put(
+			jsonObj, "msgNum", String.valueOf(message.getMessageNumber()));
 		JSONUtil.put(jsonObj, "read", read);
 		JSONUtil.put(jsonObj, "subject", message.getSubject());
 		JSONUtil.put(jsonObj, "uid", folder.getUID(message));
 
 		if (isSummary) {
-			//JSONUtil.put(jsonObj, "bodyPreview", _getContentPreview("", message));
-			
+			//JSONUtil.put(
+			//	jsonObj, "bodyPreview", getContentPreview("", message));
+
 			JSONUtil.put(jsonObj, "bodyPreview", StringPool.BLANK);
 		}
 		else {
 			JSONUtil.put(jsonObj, "bcc",
 				getAddressesAsString(message.getRecipients(RecipientType.BCC)));
 			JSONUtil.put(jsonObj, "body",
-				_getContent("", "", message, false));
+				getContent("", "", message, false));
 			JSONUtil.put(jsonObj, "cc",
 				getAddressesAsString(message.getRecipients(RecipientType.CC)));
 			JSONUtil.put(jsonObj, "to",
 				getAddressesAsString(message.getRecipients(RecipientType.TO)));
 		}
 
-		Date endTimer = new Date();
-
-		int elapsedSeconds = 
-			((endTimer.getMinutes() * 60) + endTimer.getSeconds()) - 
-			((startTimer.getMinutes() * 60) + startTimer.getSeconds());
-
-		if (isSummary) {
-			System.out.println("get jsonmessage[" + folder.getUID(message) + "] SUMMARY took " + elapsedSeconds + " seconds");
-		}
-		else {
-			System.out.println("get jsonmessage[" + folder.getUID(message) + "] took " + elapsedSeconds + " seconds");
-		}
-
 		return jsonObj;
     }
 
@@ -443,10 +369,10 @@
     }
 
     public String getJsonMessages(
-    		IMAPFolder folder, String messageNumsToGet, 
+    		IMAPFolder folder, String messageNumsToGet,
     		String messageUidsToExclude)
     	throws MessagingException {
-    	
+
     	int[] msgNums = GetterUtil.getIntegerValues(
 			messageNumsToGet.split("\\s*,\\s*"));
 
@@ -460,9 +386,9 @@
     		for (int i = 0; i < msgNums.length; i++) {
     			Message message = folder.getMessage(msgNums[i]);
     			long msgUid = folder.getUID(message);
-    			
+
     			// Skip message if it is in the exclude list
-    			
+
     			if (msgUids.length != 0) {
     				for (int j = 0; j < msgUids.length; j++) {
     					if (msgUid == msgUids[j]) {
@@ -475,14 +401,15 @@
 									_log.warn(jsone, jsone);
 								}
 							}
-    						
+
     						continue;
     					}
     				}
     			}
-    			
+
 				try {
-					jsonArray.put((int)msgUid, getJsonMessage(folder, message, true));
+					jsonArray.put(
+						(int)msgUid, getJsonMessage(folder, message, true));
 				}
 				catch (JSONException jsone) {
 					if (_log.isWarnEnabled()) {
@@ -496,9 +423,9 @@
 
 		return jsonObj.toString();
     }
-    
+
     public String getJsonMessages(
-    		IMAPFolder folder, int pageNum, int messagesPerPage, 
+    		IMAPFolder folder, int pageNum, int messagesPerPage,
     		String messageUidsToExclude)
     	throws MessagingException {
 
@@ -512,10 +439,10 @@
 		}
 
 		double totalPages = Math.ceil((double)totalMessages / messagesPerPage);
-		
+
     	int[] messageUids = GetterUtil.getIntegerValues(
 			messageUidsToExclude.split("\\s*,\\s*"));
-		
+
 		// Create Json object
 
 		JSONObject jsonObj = new JSONObject();
@@ -537,19 +464,19 @@
 		for (int i = messages.length - 1; i >= 0 ; i--) {
 			Message message = messages[i];
 			long messageUid = folder.getUID(message);
-			
+
 			// Skip message if it is in the exclude list
-			
+
 //			if (messageUids.length != 0) {
 //				for (int j = 0; j < messageUids.length; j++) {
 //					if (messageUid == messageUids[j])  {
 //						continue;
 //					}
 //				}
 //			}
-			
+
 			// Otherwise, add to list
-			
+
 			jsonArray.put(getJsonMessage(folder, message, true));
 		}
 
@@ -563,10 +490,8 @@
     		String searchString)
     	throws Exception {
 
-    	SearchTerm st = _getSearchTerm(searchString);
+    	SearchTerm st = getSearchTerm(searchString);
 
-    	// TODO: cache search results for better performance
-
 		Message[] messages = folder.search(st);
 
 		int totalMessages = messages.length;
@@ -593,7 +518,7 @@
 
 		// Convert all messages into Json Objects
 
-		for (int i = firstIndexInclusive; i <= lastIndexInclusive; i++) {	
+		for (int i = firstIndexInclusive; i <= lastIndexInclusive; i++) {
 			Message message = messages[i];
 
 			jsonArray.put(getJsonMessage(folder, message, true));
@@ -652,31 +577,23 @@
 
 			folder.close(true);
 		}
-		catch (MessagingException ex) {
-		    System.out.println(ex.getMessage());
+		catch (MessagingException me) {
+			_log.error(me.getMessage());
         }
 	}
 
-    /**
-     * Gets the specified folder (opened)
-     *
-     * @param folderName
-     * @return
-     * @throws Exception
-     */
     public Folder openFolder(String folderName) throws MessagingException {
+		Folder folder = getStore().getDefaultFolder();
 
-        // Open the Folder
-        Folder folder = _getStore().getDefaultFolder();
-
         folder = folder.getFolder(folderName);
 
         if (folder == null) {
             return null;
         }
 
-        // try to open read/write and if that fails try read-only
-        try {
+        // Try to open read/write and if that fails try read-only
+
+		try {
             folder.open(Folder.READ_WRITE);
         }
         catch (MessagingException ex) {
@@ -694,7 +611,7 @@
 
 		// Create the message to forward
 
-		Message forward = new MimeMessage(_getSession());
+		Message forward = new MimeMessage(getSession());
 
 		// Create multi-part to combine the parts
 
@@ -711,7 +628,7 @@
 
 		mp.addBodyPart(messageBodyPart);
 
-    	_send(forward, fromAccountId, recipientsTo, recipientsCc, recipientsBcc,
+    	send(forward, fromAccountId, recipientsTo, recipientsCc, recipientsBcc,
     		subject, content, mp);
     }
 
@@ -722,9 +639,9 @@
 
     	// Instantiate a message
 
-		Message msg = new MimeMessage(_getSession());
+		Message msg = new MimeMessage(getSession());
 
-    	_send(msg, fromAccountId, recipientsTo, recipientsCc, recipientsBcc,
+    	send(msg, fromAccountId, recipientsTo, recipientsCc, recipientsBcc,
     		subject, content, mp);
     }
 
@@ -736,18 +653,18 @@
 
     	MimeMessage reply = (MimeMessage)msg.reply(false);
 
-    	_send(reply, fromAccountId, recipientsTo, recipientsCc, recipientsBcc,
+    	send(reply, fromAccountId, recipientsTo, recipientsCc, recipientsBcc,
     		subject, content, mp);
     }
 
-	private String _getContent(
-			String messageContent, String contentPath, Part messagePart, 
+	protected String getContent(
+			String messageContent, String contentPath, Part messagePart,
 			boolean isPreview)
 		throws MessagingException {
 
 		try {
 			String contentType = messagePart.getContentType().toLowerCase();
-			
+
 			if (messagePart.getContent() instanceof Multipart) {
 				Multipart multipart = (Multipart)messagePart.getContent();
 
@@ -770,7 +687,7 @@
 							// Only get content preview if there is none
 
 							if (messageContent.equals(StringPool.BLANK)) {
-								messageContent = _getContent(
+								messageContent = getContent(
 									messageContent, "", curPart, isPreview);
 							}
 
@@ -782,7 +699,7 @@
 						if (partContentType.startsWith(
 								ContentTypes.TEXT_HTML)) {
 
-							messageContent = _getContent(
+							messageContent = getContent(
 								messageContent, "", curPart, isPreview);
 
 							break;
@@ -796,7 +713,7 @@
 					for (int i = 0; i < multipart.getCount(); i++) {
 						Part curPart = multipart.getBodyPart(i);
 
-						messageContent = _getContent(
+						messageContent = getContent(
 							messageContent, contentPath + StringPool.PERIOD + i,
 							curPart, isPreview);
 					}
@@ -813,7 +730,7 @@
 				else if (contentType.startsWith(ContentTypes.TEXT_HTML)) {
 					if (isPreview) {
 						messageContent +=
-							_stripHtml((String)messagePart.getContent()) +
+							stripHtml((String)messagePart.getContent()) +
 							"<HR/>";
 					}
 					else {
@@ -823,13 +740,13 @@
 				}
 				else if (contentType.startsWith(ContentTypes.MESSAGE_RFC822)) {
 					messageContent +=
-						_getContent(
+						getContent(
 							messageContent, "", messagePart, isPreview);
 
 					/*
 					MailContent subContent = new MailContent();
 
-					mailMessage = _getContent(
+					mailMessage = getContent(
 						(Part)messagePart.getContent(), mailMessage, subContent,
 						contentPath + StringPool.PERIOD + 0);
 
@@ -844,29 +761,27 @@
 				// Attachment (ignore)
 
 				contentPath = contentPath + ".attachment";
-				
-				messageContent += "<HR><a href=\"" + contentPath + "\">" + 
+
+				messageContent += "<HR><a href=\"" + contentPath + "\">" +
 					messagePart.getFileName() + "</a>";
 
 				//mailMessage.appendRemoteAttachment(
-				//	_getRemoteAttachment(
+				//	getRemoteAttachment(
 				//		messagePart, contentPath + StringPool.PERIOD + -1));
 			}
 
 		}
 		catch (IOException ioe) {
 			_log.error(ioe.getMessage());
-
-			//throw new MessagingException(ioe);
 		}
 
 		return messageContent;
 	}
 
-    private String _getContentPreview(String messageContent, Part messagePart)
+	protected String getContentPreview(String messageContent, Part messagePart)
 		throws MessagingException {
 
-		String fullContent = _getContent(messageContent, "", 
+		String fullContent = getContent(messageContent, "",
 			messagePart, true);
 
 		if (fullContent.length() > 80) {
@@ -876,11 +791,7 @@
 		return fullContent;
 	}
 
-	/**
-	 * Manually set the incoming connection settings
-	 *
-	 */
-	private void _getIncomingStore(MailAccount mailAccount) {
+	protected void getIncomingStore(MailAccount mailAccount) {
 		try {
 			Properties props = new Properties();
 
@@ -910,7 +821,7 @@
 			}
 
 			store.connect();
-			_setStore(store);
+			setStore(store);
 		}
 		catch (MessagingException ex) {
 			if (_log.isErrorEnabled()) {
@@ -919,44 +830,37 @@
         }
 	}
 
-	private Part _getMessagePart(Part part, String contentPath)
+	protected Part getMessagePart(Part part, String contentPath)
 		throws MessagingException {
-	
+
 		int index = GetterUtil.getInteger(
 			StringUtil.split(contentPath.substring(1), StringPool.PERIOD)[0]);
-	
+
 		try {
 			if (part.getContent() instanceof Multipart) {
 				String prefix = String.valueOf(index) + StringPool.PERIOD;
-		
+
 				Multipart multipart = (Multipart)part.getContent();
-		
+
 				for (int i = 0; i < multipart.getCount(); i++) {
 					if (index == i) {
-						return _getMessagePart(
+						return getMessagePart(
 							multipart.getBodyPart(i),
 							contentPath.substring(prefix.length()));
 					}
 				}
 			}
-		
+
 			return part;
 		}
 		catch (IOException ioe) {
 			_log.error(ioe.getMessage());
-			
+
 			return null;
 		}
 	}
-	
-	/**
-	 * Manually set the outgoing connection settings
-	 *
-	 */
-	private Session _getOutgoingSession(MailAccount mailAccount) {
 
-		// Properties
-
+	protected Session getOutgoingSession(MailAccount mailAccount) {
 		Properties props = new Properties();
 		props.put("mail.smtp.host", mailAccount.getMailOutHostName());
 		props.put("mail.smtp.port", mailAccount.getMailOutPort());
@@ -980,12 +884,7 @@
 		return session;
 	}
 
-	/**
-	 * Returns a SearchTerm which requires that all terms in searchString
-	 * must appear in the email
-	 */
-	private SearchTerm _getSearchTerm(String searchString) {
-
+	protected SearchTerm getSearchTerm(String searchString) {
 		String searchStrings[] = searchString.split("\\s");
 
 		SearchTerm[] allOrTerms = new OrTerm[searchStrings.length];
@@ -1011,23 +910,23 @@
 		return new AndTerm(allOrTerms);
 	}
 
-    private Session _getSession() {
+	protected Session getSession() {
 		if (_session == null) {
-			_session = _getOutgoingSession(_defaultMailAccount);
+			_session = getOutgoingSession(_defaultMailAccount);
 		}
 
 		return _session;
 	}
 
-    private Store _getStore() {
+    protected Store getStore() {
 		if (_store == null) {
-			_getIncomingStore(_defaultMailAccount);
+			getIncomingStore(_defaultMailAccount);
 		}
 
 		return _store;
 	}
 
-	private static void _getFolders(List list, Folder[] folders) {
+    protected static void getFolders(List list, Folder[] folders) {
 		for (int i = 0; i < folders.length; i++) {
 			Folder folder = folders[i];
 
@@ -1039,7 +938,7 @@
 				}
 
 				if ((folderType & IMAPFolder.HOLDS_FOLDERS) != 0) {
-					_getFolders(list, folder.list());
+					getFolders(list, folder.list());
 				}
 			}
 			catch (MessagingException me) {
@@ -1048,15 +947,15 @@
 		}
 	}
 
-	private void _send(
+	protected void send(
 			Message msg, int fromAccountId, String recipientsTo,
 			String recipientsCc, String recipientsBcc, String subject,
 			String content, Multipart mp)
 		throws MessagingException {
 
 		MailAccount fromMailAccount = new MailAccount(_user, fromAccountId);
 
-		//Set message attributes
+		// Set message attributes
 
 		msg.setFrom(new InternetAddress(fromMailAccount.getEmailAddress()));
 
@@ -1083,20 +982,22 @@
 
 		if (mp != null) {
 			// Add attachment
+
 			msg.setContent(mp);
 		}
 		else {
 			// Set message content
+
 			msg.setText(content);
 		}
 
 		// Resets the header to reflect changes
 
 		msg.saveChanges();
 
-		//Send the message
+		// Send the message
 
-		Transport t = _getOutgoingSession(fromMailAccount).getTransport("smtp");
+		Transport t = getOutgoingSession(fromMailAccount).getTransport("smtp");
 		try {
 			t.connect(
 				fromMailAccount.getUsername(), fromMailAccount.getPassword());
@@ -1107,11 +1008,11 @@
 		}
 	}
 
-	private void _setStore(Store store) {
+	protected void setStore(Store store) {
 		this._store = store;
 	}
 
-	private static String _stripHtml(String html) {
+	protected String stripHtml(String html) {
 		html = html.replaceAll( "<[^>]+>", StringPool.BLANK);
 		html = html.replaceAll( "[\r\n]+", StringPool.BLANK);
 
@@ -1120,4 +1021,9 @@
 
 	private static Log _log = LogFactory.getLog(MailBoxManager.class);
 
+	private MailAccount _defaultMailAccount;
+    private Session _session = null;
+    private Store _store = null;
+	private User _user;
+
 }
\ No newline at end of file
分享到:
评论

相关推荐

    liferay JSON Web服务接口调用示例.docx

    在Liferay中,JSON Web服务提供了灵活的方式来交互和操作平台数据。这些服务允许开发者通过不同的方式调用,包括JavaScript、curl命令以及直接通过URL。以下是对这两种主要使用场景的详细说明: 1. **在Portlet中...

    struts2_spring_json.rar_liferay struts2 json_portlet json_spring

    在标题和描述中提到的"struts2_spring_json.rar"是一个关于如何在Liferay中利用Struts2和Spring框架处理JSON数据的示例应用。 JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,常用于前后端交互,...

    Liferay 6 入门教程

    最后,"plugins开发指南19-liferay6中使用JSON.pdf"解释了如何利用JSON进行数据交换,提高应用程序的响应速度和效率。 通过学习这些教程,开发者不仅可以掌握Liferay 6的基础知识,还能深入了解其插件开发、MVC架构...

    simple-oauth-consumer

    该项目演示了如何使用受 Liferay OAuth Provider Plugin 保护的 Liferay JSON WS 服务。 从将 OAuth Provider 安装到您的 Liferay 从构建和部署 liferay-rest-consumer 从构建和部署 simple-jersey 在控制面板的...

    Liferay Mobile SDK

    然而,随着JSON格式在Web服务中的广泛应用,Liferay开始重构其远程服务,引入了基于JSON的远程服务(JSONWS),使得开发者可以更加灵活地调用Liferay提供的各种服务。 ##### 2.2 2014年:Liferay Mobile SDK API ...

    angular-portlet:展示如何在门户环境中使用 AngularJS 的示例 Portlet

    在 AngularJS 中使用 Liferay JSON 服务 如何引用部分 HTML 文件(创建正确的 portlet 资源 URL) AngularJS 中的 Portlet 事件集成 i18n 通过使用 Liferay 和 portlet 资源包的 angular-translate 使用 portlet ...

    liferay一个简单的portlet

    - **RESTful服务**:创建Portlet API,以JSON或其他格式暴露数据,供其他应用或Portlets调用。 总之,理解并掌握Liferay Portlet的开发是构建强大门户系统的关键。通过实践和不断探索,开发者可以充分利用Liferay...

    liferay天气插件

    这些API通常提供JSON或XML格式的天气信息,包括温度、湿度、风速、天气状况等。 3. **前端展示**:天气插件的用户界面可能是用HTML、CSS和JavaScript构建的,它会根据从API获取的数据动态更新。可能有图表、图标或...

    前端开源库-eslint-config-liferay

    **前端开源库-eslint-config-liferay** 是一个专为Liferay框架设计的JavaScript代码风格检查工具,基于ESLint的可共享配置。ESLint是一款强大的静态代码分析工具,它可以帮助开发者发现并修复代码中的潜在问题,遵循...

    liferay单点登录等

    标题和描述概述的知识点主要集中在Liferay的单点登录(Single Sign-On,SSO)、WebService、JSON API以及系统集成方面。下面将详细展开这些知识点,包括它们的基本概念、实现方式和应用场景。 ### 单点登录(SSO)...

    liferay6.0.5在ie6ie7操作布局等功能时的js错误解决方法和补丁包

    例如,它可能使用了未经IE6/IE7支持的CSS3属性或者高级JavaScript功能,如Array.forEach()、JSON对象等。 解决这些问题的方法通常包括以下步骤: 1. **更新浏览器**:尽管这是一个不理想的解决方案,但升级到更...

    Liferay Soy Portlet可视化数据

    2. 解析返回的数据,可能是JSON或XML格式,使用Jackson或Gson解析JSON,JAXB处理XML。 3. 将解析后的数据封装成Java对象,方便在Soy模板中使用。 在前端,Soy模板会根据Java后台传递的数据渲染界面。可能包含各种...

    基于serverResource方式的liferay中ajax方式的的实现

    在IT行业中,Liferay是一款广泛使用的开源企业级门户平台,它允许开发者构建、集成和管理各种Web应用程序。本文将深入探讨“基于serverResource方式的Liferay中Ajax方式的实现”,结合提供的标签“源码”和“工具”...

    LiferayPortal二次开发指南破解版.pdf

    Response 对象用于向客户端发送响应数据,包括 HTML 页面、JSON 数据等。 ##### 3.3.3 PortletConfig 对象 PortletConfig 对象提供了关于 Portlet 的配置信息,包括 Portlet 的名字、初始化参数等。 ##### 3.3.4 ...

    BeaconHeat-portlet:一个 Liferay 插件,包含一个 JSON Web 服务和三个用于可视化 Beacon 数据的 portlet

    Liferay 博物馆热图 iBeacon 演示该项目是 Liferay 的演示应用程序,包括用于注册博物馆访问的 JSON Web 服务和用于可视化访问数据的 3 个 portlet。 它被用作 2015 年研讨会系列的一部分。作者 James Falkner...

    java8看不到源码-elasticsearch-docker-composer-for-liferay-7::magnifying_glass_tilted_left:Elasticsearch和K

    java8 看不到源码elasticsearch-docker-composer-for-liferay-7 这是用于设置 docker-composer 以针对 Liferay 7.3 GA1 / DXP ...Liferay ...打开index-settings.json并将其...打开liferay-type-mappings.json并将其粘贴到

    liferayPortal

    - JSON:一种轻量级的数据交换格式。 - Hessian:一种高效的远程过程调用协议。 - Burlap:一种轻量级的RPC框架。 - REST:一种基于HTTP的Web服务架构风格。 - RMI:Java远程方法调用。 - Spring HTTP:基于Spring...

    liferay-user-associations-core-bc-module-community-hook-1.1.zip

    5. **数据序列化/反序列化**:在客户端与服务器之间传输数据时,JSON或XML是最常见的格式。Java提供了Gson、Jackson或JAXB等库来处理这些格式,将对象转换为可传输的字符串,反之亦然。 6. **开源文化与协作**:...

    liferay-grunt:我在当前 Liferay 6.2 项目中使用的 grunt 构建文件示例。 包括主题目录同步、SVG spriting、cachebreaker 等

    将 gruntfile 和 package.json 文件复制到主题目录的 src 根目录。 输入“npm 安装” 输入“咕噜” 如果使用“grunt watch”任务,请编辑 tomcatTheme 目录以指向 Tomcat 中的主题目录 我们将它与 Maven 前端...

Global site tag (gtag.js) - Google Analytics