Как я получаю событие щелчка меню
Я создал собственное меню, используязеркальный интерфейс
метод, созданный в менюMainServlet
public List makeDealMenu(String appBaseUrl) {
String dealMenuIconUrl = appBaseUrl + "static/images/deal_50.png";
MenuValue dealMenuValue = new MenuValue();
dealMenuValue.setDisplayName("DEAL");
dealMenuValue.setIconUrl(dealMenuIconUrl);
List dealMenuValueList = new ArrayList();
dealMenuValueList.add(dealMenuValue);
MenuItem dealMenuItem = new MenuItem();
dealMenuItem.setAction("CUSTOM");
dealMenuItem.setId("dealMenu");
dealMenuItem.setValues(dealMenuValueList);
List customMenuItemList = new ArrayList();
customMenuItemList.add(dealMenuItem);
return customMenuItemList;
}
ОтdoPost метод, который я вызываюMirrorClient
MirrorClient.insertSubscription(credential,
WebUtil.buildUrl(request, "/notify"), userId, "timeline");
ВMirrorClient определить метод}insertSubscription
public static Subscription insertSubscription(Credential credential,
String callbackUrl, String userId, String collection)
throws IOException {
LOG.info("Attempting to subscribe verify_token " + userId
+ " with callback " + callbackUrl);
callbackUrl = callbackUrl.replace("appspot.com", "Appspot.com");
Subscription subscription = new Subscription();
subscription.setCollection(collection);
subscription.setCallbackUrl(callbackUrl);
subscription.setUserToken(userId);
return getMirror(credential).subscriptions().insert(subscription)
.execute();
затем вNotifyServlet получить событие таким образом ..
JsonFactory jsonFactory = new JacksonFactory();
Notification notification = jsonFactory.fromString(notificationString,
Notification.class);
if (notification.getUserActions().contains(
new UserAction().setType("CUSTOM"))) {
String selectedCustomMenuItemId = notification.getItemId();
if ("dealMenu".equals(selectedCustomMenuItemId)) {
LOG.info("********** I am here in event");
}
}
ВGoogle Cloud Console Я установил обратный звонок
http://localhost:8080/oauth2callback
https://mirrornotifications.appspot.com/forward?url=http://localhost:8080/notify
http://localhost:8080
Как я могу получить меню?клик событие или действие из моего сервлета? Пожалуйста, кто-нибудь, помогите ....