build fix
This commit is contained in:
parent
6ff8919dec
commit
419b6e66b1
|
@ -4,7 +4,7 @@ import com.github.scribejava.core.builder.api.DefaultApi20;
|
|||
|
||||
public class MyApi extends DefaultApi20 {
|
||||
|
||||
public MyApi() {
|
||||
private MyApi() {
|
||||
}
|
||||
|
||||
private static class InstanceHolder {
|
||||
|
|
|
@ -20,34 +20,34 @@ public class TwitterController {
|
|||
|
||||
@GetMapping(value ="/me/twitter")
|
||||
public String me(HttpServletResponse servletResponse){
|
||||
try {
|
||||
OAuth1RequestToken requestToken = service.getService().getRequestToken();
|
||||
|
||||
String auth = service.getService().getAuthorizationUrl(requestToken);
|
||||
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
try {
|
||||
runtime.exec("rundll32 url.dll,FileProtocolHandler " + auth);
|
||||
} catch (IOException e) {
|
||||
servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
return null;
|
||||
}
|
||||
|
||||
System.out.println("Insert twitter code:");
|
||||
Scanner in = new Scanner(System.in);
|
||||
|
||||
String oauthverifier = in.nextLine();
|
||||
|
||||
final OAuth1AccessToken accessToken = service.getService().getAccessToken(requestToken,oauthverifier);
|
||||
|
||||
OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json");
|
||||
service.getService().signRequest(accessToken, request);
|
||||
Response response = service.getService().execute(request);
|
||||
return response.getBody();
|
||||
|
||||
} catch (IOException | InterruptedException | ExecutionException e) {
|
||||
servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
}
|
||||
// try {
|
||||
// OAuth1RequestToken requestToken = service.getService().getRequestToken();
|
||||
//
|
||||
// String auth = service.getService().getAuthorizationUrl(requestToken);
|
||||
//
|
||||
// Runtime runtime = Runtime.getRuntime();
|
||||
// try {
|
||||
// runtime.exec("rundll32 url.dll,FileProtocolHandler " + auth);
|
||||
// } catch (IOException e) {
|
||||
// servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// System.out.println("Insert twitter code:");
|
||||
// Scanner in = new Scanner(System.in);
|
||||
//
|
||||
// String oauthverifier = in.nextLine();
|
||||
//
|
||||
// final OAuth1AccessToken accessToken = service.getService().getAccessToken(requestToken,oauthverifier);
|
||||
//
|
||||
// OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json");
|
||||
// service.getService().signRequest(accessToken, request);
|
||||
// Response response = service.getService().execute(request);
|
||||
// return response.getBody();
|
||||
//
|
||||
// } catch (IOException | InterruptedException | ExecutionException e) {
|
||||
// servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue