From the sample app for google glass in java, I found it is working through JSP and servlet. So I can create a timelineitem and set text in to it
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
TimelineItem timelineItem = new TimelineItem();
timelineItem.setText("My Sample Project");
MirrorClient.insertTimelineItem(credential, timelineItem);
response.sendRedirect(WebUtil.buildUrl(request, "/second.jsp"));
}
and from jsp page i can catch the time line and get value from it, like
<%
if (timelineItems != null && !timelineItems.isEmpty()) {
for (TimelineItem timelineItem : timelineItems) {
%>
<div class="container">
<div class="row">
<div class="span4">
<h2>Timeline 2</h2>
<h3><%=StringEscapeUtils.escapeHtml4(timelineItem
.getText())%></h3>
</div>
</div>
</div>
<%
}
}
%>
So now I want to do something advance like bundle of timelines, set background image, custom menuitem, voice command etc.
But in tutorial for advance job i found it is using some JSON format like for menuitem
HTTP/1.1 201 Created
Date: Tue, 25 Sep 2012 23:30:11 GMT
Content-Type: application/json
Content-Length: 303
{
"text": "Hello world",
"menuItems": [
{
"action": "REPLY"
}
]
}
So how I do such of thing? what should I write in servlet and how I get value from jsp page? Should I generate json from servlet and directly write in response or something else