aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/CheckAppVersionService.java
blob: 72bc3508a41030e77edebd8046567baed6bbffc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package de.pixart.messenger.services;

import com.google.gson.JsonObject;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CheckAppVersionService extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public CheckAppVersionService() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doPost(request,response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        PrintWriter out = response.getWriter();
        response.setContentType("text/html");

        //send a JSON response with the app Version and file URI
        JsonObject myObj = new JsonObject();
        myObj.addProperty("success", false);
        myObj.addProperty("latestVersionCode", 2);
        myObj.addProperty("latestVersion", "1.0.0");
        myObj.addProperty("changelog", "");
        myObj.addProperty("filesize", "");
        myObj.addProperty("appURI", "");
        out.println(myObj.toString());
        out.close();
    }
}