This question was the the forum dated 5th,April,00...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ayush_Lall
Posted On:   Tuesday, January 16, 2001 02:32 PM

This question was the the forum dated 5th,April,00 answered by Oliver Springauf.Details below. My question is quite similar...I would like to do the same with Jrun Server with VAJ 3.5(Enterprise).Has it been tried by somebody or any ideas on the same would be appreciated. I find this pretty limiting at times with so many diff servers and not having the capability to test/configure a env. thru the same studio. Thank You. ------------------------------------- ** : Can I use VAJ version 2.0 to develop servlets and test or debug it without starting web server? Is there any third party provide tools that do this and can be integrated into VAJ? I did this quite a lot. Sun's Servlet DevKit (JSDK   More>>

This question was the the forum dated 5th,April,00 answered by Oliver Springauf.Details below.

My question is quite similar...I would like to do the same with Jrun Server with VAJ 3.5(Enterprise).Has it been tried by somebody or any ideas on the same would be appreciated.

I find this pretty limiting at times with so many diff servers and not having the capability to test/configure a env. thru the same studio.

Thank You.


-------------------------------------
** : Can I use VAJ version 2.0 to develop servlets and test or debug it without starting web server? Is there any third party provide tools that do this and can be integrated into VAJ?

I did this quite a lot. Sun's Servlet DevKit (JSDK) includes a web server (sun.servlet.http.HttpServer) that you can use. In practice, give your servlet class a main method like

import java.lang.reflect.Method;

...

public static void main(java.lang.String[] args) {
String sMyURL =
"http://localhost:8080/servlet/pkg.test.myservlet";

// this variable must be set by you
String sMyBrowser =
"c:\Programme\Netscape\Communicator\Program\netscape.exe";

try {
boolean success = false;
// Throw an exception if we are not in the VisualAge IDE
Class.forName("com.ibm.uvm.abt.edit.TestFrame");
Runtime.getRuntime().exec(sMyBrowser + " " + sMyURL);
Class serverStarterClass =
Class.forName("sun.servlet.http.HttpServer");
Method method =
serverStarterClass.getMethod("main",
new Class[] {String[].class});
method.invoke(serverStarterClass,
new Object[] {new String[] {"-p", "8080"}});
}
catch (Throwable e) {
System.err.println(e);
}
}

You can then start your servlet by executing its main(), which starts the web server and your browser. The JSDK server is only for testing, it lacks most features of other servlet engines (like aliases, url rewriting, ...) There are two minor inconveniences with this method: you have to find your own way to configure your servlet, and earlier versions of the JSDK server did not serve files (only servlets). I could imagine that it's also possible to integrate other servlet engines (like Apache's) into VAJ.

   <<Less
About | Sitemap | Contact