Revision 3195
Added by berkley almost 18 years ago
lib/ajax/INSTALL | ||
---|---|---|
1 | 1 |
Author: Chad Berkley |
2 | 2 |
Date: 3/5/2007 |
3 | 3 |
|
4 |
This file covers deploying the gwt created ajax code and servlet to a non-google version of tomcat. This allows for the installation of the servlet(s) along side a normal metacat installation. |
|
4 |
This file covers deploying the gwt created ajax code and servlet to a non-google |
|
5 |
version of tomcat. This allows for the installation of the servlet(s) along |
|
6 |
side a normal metacat installation. This file assumes you've already done |
|
7 |
the steps highlighted in the README file. |
|
5 | 8 |
|
6 |
1) Create a servlet on your tomcat instance called "rpc". This is a simple servlet that just runs the gogle remote procedure call (rpc) services. Use the web.xml file from the ./tomcat/webapps/ROOT/WEB-INF directory. You'll also need to copy all of the gwt jar files from your gwt installation as well as all of the jar files in ./lib |
|
9 |
1) Create a servlet on your tomcat instance called "rpc". This is a simple |
|
10 |
servlet that just runs the google remote procedure call (rpc) services. Use |
|
11 |
the web.xml file from the ./tomcat/webapps/ROOT/WEB-INF directory. You'll |
|
12 |
also need to copy all of the gwt jar files from your gwt installation as well |
|
13 |
as all of the jar files in ./lib. Use the gwt-user.jar and gwt-dev.jar from |
|
14 |
metacat/lib. If you use the ones from the gwt distro, tomcat won't load them |
|
15 |
due to the presence of javax.servlet.Servlet. |
|
7 | 16 |
|
8 |
2) copy ./src/org/kepler/web/service/KeplerServiceServlet.java to metacat/src/org/kepler/web/service/ and update the KeplerServiceServlet.java file with the correct url to your metacat servlet (line 6 in the code). |
|
17 |
2) copy ./src/org/kepler/web/service/KeplerServiceServlet.java to |
|
18 |
metacat/src/org/kepler/web/service/ and update the KeplerServiceServlet.java |
|
19 |
Edit the file with the correct url to your metacat servlet (line 6 in the code). |
|
20 |
Make sure the moduleRelativeURL exactly matches the url that will be browsed |
|
21 |
to! I.E. Don't use "localhost" if you intend to browse to an actual machine |
|
22 |
name. This confuses the RPC and will cause problems. |
|
9 | 23 |
|
10 |
3) run 'ant package' (from the ajax dir) and copy the newly created kepler-web.jar file to metacat/lib/ |
|
24 |
3) run 'ant package' (from the ajax dir) and copy the newly created |
|
25 |
kepler-web.jar file to metacat/lib/. Make sure you updated the hard coded |
|
26 |
servlet paths in the java code before doing this. |
|
11 | 27 |
|
12 | 28 |
4) run 'ant install' from your metacat directory |
13 | 29 |
|
14 | 30 |
5) make sure tomcat restarts |
15 | 31 |
|
16 |
6) run ./KeplerClient-compile and copy the contents of the www directory to some web accessible location, then browse to the KeplerClient.html file and the javascript should run. Note that you may need to update any hard coded servlet paths in the ajax code before copying the www files to the web location. |
|
32 |
6) run ./KeplerClient-compile and copy the contents of the www directory |
|
33 |
to some web accessible location, then browse to the KeplerClient.html file |
|
34 |
and the javascript should run. |
|
17 | 35 |
|
18 | 36 |
-------------------------------- |
19 |
If this doesn't work for some reason, keep in mind the main things you need. They are: |
|
37 |
If this doesn't work for some reason, keep in mind the main things you need. |
|
38 |
They are: |
|
20 | 39 |
* the rpc servlet |
21 |
* the KeplerServiceServlet servlet. In the web.xml file, I have called this 'gwt' so the address will be: http://server:8080/servletpath/gwt |
|
22 |
* the compile javascript (ajax) code |
|
40 |
* the KeplerServiceServlet servlet. In the web.xml file, I have called this |
|
41 |
'gwt' so the address will be: http://server:8080/servletpath/gwt |
|
42 |
* the compiled javascript (ajax) code |
|
23 | 43 |
* hard coded server/servlet paths correctly changed |
24 | 44 |
* all jar files accessible to tomcat |
25 | 45 |
|
lib/ajax/KeplerClient-shell | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
APPDIR=`dirname $0`; |
3 |
GWT=/Users/berkley/tools/gwt
|
|
3 |
GWT=/home/berkley/tools/gwt
|
|
4 | 4 |
CLASSPATH="$APPDIR/src:$APPDIR/bin:$GWT/gwt-user.jar:$GWT/gwt-dev.jar:$APPDIR/lib/client.jar:$APPDIR/lib/utilities.jar:$APPDIR/lib/xalan.jar:$APPDIR/lib/xml-apis.jar" |
5 | 5 |
|
6 |
java -XstartOnFirstThread -cp $CLASSPATH com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@" org.kepler.web.KeplerClient/KeplerClient.html; |
|
6 |
java -cp $CLASSPATH com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@" org.kepler.web.KeplerClient/KeplerClient.html; |
lib/ajax/KeplerClient-compile | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
|
3 | 3 |
APPDIR=`dirname $0`; |
4 |
GWT=/Users/berkley/tools/gwt
|
|
4 |
GWT=/home/berkley/tools/gwt
|
|
5 | 5 |
CLASSPATH="$APPDIR/src:$APPDIR/bin:$GWT/gwt-user.jar:$GWT/gwt-dev.jar:$APPDIR/lib/client.jar:$APPDIR/lib/utilities.jar:$APPDIR/lib/xalan.jar:$APPDIR/lib/xml-apis.jar" |
6 | 6 |
|
7 |
java -XstartOnFirstThread -cp $CLASSPATH com.google.gwt.dev.GWTCompiler -out "$APPDIR/www" "$@" org.kepler.web.KeplerClient; |
|
7 |
java -cp $CLASSPATH com.google.gwt.dev.GWTCompiler -out "$APPDIR/www" "$@" org.kepler.web.KeplerClient; |
lib/ajax/src/org/kepler/web/service/KeplerServiceServlet.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
public class KeplerServiceServlet extends RemoteServiceServlet implements KeplerService |
22 | 22 |
{ |
23 |
private String url = "http://localhost:8080/kepler/metacat";
|
|
23 |
private String url = "http://library.kepler-project.org/kepler/metacat";
|
|
24 | 24 |
|
25 | 25 |
/** |
26 | 26 |
* takes in a query string and a sessionid and returns a resultset |
lib/ajax/src/org/kepler/web/client/MetacatResultsWidget.java | ||
---|---|---|
47 | 47 |
// Use a module-relative URLs to ensure that this client code can find |
48 | 48 |
// its way home, even when the URL changes (as might happen when you |
49 | 49 |
// deploy this as a webapp under an external servlet container). |
50 |
String moduleRelativeURL = GWT.getModuleBaseURL() + "kepler"; |
|
51 |
moduleRelativeURL = "http://offhegoes.kicks-ass.net:8080/kepler/gwt"; |
|
50 |
//String moduleRelativeURL = GWT.getModuleBaseURL() + "kepler"; |
|
51 |
// String moduleRelativeURL = "http://library.kepler-project.org/kepler/gwt"; |
|
52 |
String moduleRelativeURL = "http://dana:8080/kepler/gwt"; |
|
52 | 53 |
System.out.println("connection url: " + moduleRelativeURL); |
53 | 54 |
target.setServiceEntryPoint(moduleRelativeURL); |
54 | 55 |
} |
lib/ajax/src/org/kepler/web/client/DynaTableWidget.java | ||
---|---|---|
176 | 176 |
|
177 | 177 |
setText(title); |
178 | 178 |
|
179 |
Frame iframe = new Frame("http://offhegoes.kicks-ass.net:8080/kepler/metacat?action=read&docid=" + docid + "&qformat=kepler");
|
|
179 |
Frame iframe = new Frame("http://library.kepler-project.org/kepler/metacat?action=read&docid=" + docid + "&qformat=kepler");
|
|
180 | 180 |
Button closeButton = new Button("Close", this); |
181 | 181 |
/*HTML msg = new HTML( |
182 | 182 |
"<center>This is an example of a standard dialog box component.<br> " |
lib/ajax/README | ||
---|---|---|
3 | 3 |
|
4 | 4 |
Setup |
5 | 5 |
----- |
6 |
1) Make sure you have the google web toolkit installed. You can get it from http://code.google.com/webtoolkit/. From now on, I will refer to the google web toolkit directory as the "gwt" directory. |
|
7 |
2) Make a symbolic link in the gwt directory so that gwt-dev.jar -> gwt-dev-xxx.jar where xxx is either "mac", "linux" or "windows". This just makes the scripting easier to deal with. |
|
8 |
3) Edit the KeplerClient-shell file and make sure $GWT points to your gwt installation. Do the same for KeplerClient-compile |
|
6 |
1) Make sure you have the google web toolkit installed. You can get it from |
|
7 |
http://code.google.com/webtoolkit/. From now on, I will refer to the google |
|
8 |
web toolkit directory as the "gwt" directory. |
|
9 |
2) Make a symbolic link in the gwt directory so that |
|
10 |
gwt-dev.jar -> gwt-dev-xxx.jar where xxx is either "mac", "linux" or "windows". |
|
11 |
This just makes the scripting easier to deal with. |
|
12 |
3) Edit the KeplerClient-shell file and make sure $GWT points to your |
|
13 |
gwt installation. Do the same for KeplerClient-compile |
|
9 | 14 |
|
10 | 15 |
Building |
11 | 16 |
-------- |
12 |
Run the KeplerClient-shell script. Upon successful compilation, you should see two windows open. One is the tomcat server shell, the other is a test browser where you will see the web page. |
|
17 |
Run the KeplerClient-shell script. Upon successful compilation, you should |
|
18 |
see two windows open. One is the tomcat server shell, the other is a test |
|
19 |
browser where you will see the web page. |
|
13 | 20 |
|
14 | 21 |
Testing |
15 | 22 |
------- |
16 |
You can use the -shell file for incremental building and testing. If you want to "clean" the project, you can use the ant build.xml file. The build file really is not needed. |
|
23 |
You can use the -shell file for incremental building and testing. If you want |
|
24 |
to "clean" the project, you can use the ant build.xml file. The build file |
|
25 |
really is not needed. |
|
17 | 26 |
|
18 | 27 |
Installation/Deployment |
19 | 28 |
----------------------- |
20 |
Once you have a working product and you want to deploy to a normal instance of Tomcat, you can first test that your code works under a normal browser by clicking the "compile/test" button on the google browser. This will open your page in whatever your default browswer is. Your server side code is still running on the google tomcat instance (port 8888). If you want to deploy the servlet and client side code to another instance of Tomcat, follow the instructions in the INSTALL file. |
|
29 |
Once you have a working product and you want to deploy to a normal instance |
|
30 |
of Tomcat, you can first test that your code works under a normal browser by |
|
31 |
clicking the "compile/test" button on the google browser. This will open your |
|
32 |
page in whatever your default browswer is. Your server side code is still |
|
33 |
running on the google tomcat instance (port 8888). If you want to deploy the |
|
34 |
servlet and client side code to another instance of Tomcat, follow the |
|
35 |
instructions in the INSTALL file. |
|
21 | 36 |
|
22 | 37 |
A note on using different OSs |
23 | 38 |
----------------------------- |
24 |
There are a few differences when moving between windows, linux and osx. On OSX, the -XstartOnFirstThread flag must be set in the KeplerClient-shell and KeplerClient-compile scripts. Also, make sure you make a symlink for the gwt-dev jar file. For some reason, google renames this jar depending on what system you download gwt for. |
|
39 |
There are a few differences when moving between windows, linux and osx. |
|
40 |
On OSX, the -XstartOnFirstThread flag must be set in the KeplerClient-shell |
|
41 |
and KeplerClient-compile scripts. Also, make sure you make a symlink for the |
|
42 |
gwt-dev jar file. For some reason, google renames this jar depending on what |
|
43 |
system you download gwt for. |
Also available in: Unified diff
updated the ajax code to make it easier to install. also updated the installation instructions.