Repository navigation
Expand file tree
/
Copy pathinstructions.html
More file actions
143 lines (123 loc) · 5.26 KB
/
Copy pathinstructions.html
File metadata and controls
143 lines (123 loc) · 5.26 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<html>
<title>plus-appengine-sample</title>
<body>
<h2>Instructions for the Plus App Engine Sample</h2>
<h3>Browse Source Code</h3>
<ul>
<li><a
href="http://code.google.com/p/google-api-java-client/source/browse/plus-appengine-sample/?repo=samples">Browse
Source</a>
</ul>
<h3>Register Your Application</h3>
<ul>
<li>Visit the <a
href="https://code.google.com/apis/console/?api=plus">Google apis
console</a>
</li>
<li>If this is your first time, click "Create project..."</li>
<li>Otherwise, click on the drop down under the "Google apis" logo at the top left,
and click "Create..." under "Other projects".</li>
<li>Click on "API Access", and then on "Create an OAuth 2.0 Client
ID...".</li>
<li>Enter a product name and click "Next".</li>
<li>Select "Web application", select "more options" and enter some
redirect URIs, for example
"https://yourappname.appspot.com/oauth2callback" and
"http://localhost:8888/oauth2callback". Click "Create client ID".</li>
<li>In the newly created "Client ID for web applications", click
"Download JSON" on the right side. Later on after you check out the
sample project, you will copy this downloaded file (e.g. <code>~/Downloads/client_secrets.json</code>)
to <a href="src/main/resources/client_secrets.json">src/main/resources/client_secrets.json</a>.
Otherwise you would get a <code>400 INVALID_CLIENT</code> error in
the browser when running the sample.</li>
<li>In the section labeled "Simple API Access", copy the value of "API key".
Go to <a href="src/main/java/com/google/api/services/samples/plus/PlusBasicServlet.java">
src/main/java/com/google/api/services/samples/plus/PlusBasicServlet.java</a>
and find the variable named "API_KEY". Paste the value from the API
Console into the quotes for API_KEY.</li>
</ul>
<h3>Checkout Instructions</h3>
<p>
<b>Prerequisites:</b> install <a href="http://java.com">Java 6</a>, <a
href="https://developers.google.com/appengine/downloads">Google App
Engine</a>, <a href="http://mercurial.selenic.com/">Mercurial</a>, and <a
href="http://maven.apache.org/download.html">Maven</a>. You may need to
set your
<code>JAVA_HOME</code>
.
</p>
<pre>
cd <i>[someDirectory]</i>
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
cd google-api-java-client-samples/plus-appengine-sample
cp ~/Downloads/client_secrets.json src/main/resources/client_secrets.json
mvn clean package
</pre>
<p>To enable logging of HTTP requests and responses (highly recommended
when developing), please take a look at <a href="src/main/webapp/WEB-INF/logging.properties">logging.properties</a>.</p>
<h3>Running and Deploying Your Application from the Command Line</h3>
<p>To run your application locally on a development server:</p>
<pre>
mvn appengine:devserver
</pre>
<p>To deploy your application to appspot.com:</p>
<p>
If this is the first time you are deploying your application to appspot.com, you will to perform the
following steps first.
</p>
<ul>
<li>Go to <a href="https://appengine.google.com/">https://appengine.google.com</a> and create an application.</li>
<li>Edit src/main/webapp/WEB-INF/appengine-web.xml, and enter the unique application identifier (you chose it in the prior step)
between the <application> tags.</li>
</ul>
<p> If you've done the above, you can deploy at any time: </p>
<pre>
mvn appengine:update
</pre>
<p>If this is the first time you have run "update" on the project, a browser window will open prompting you to log in.
Log in with the same Google account the app is registered with.
</p>
<h3>Setup Project in Eclipse</h3>
<p>
<b>Prerequisites:</b> install <a href="http://www.eclipse.org/downloads/">Eclipse</a>,
<a href="http://code.google.com/eclipse/">Google Plugin for Eclipse</a>, and
the <a href="http://javaforge.com/project/HGE">Mercurial plugin</a>.
</p>
<ul>
<li>Setup Eclipse Preferences
<ul>
<li>Window > Preferences... (or on Mac, Eclipse >
Preferences...)</li>
<li>Select Maven
<ul>
<li>check on "Download Artifact Sources"</li>
<li>check on "Download Artifact JavaDoc"</li>
</ul>
</li>
</ul>
</li>
<li>Import <code>plus-appengine-sample</code> project
<ul>
<li>File > Import...</li>
<li>Select "General > Existing Project into Workspace" and click
"Next"</li>
<li>Click "Browse" next to "Select root directory", find <code>
<i>[someDirectory]</i>/google-api-java-client-samples/plus-appengine-sample
</code> and click "Next"
</li>
<li>Click "Finish"</li>
<li>NOTE: please ignore the "The App Engine SDK JAR * is missing in
the WEB-INF/lib directory" error messages.</li>
</ul>
</li>
<li>Run
<ul>
<li>Right-click on project plus-appengine-sample</li>
<li>Run As > Web Application</li>
<li>Open <a href="http://localhost:8888">http://localhost:8888</a>
in your browser.</li>
</ul>
</li>
</ul>
</body>
</html>