<commit_before>package org.sagebionetworks.web.client;

import org.sagebionetworks.web.client.mvp.AppActivityMapper;
import org.sagebionetworks.web.client.mvp.AppPlaceHistoryMapper;
import org.sagebionetworks.web.client.widget.entity.registration.WidgetRegistrarImpl;

import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Portal implements EntryPoint {
	
	//  We are using gin to create all of our objects
	private final PortalGinInjector ginjector = GWT.create(PortalGinInjector.class);

	private SimplePanel appWidget = new SimplePanel();

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
	    EventBus eventBus = ginjector.getEventBus();
	    PlaceController placeController = new PlaceController(eventBus);
	    
		// Start ActivityManager for the main widget with our ActivityMapper
		AppActivityMapper activityMapper = new AppActivityMapper(ginjector, new SynapseJSNIUtilsImpl());
		ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
		activityManager.setDisplay(appWidget);
		
		// All pages get added to the root panel
		appWidget.addStyleName("rootPanel");

		// Start PlaceHistoryHandler with our PlaceHistoryMapper
		AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);		
		PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);		
		historyHandler.register(placeController, eventBus, activityMapper.getDefaultPlace());

		RootPanel.get("rootPanel").add(appWidget);

		GlobalApplicationState globalApplicationState = ginjector.getGlobalApplicationState();
	    globalApplicationState.setPlaceController(placeController);
	    globalApplicationState.setAppPlaceHistoryMapper(historyMapper);
	    globalApplicationState.setActivityMapper(activityMapper);

		
		// Goes to place represented on URL or default place
		historyHandler.handleCurrentHistory();
	}
}<commit_msg>reload if history token doesn't start with a bang.<commit_after>package org.sagebionetworks.web.client;

import org.sagebionetworks.web.client.mvp.AppActivityMapper;
import org.sagebionetworks.web.client.mvp.AppPlaceHistoryMapper;
import org.sagebionetworks.web.client.widget.entity.registration.WidgetRegistrarImpl;

import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Portal implements EntryPoint {
	
	//  We are using gin to create all of our objects
	private final PortalGinInjector ginjector = GWT.create(PortalGinInjector.class);

	private SimplePanel appWidget = new SimplePanel();

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		//we might need to reload using the new token scheme (required for SEO)
		String initToken = History.getToken();
		if (initToken.length() > 0 && !initToken.startsWith("!")) {
			String fullUrl = Window.Location.getHref();
			fullUrl = fullUrl.replace("#"+initToken, "#!"+initToken);
			Window.Location.replace(fullUrl);
			Window.Location.reload();
		} else {
			EventBus eventBus = ginjector.getEventBus();
		    PlaceController placeController = new PlaceController(eventBus);
		    
			// Start ActivityManager for the main widget with our ActivityMapper
			AppActivityMapper activityMapper = new AppActivityMapper(ginjector, new SynapseJSNIUtilsImpl());
			ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
			activityManager.setDisplay(appWidget);
			
			// All pages get added to the root panel
			appWidget.addStyleName("rootPanel");
	
			// Start PlaceHistoryHandler with our PlaceHistoryMapper
			AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);		
			PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);		
			historyHandler.register(placeController, eventBus, activityMapper.getDefaultPlace());
	
			RootPanel.get("rootPanel").add(appWidget);
	
			GlobalApplicationState globalApplicationState = ginjector.getGlobalApplicationState();
		    globalApplicationState.setPlaceController(placeController);
		    globalApplicationState.setAppPlaceHistoryMapper(historyMapper);
		    globalApplicationState.setActivityMapper(activityMapper);
	
			
			// Goes to place represented on URL or default place
		    historyHandler.handleCurrentHistory();
		}
	}
}
{'fraction_non_alphanumeric': 0.094408272692455, 'fraction_numerical': 0.00019149751053236308, 'mean_word_length': 5.354014598540146, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2010956', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1448, 'n_words': 309}