mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 17:50:56 +00:00
special handling for calendar link
This commit is contained in:
1 parent
2bcf6508ce
commit
ab0b6754e1
4 files changed
+53
-8
No files matched your search
@@ -0,0 +1,3 @@
|
||||
<body>
|
||||
Dummy file used to count calendar-based access to Solutions place
|
||||
</body>
|
||||
@@ -50,5 +50,6 @@ bin.includes = META-INF/,\
|
||||
SettingsDialog.css,\
|
||||
EmbeddedMapAndWindChart.css,\
|
||||
EmbeddedMapAndWindChart.html,\
|
||||
com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart/
|
||||
com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart/,\
|
||||
Calendar.html
|
||||
output.. = WEB-INF/classes/
|
||||
-3
@@ -46,14 +46,11 @@ public abstract class AbstractBasePlace extends Place {
|
||||
public AbstractBasePlace(String url) {
|
||||
if (url != null && !url.isEmpty()) {
|
||||
this.placeParametersAsToken = url;
|
||||
|
||||
List<String> list = Arrays.asList(placeParametersAsToken.split("&"));
|
||||
|
||||
if (list == null || list.size() < 1) {
|
||||
logger.warning("Token empty, no-op");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String listItem : list) {
|
||||
List<String> nvPair = Arrays.asList(listItem.split("="));
|
||||
if (nvPair == null || nvPair.size() != 2) {
|
||||
|
||||
+48
-4
@@ -1,5 +1,11 @@
|
||||
package com.sap.sailing.gwt.home.shared.places.solutions;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.http.client.Request;
|
||||
import com.google.gwt.http.client.RequestBuilder;
|
||||
import com.google.gwt.http.client.RequestCallback;
|
||||
import com.google.gwt.http.client.RequestException;
|
||||
import com.google.gwt.http.client.Response;
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
|
||||
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
|
||||
@@ -12,17 +18,55 @@ public class SolutionsPlace extends AbstractBasePlace implements HasLocationTitl
|
||||
SapInSailing, SailingAnalytics, RaceCommiteeApp, PostRaceAnalytics, TrainingDiary, SailingSimulator
|
||||
};
|
||||
private final SolutionsNavigationTabs navigationTab;
|
||||
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
|
||||
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
|
||||
private final static String CALENDAR_ACCESS_COUNT_URL = "/gwt/Calendar.html";
|
||||
private final boolean invokedFromCalendar;
|
||||
|
||||
public SolutionsPlace(String url) {
|
||||
super(url);
|
||||
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
|
||||
navigationTab = paramNavTab != null ? SolutionsNavigationTabs.valueOf(paramNavTab) : null;
|
||||
super(url.split("\\?")[0]); // if the fragment holds another "?" check if it's the "Calendar marker" c=1
|
||||
final String[] splitUrl = url.split("\\?");
|
||||
if (splitUrl.length > 1) {
|
||||
final String calendarMarker = splitUrl[1];
|
||||
invokedFromCalendar = calendarMarker.equals("c=1");
|
||||
} else {
|
||||
invokedFromCalendar = false;
|
||||
}
|
||||
if (invokedFromCalendar) {
|
||||
navigationTab = SolutionsNavigationTabs.SapInSailing;
|
||||
makeLoggedCountableCalendarRequest();
|
||||
} else {
|
||||
final String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
|
||||
navigationTab = paramNavTab != null ? SolutionsNavigationTabs.valueOf(paramNavTab) : null;
|
||||
}
|
||||
}
|
||||
|
||||
private void makeLoggedCountableCalendarRequest() {
|
||||
GWT.debugger();
|
||||
final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, CALENDAR_ACCESS_COUNT_URL);
|
||||
try {
|
||||
requestBuilder.sendRequest(/* requestData */ null, new RequestCallback() {
|
||||
@Override
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
// nothing to do; it's just to make calendar-based access server-countable
|
||||
String text = response.getText();
|
||||
GWT.log("Received "+text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Request request, Throwable exception) {
|
||||
// nothing to do; it's just to make calendar-based access server-countable; it failed...
|
||||
GWT.log("Warning: couldn't access calendar link counter", exception);
|
||||
}
|
||||
});
|
||||
} catch (RequestException e) {
|
||||
GWT.log("Warning: couldn't access calendar link counter", e);
|
||||
}
|
||||
}
|
||||
|
||||
public SolutionsPlace(SolutionsNavigationTabs navigationTab) {
|
||||
super(PARAM_NAVIGATION_TAB, navigationTab.name());
|
||||
this.navigationTab = navigationTab;
|
||||
this.invokedFromCalendar = false;
|
||||
}
|
||||
|
||||
public SolutionsNavigationTabs getNavigationTab() {
|
||||
|
||||
Reference in new issue
Block a user