當前位置: 首頁>>代碼示例>>Java>>正文


Java Cookies.setCookie方法代碼示例

本文整理匯總了Java中com.google.gwt.user.client.Cookies.setCookie方法的典型用法代碼示例。如果您正苦於以下問題:Java Cookies.setCookie方法的具體用法?Java Cookies.setCookie怎麽用?Java Cookies.setCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.user.client.Cookies的用法示例。


在下文中一共展示了Cookies.setCookie方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = 
		(iType == null ? "" : iType.name()) + ":" +
		(iMode == null ? "" : iMode.name()) + ":" +
		(iPercent ? "T": "F") + ":" +
		(iRulesPercent ? "T" : "F") + ":" +
		(iRulesShowLastLike ? "T" : "F") + ":" +
		(iCourseDetails ? "T": "F") + ":" +
		iCurMode.toString() + ":" +
		(iShowLast ? "T" : "F") + ":" +
		(iShowProjected ? "T" : "F") + ":" +
		(iShowExpected ? "T" : "F") + ":" +
		(iShowEnrolled ? "T" : "F") + ":" +
		(iShowRequested ? "T" : "F") + ":" + 
		(iShowSnapshotExpected ? "T" : "F") + ":" +
		(iShowSnapshotProjected ? "T" : "F") + ":" +
		iSortBy;
		;
	Cookies.setCookie("UniTime:Curriculum", cookie);
}
 
開發者ID:UniTime,項目名稱:unitime,代碼行數:21,代碼來源:CurriculumCookie.java

示例2: saveState

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
public void saveState() {
	List<String> nodes = new ArrayList<String>();
	nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
	for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
		if (iStackPanel.getWidget(i) instanceof Tree) {
			Tree t = (Tree)iStackPanel.getWidget(i);
			for (int j = 0; j < t.getItemCount(); j++) {
				openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
			}
		}
	}
	String sideBarCookie = "";
	for (String node: nodes) {
		if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
		sideBarCookie += node;
	}
	Cookies.setCookie("UniTime:MobileMenu", sideBarCookie);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:19,代碼來源:UniTimeMobileMenu.java

示例3: setData

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void setData(String dataName, String data) {
	String oldData = getObjectString(dataName);
	if (oldData == null || !data.equals(oldData)) {
		String dataNamePath = buildPathString(dataName);
		try {
			if (dataStore != null) {
				dataStore.removeItem(dataNamePath);
				dataStore.setItem(dataNamePath, data);
			} else {
				Cookies.setCookie(dataNamePath, data, new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 365 * 100)));
			}
		} catch (Exception e) {}
		HandlerManager eventBus = ConsoleUnitEventManager.getInstance().getEventBus();
		BindingDataChangeEvent event = new BindingDataChangeEvent(dataName);
		eventBus.fireEvent(event);
	}
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:18,代碼來源:LocalDataServiceImpl.java

示例4: gotoUrl

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
public void gotoUrl(String url, boolean saveSearchPage) {
    if (doSaveState) {
        doSaveState = false;
        RequestHandler.Context context = saveSearchPage ? RequestHandler.Context.INCL_SEARCH : RequestHandler.Context.PAGE;
        String cState = null;
        try {
            cState = Application.getInstance().getRequestHandler().getStateInfo(context);
        } catch (Exception e) {
            GWT.log("error retrieving state info", e);
        }
        if (cState != null) {
            Cookies.setCookie(PRIOR_STATE, cState);
    }
    }
    if (url != null) {
        Window.Location.assign(url);
    }
}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:19,代碼來源:Application.java

示例5: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = iSortAttributesBy + "|" + iSortInstructorsBy +
			"|" + iSortTeachingRequestsBy[0] + "|" + iSortTeachingRequestsBy[1] + "|" + iSortTeachingRequestsBy[2] +
			"|" + iTeachingRequestsColumns[0] + "|" + iTeachingRequestsColumns[1] + "|" + iTeachingRequestsColumns[2] +
			"|" + iSortTeachingAssignmentsBy + "|" + iTeachingAssignmentsColumns +
			"|" + iAssignmentChangesBase + "|" + iSortAssignmentChangesBy + "|" + iAssignmentChangesColumns +
			"|" + (iShowTeachingRequests ? "T" : "F") +
			"|" + (iShowTeachingAssignments ? "T" : "F") +
			"|" + (iQuery[0] == null ? "" : iQuery[0]) + "|" + (iQuery[1] == null ? "" : iQuery[1]) + "|" + (iQuery[2] == null ? "" : iQuery[2]);
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:Instructor", cookie, expires);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:13,代碼來源:InstructorCookie.java

示例6: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = iSortRoomsBy + "|" + iSortRoomGroupsBy + "|" + iSortRoomFeaturesBy + "|" + getOrientation() + "|" + iDeptMode;
	for (int i = 0; i < iFlags.length; i++) {
		cookie += "|" + iFlags[i] + "|" + (iHash[i] == null ? "" : iHash[i]);
	}
	for (Map.Entry<Long, Integer> e: iFutures.entrySet()) {
		cookie += "|" + e.getKey() + ":" + e.getValue();
	}
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:Room", cookie, expires);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:12,代碼來源:RoomCookie.java

示例7: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = iLogLevel + "|" + (iTimeGridFilter ? "1" : "0")
			+ "|" + (iAssignedClassesFilter ? "1" : "0") + "|" + iAssignedClassesSort
			+ "|" + (iNotAssignedClassesFilter ? "1" : "0") + "|" + iNotAssignedClassesSort;
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:Solver", cookie, expires);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:8,代碼來源:SolverCookie.java

示例8: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = String.valueOf(iFlags) + 
			"|" + (iShowDeltedMeetings ? "T": "F") +
			"|" + iSortRoomsBy +
			"|" + (iRoomsHorizontal ? "T" : "F") +
			"|" + (iExpandRoomConflicts ? "T" : "F") +
			"|" + (iAutomaticallyApproveNewMeetings ? "T": "F") +
			"|" + (iHideDuplicitiesForMeetings ? "T" : "F");
	for (Map.Entry<String, String> entry: iHash.entrySet())
		cookie += "|" + entry.getKey() + ":" + entry.getValue();
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:Event", cookie, expires);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:14,代碼來源:EventCookie.java

示例9: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = iOnlineTab + "|" + iOnlineQuery + "|" + iBashTab + "|" + iBashQuery;
	for (int i = 0; i < iSortBy.length; i++)
		cookie += "|" + iSortBy[i];
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:StudentStatus", cookie, expires);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:8,代碼來源:SectioningStatusCookie.java

示例10: saveState

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
public void saveState() {
	List<String> nodes = new ArrayList<String>();
	if (iUseStackPanel) {
		nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
		for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
			if (iStackPanel.getWidget(i) instanceof Tree) {
				Tree t = (Tree)iStackPanel.getWidget(i);
				for (int j = 0; j < t.getItemCount(); j++) {
					openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
				}
			}
		}
	} else {
		for (int i = 0; i < iTree.getItemCount(); i++) {
			openedNodes(nodes, iTree.getItem(i), null);
		}
	}
	String sideBarCookie = "";
	if (iDisclosurePanel.isOpen()) sideBarCookie += "Root";
	for (String node: nodes) {
		if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
		sideBarCookie += node;
	}
	sideBarCookie += "|W:" + iPanel.getElement().getClientWidth();
	Cookies.setCookie("UniTime:SideBar", sideBarCookie);
	resizeWideTables();
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:28,代碼來源:UniTimeSideBar.java

示例11: setCookieValue

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
/**
 * Sets a cookie value with an expiry date a year from now.
 * @param key The name of the cookie to set.
 * @param value The new value for the cookie.
 */
@SuppressWarnings("deprecation") // Calendar not supported by GWT
public static void setCookieValue(String key, String value) {
  // Only set the cookie value if it is changing:
  if (value.equals(Cookies.getCookie(key))) {
    return;
  }

  // Set the cookie to expire in one year
  Date d = new Date();
  d.setYear(d.getYear() + 1);
  Cookies.setCookie(key, value, d);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:18,代碼來源:DomLogger.java

示例12: storeToCookies

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private static void storeToCookies( ) {
	if( ( userLoginName != null ) && ( userSessionId != null ) &&
			( userProfileType != MainUserData.UNKNOWN_USER_TYPE ) &&
			( userID != UserData.UNKNOWN_UID ) ) {
		Cookies.setCookie( USER_LOGIN_COOKIE_NAME, userLoginName );
		Cookies.setCookie( USER_SESSION_COOKIE_NAME, userSessionId );
		Cookies.setCookie( USER_ID_COOKIE_NAME, (new Integer(userID)).toString() );
		Cookies.setCookie( USER_PROFILE_TYPE_COOKIE_NAME, (new Integer(userProfileType)).toString() );
	}
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:11,代碼來源:SiteManager.java

示例13: createAsyncResponse

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
/**
 * @param input
 * @return
 */
private AsyncCallback<LoginResponse> createAsyncResponse (
		final LoginRequest input) {
	return new AsyncCallback<LoginResponse>() {

		@Override
		public void onSuccess (LoginResponse result) {
			if (result.status == StatusType.StatusTypeSuccess
					&& result.session != null) {
				session = result.session;
				Cookies.setCookie(COOKIE_KEY_ID, session.id.toString(),
						DateTimeHelper
								.millisFromNow(DateTimeHelper.MILLIS_PER_DAY
										* 365L * 20L));

				if (user() != null && user().lastLoggedIn == null) {
					user().lastLoggedIn = new Date();
				}
			}

			DefaultEventBus.get().fireEventFromSource(
					new LoginSuccess(input, result),
					SessionController.this);
		}

		@Override
		public void onFailure (Throwable caught) {
			DefaultEventBus.get().fireEventFromSource(
					new LoginFailure(input, caught),
					SessionController.this);
		}
	};
}
 
開發者ID:billy1380,項目名稱:blogwt,代碼行數:37,代碼來源:SessionController.java

示例14: save

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
	String cookie = (iShowDetails ? "T": "F") + ":" + iSortColumn + ":" + (iSortOrder ? "T": "F") + ":" + (iMultiSession ? "T" : "F");
	Cookies.setCookie("UniTime:LastChanges", cookie);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:5,代碼來源:RoomNoteChanges.java

示例15: onSuccess

import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
@Override
public void onSuccess(ServerTimeZoneResponse result) {
	sServerTimeZone = TimeZone.createTimeZone(result.toJsonString());
	Cookies.setCookie("UniTime:ServerTimeZone", result.toJsonString());
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:6,代碼來源:ServerDateTimeFormat.java


注:本文中的com.google.gwt.user.client.Cookies.setCookie方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。