git.cweiske.de
/
louyapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Special URL for storing the gamer key
[louyapi.git]
/
src
/
main
/
java
/
de
/
cweiske
/
ouya
/
louyapi
/
HttpServer.java
diff --git
a/src/main/java/de/cweiske/ouya/louyapi/HttpServer.java
b/src/main/java/de/cweiske/ouya/louyapi/HttpServer.java
index 2e5779a8b1b8bd40da9a4dafbe4c84b2ea92aa27..024a1b841ca074e91f4e245bb2144c13879d383b 100644
(file)
--- a/
src/main/java/de/cweiske/ouya/louyapi/HttpServer.java
+++ b/
src/main/java/de/cweiske/ouya/louyapi/HttpServer.java
@@
-28,6
+28,12
@@
public class HttpServer extends NanoHTTPD {
*/
public Response serve(IHTTPSession session) {
String path = session.getUri();
*/
public Response serve(IHTTPSession session) {
String path = session.getUri();
+ Log.d(TAG, "serve: " + path);
+ //this happens with "//agreements/marketplace.html". remove double slash.
+ if (path.startsWith("//")) {
+ path = path.substring(1);
+ }
+
InputStream content;
if (path.equals("/api/v1/status") || path.equals("/generate_204")) {
InputStream content;
if (path.equals("/api/v1/status") || path.equals("/generate_204")) {
@@
-86,6
+92,10
@@
public class HttpServer extends NanoHTTPD {
return newFixedLengthResponse(Response.Status.OK, "application/json", content);
}
return newFixedLengthResponse(Response.Status.OK, "application/json", content);
}
+ } else if (path.equals("/api/v1/gamers/key")) {
+ //usage: store gamer ouya public key via PUT
+ return newFixedLengthResponse(Response.Status.CREATED, null, "");
+
} else if (path.equals("/api/v1/search") && session.getParameters().containsKey("q")) {
//usage: search for games
String query = session.getParameters().get("q").get(0);
} else if (path.equals("/api/v1/search") && session.getParameters().containsKey("q")) {
//usage: search for games
String query = session.getParameters().get("q").get(0);