Hello,

Forgive me for being a newbie. I am trying to get a simple servlet to run in
Orion.

I found the following in the Orion doc's
(http://www.orionserver.com/docs/servlet-howto.html). BUT there seems to be
something missing. When I try and run the servlet, it says it can't find the
page (404 error).  I noticed the doc's are slightly dated.... How do I
configure orion to see and run a serlvet in a given  directory?  :

Thanks,
Keith
----------------------------------------------------------------------------
----------------------------------------------

This howto will show you how to compile a Servlet using Orion.

Enabling Development Mode
The first thing we got to do is to make sure that Orion is running in
development mode.

1. Open the file ../orion/config/global-web-application.xml.

2. Set development=true in the <orion-web-app> tag so that it looks
something like the following:

<orion-web-app

jsp-cache-directory="./persistence"
servlet-webdir="/servlet"
development="true"

>

3. Save your changes.

Creating a test servlet
1. Create a Servlet with the following code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorldServlet2 extends HttpServlet
{

public String getServletInfo() {

return "Hello World Servlet";

}

public void doGet (HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{

res.setContentType("text/html");
ServletOutputStream out = res.getOutputStream();
out.println("<HTML>");
out.println("<HEAD><TITLE>Hello world</TITLE></HEAD>");
out.println("<BODY><H1>Hello world!</H1></BODY>");
out.println("</HTML>");

}

}



2. Store the Servlet in the /orion/default-web-app/WEB-INF/classes/
directory as HelloWorldServlet2.java

Compiling and running the Servlet
1. Open the url http://localhost/servlet/HelloWorldServlet2 in a normal web
browser.

You should now see the output of the HelloWorldServlet2 .



Reply via email to