debug RedditAPI
parent
db654ddfdd
commit
766d53713e
@ -1,23 +1,29 @@
|
|||||||
package sh.adb.RandomRedditMemesAPI;
|
package sh.adb.RandomRedditMemesAPI;
|
||||||
|
|
||||||
|
import com.github.jreddit.oauth.RedditOAuthAgent;
|
||||||
|
import com.github.jreddit.oauth.RedditToken;
|
||||||
|
import com.github.jreddit.oauth.app.RedditApp;
|
||||||
|
import com.github.jreddit.oauth.app.RedditInstalledApp;
|
||||||
import com.github.jreddit.oauth.exception.RedditOAuthException;
|
import com.github.jreddit.oauth.exception.RedditOAuthException;
|
||||||
import com.sun.net.httpserver.HttpServer;
|
import com.sun.net.httpserver.HttpServer;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) throws IOException, RedditOAuthException {
|
public static void main(String[] args) throws IOException, RedditOAuthException, ParseException {
|
||||||
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0);
|
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0);
|
||||||
server.createContext("", new ErrorHandler());
|
server.createContext("/", new FallbackHandler());
|
||||||
//server.createContext("/api/v1/", new StandardHandler());
|
//server.createContext("/api/v1/", new StandardHandler());
|
||||||
server.createContext("/api/v1/r/", new CommunityHandler());
|
server.createContext("/api/v1/r/", new CommunityHandler());
|
||||||
server.setExecutor(null);
|
server.setExecutor(null);
|
||||||
server.start();
|
server.start();
|
||||||
|
System.out.println("server started");
|
||||||
|
|
||||||
RedditAPI client = new RedditAPI();
|
RedditAPI client = new RedditAPI();
|
||||||
System.out.println("the token is");
|
System.out.println("the token is");
|
||||||
System.out.println(client.token);
|
System.out.println(client.token.getAccessToken());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue