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