Java Code Examples for com.google.gwt.user.client.Cookies#getCookie()

The following examples show how to use com.google.gwt.user.client.Cookies#getCookie() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WaveWebSocketClient.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
@Override
public void onConnect() {
  connected = ConnectState.CONNECTED;
  connectedAtLeastOnce = true;

  // Sends the session cookie to the server via an RPC to work around browser bugs.
  // See: http://code.google.com/p/wave-protocol/issues/detail?id=119
  String token = Cookies.getCookie(JETTY_SESSION_TOKEN_NAME);
  if (token != null) {
    ProtocolAuthenticateJsoImpl auth = ProtocolAuthenticateJsoImpl.create();
    auth.setToken(token);
    send(MessageWrapper.create(sequenceNo++, "ProtocolAuthenticate", auth));
  }

  // Flush queued messages.
  while (!messages.isEmpty() && connected == ConnectState.CONNECTED) {
    send(messages.poll());
  }

  ClientEvents.get().fireEvent(new NetworkStatusEvent(ConnectionStatus.CONNECTED));
}
 
Example 2
Source File: UniTimeSideBar.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void restoreState() {
	Set<String> nodes = new HashSet<String>();
	String sideBarCookie = Cookies.getCookie("UniTime:SideBar");
	if (sideBarCookie != null)
		for (String node: sideBarCookie.split("\\|"))
			nodes.add(node);
	iDisclosurePanel.setOpen(nodes.contains("Root") || sideBarCookie == null);
	if (iUseStackPanel)
		for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
			if (nodes.contains(iStackPanel.getStackText(i))) {
				iStackPanel.showStack(i);
			}
			if (iStackPanel.getWidget(i) instanceof Tree) {
				Tree t = (Tree)iStackPanel.getWidget(i);
				for (int j = 0; j < t.getItemCount(); j++) {
					openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
				}
			}
		}
	else
		for (int i = 0; i < iTree.getItemCount(); i++) {
			openNodes(nodes, iTree.getItem(i), null);
		}
}
 
Example 3
Source File: UniTimeMobileMenu.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void restoreState() {
	Set<String> nodes = new HashSet<String>();
	String sideBarCookie = Cookies.getCookie("UniTime:MobileMenu");
	if (sideBarCookie != null)
		for (String node: sideBarCookie.split("\\|"))
			nodes.add(node);
	for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
		if (nodes.contains(iStackPanel.getStackText(i))) {
			iStackPanel.showStack(i);
		}
		if (iStackPanel.getWidget(i) instanceof Tree) {
			Tree t = (Tree)iStackPanel.getWidget(i);
			for (int j = 0; j < t.getItemCount(); j++) {
				openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
			}
		}
	}
}
 
Example 4
Source File: InstructorCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private InstructorCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Instructor");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iSortAttributesBy = Integer.valueOf(params[idx++]);
			iSortInstructorsBy = Integer.valueOf(params[idx++]);
			iSortTeachingRequestsBy = new int[] {Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++])};
			iTeachingRequestsColumns = new int[] {Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++])};
			iSortTeachingAssignmentsBy = Integer.valueOf(params[idx++]);
			iTeachingAssignmentsColumns = Integer.valueOf(params[idx++]);
			iAssignmentChangesBase = Integer.valueOf(params[idx++]);
			iSortAssignmentChangesBy = Integer.valueOf(params[idx++]);
			iAssignmentChangesColumns = Integer.valueOf(params[idx++]);
			iShowTeachingRequests = "T".equals(params[idx++]);
			iShowTeachingAssignments = "T".equals(params[idx++]);
			iQuery = new String[] {params[idx++], params[idx++], params[idx++]};
		}
	} catch (Exception e) {
	}
}
 
Example 5
Source File: SectioningStatusCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private SectioningStatusCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:StudentStatus");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iOnlineTab = Integer.parseInt(params[idx++]);
			iOnlineQuery = params[idx++];
			iBashTab = Integer.parseInt(params[idx++]);
			iBashQuery = params[idx++];
			for (int i = 0; i < iSortBy.length; i++)
				iSortBy[i] = Integer.parseInt(params[idx++]);
			iStudentTab = Integer.parseInt(params[idx++]);
			iSortByGroup[0] = params[idx++];
			iSortByGroup[1] = params[idx++];
			iEmailIncludeCourseRequests = "1".equals(params[idx++]);
			iEmailIncludeClassSchedule = "1".equals(params[idx++]);
			iEmailCC = params[idx++];
			iEmailSubject = params[idx++];
			iEmailAdvisorRequests = "1".equals(params[idx++]);
			iAdvisorRequestsEmailStudent = "1".equals(params[idx++]);
			iOptionalEmailToggle = parseBoolean(params[idx++]);
		}
	} catch (Exception e) {
	}
}
 
Example 6
Source File: CurriculumCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private CurriculumCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Curriculum");
		if (cookie != null && cookie.length() > 0) {
			String[] values = cookie.split(":");
			iType = CourseCurriculaTable.Type.valueOf(values[0]);
			iMode = CurriculaCourses.Mode.valueOf(values[1]);
			iPercent = "T".equals(values[2]);
			iRulesPercent = "T".equals(values[3]);
			iRulesShowLastLike = "T".equals(values[4]);
			iCourseDetails = "T".equals(values[5]);
			iCurMode.fromString(values[6]);
			iShowLast = !"F".equals(values[7]);
			iShowProjected = !"F".equals(values[8]);
			iShowExpected = !"F".equals(values[9]);
			iShowEnrolled = !"F".equals(values[10]);
			iShowRequested = "T".equals(values[11]);
			iShowSnapshotExpected = !"T".equals(values[12]);
			iShowSnapshotProjected = !"T".equals(values[13]);
			iSortBy = Integer.parseInt(values[14]);
		}
	} catch (Exception e) {
	}
}
 
Example 7
Source File: WaveWebSocketClient.java    From swellrt with Apache License 2.0 6 votes vote down vote up
@Override
public void onConnect() {
  connected = ConnectState.CONNECTED;
  connectedAtLeastOnce = true;

  // Sends the session cookie to the server via an RPC to work around browser bugs.
  // See: http://code.google.com/p/wave-protocol/issues/detail?id=119
  String token = Cookies.getCookie(JETTY_SESSION_TOKEN_NAME);
  if (token != null) {
    ProtocolAuthenticateJsoImpl auth = ProtocolAuthenticateJsoImpl.create();
    auth.setToken(token);
    send(MessageWrapper.create(sequenceNo++, "ProtocolAuthenticate", auth));
  }

  // Flush queued messages.
  while (!messages.isEmpty() && connected == ConnectState.CONNECTED) {
    send(messages.poll());
  }

  ClientEvents.get().fireEvent(new NetworkStatusEvent(ConnectionStatus.CONNECTED));
}
 
Example 8
Source File: SectioningCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private SectioningCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Sectioning");
		if (cookie != null && cookie.length() > 0) {
			String[] values = cookie.split(":");
			iCourseDetails = "T".equals(values[0]);
			iShowClassNumbers = "T".equals(values.length >= 2 ? values[1] : "F");
			iRelatedSortBy = Integer.parseInt(values[2]);
			iEnrollmentFilter = EnrollmentFilter.values()[Integer.parseInt(values[3])];
			iEnrollmentSortBy = Integer.parseInt(values[4]);
			iEnrollmentSortBySubpart = values[5];
			iAllChoices = "T".equals(values[6]);
			iShowAllChanges = "T".equals(values[7]);
			iRequestOverridesOpened = "T".equals(values[8]);
			iSolutionsSortBy = Integer.parseInt(values[9]);
			iEnrollmentSortByGroup = values[10];
		}
	} catch (Exception e) {
	}
}
 
Example 9
Source File: EventCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private EventCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Event");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iFlags = Integer.parseInt(params[idx++]);
			iShowDeltedMeetings = "T".equals(params[idx++]);
			iSortRoomsBy = Integer.valueOf(params[idx++]);
			iRoomsHorizontal = !"F".equals(params[idx++]);
			iExpandRoomConflicts = "T".equals(params[idx++]);
			iAutomaticallyApproveNewMeetings = "T".equals(params[idx++]);
			iHideDuplicitiesForMeetings = "T".equals(params[idx++]);
			while (idx < params.length) {
				String hash = params[idx++];
				int colon = hash.indexOf(':');
				iHash.put(hash.substring(0, colon), hash.substring(colon + 1));
			}
		}
	} catch (Exception e) {
	}
}
 
Example 10
Source File: ReservationCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private ReservationCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Reservations");
		if (cookie != null && cookie.length() > 0) {
			String[] values = cookie.split(":");
			iCourseDetails = "T".equals(values[0]);
			iSortBy = Integer.valueOf(values[1]);
		}
	} catch (Exception e) {
	}
}
 
Example 11
Source File: FilterBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
private CarrotCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:FilterCarrots");
		if (cookie != null)
			for (String cmd: cookie.split("\\|"))
				iCommands.add(cmd);
	} catch (Exception e) {
	}
}
 
Example 12
Source File: SolverCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private SolverCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Solver");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iLogLevel = Integer.valueOf(params[idx++]);
			iTimeGridFilter = "1".equals(params[idx++]);
			iAssignedClassesFilter = "1".equals(params[idx++]);
			iAssignedClassesSort = Integer.parseInt(params[idx++]);
			iNotAssignedClassesFilter = "1".equals(params[idx++]);
			iNotAssignedClassesSort = Integer.parseInt(params[idx++]);
			iSelectedAssignmentsSort = Integer.parseInt(params[idx++]);
			iConflictingAssignmentsSort = Integer.parseInt(params[idx++]);
			iSuggestionsSort = Integer.parseInt(params[idx++]);
			iPlacementsSort = Integer.parseInt(params[idx++]);
			iShowSuggestions = "1".equals(params[idx++]);
			iShowConflicts = "1".equals(params[idx++]);
			iConflictsSort = Integer.parseInt(params[idx++]);
			iShowAllStudentConflicts = "1".equals(params[idx++]);
			iShowAllDistributionConflicts = "1".equals(params[idx++]);
			iShowCBS = "1".equals(params[idx++]);
			iShowCBSFilter = "1".equals(params[idx++]);
			iSolutionChangesFilter = "1".equals(params[idx++]);
			iSolutionChangesSort = Integer.parseInt(params[idx++]);
			iAssignmentHistoryFilter = "1".equals(params[idx++]);
			iAssignmentHistorySort = Integer.parseInt(params[idx++]);
			iListSolutionsSort = Integer.parseInt(params[idx++]);
			iSuggestionsFilter = params[idx++];
		}
	} catch (Exception e) {}
}
 
Example 13
Source File: RoomCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private RoomCookie() {
	iFlags = new int[RoomsPageMode.values().length];
	iHash = new String[RoomsPageMode.values().length];
	for (int i = 0; i < iFlags.length; i++) {
		iFlags[i] = 0;
		iHash[i] = "";
	}
	try {
		String cookie = Cookies.getCookie("UniTime:Room");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iSortRoomsBy = Integer.valueOf(params[idx++]);
			iSortRoomGroupsBy = Integer.valueOf(params[idx++]);
			iSortRoomFeaturesBy = Integer.valueOf(params[idx++]);
			setOrientation(params[idx++]);
			iDeptMode = Integer.valueOf(params[idx++]);
			for (int i = 0; i < iFlags.length; i++) {
				iFlags[i] = Integer.parseInt(params[idx++]);
				iHash[i] = params[idx++];
			}
			while (idx < params.length) {
				String[] x = params[idx++].split(":");
				iFutures.put(Long.valueOf(x[0]), new Integer(x[1]));
			}
		}
	} catch (Exception e) {
	}
}
 
Example 14
Source File: AdminCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private AdminCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Admin");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iSortTasksBy = Integer.valueOf(params[idx++]);
			iSortTaskExecutionsBy = Integer.valueOf(params[idx++]);
		}
	} catch (Exception e) {
	}
}
 
Example 15
Source File: WalkthroughManager.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public static void unregister(String userName, String appName) {
    String value = Cookies.getCookie(userName);

    if (appName.equals(value)) {
        Cookies.removeCookie(userName);
    }
}
 
Example 16
Source File: WalkthroughManager.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public static boolean hasWalkthrough(String userName, String appName) {
    String value = Cookies.getCookie(userName);
    if (value != null && !value.isEmpty() && appName.equals(value)) {
        return false;
    }

    if (value == null) {
        register(userName, appName);
    }

    return true;
}
 
Example 17
Source File: GwtCookieModel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String getCookie(String name) {
  return Cookies.getCookie(name);
}
 
Example 18
Source File: Preferences.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static String get(Key key)
{
    return Cookies.getCookie(AS7_UI +key.getToken());
}
 
Example 19
Source File: ThemeManager.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
public static Color getColor() {
    if (Cookies.getCookie(COLOR) == null) {
        return Color.BLUE;
    }
    return Color.fromStyleName(Cookies.getCookie(COLOR));
}
 
Example 20
Source File: CookiesManager.java    From document-management-software with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Retrieve the failure of the last login
 * 
 * @return the failure reason
 */
public static String getFailure() {
	return Cookies.getCookie(COOKIE_FAILURE);
}