Bita Shadgar wrote:

> Hi,
>
> I am wondering if anybody sends or references me a simple sample of
> webdav servlet which is included the propfind and proppatch methods. I
> know this program must extends WebdavServlet  and inside the method
> function  the service
> method has to be called. somthing like this in
> SimpleServletForGet.java:
>
> // source code of SimpleServletForGet.java
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import org.apache.slide.webdav.*;
>
> public class SimpleServletForGet extends WebdavServlet {
>
>      /**
>       * Handle the HTTP GET method by building a simple web page.
>       */
>       public void GET (HttpServletRequest request,
>                                    HttpServletResponse response)
>                                   throws ServletException, IOException
> {
>
>
>                 super.service( request, response);
>                 PrintWriter         out;
>                 String              title = "Simple Servlet Output";
>
>                 // set content type and other response header fields
> first
>                 response.setContentType("text/html");
>
>                 // then write the data of the response
>                 out = response.getWriter();
>
>                 out.println("<HTML><HEAD><TITLE>");
>                 out.println(title);
>                 out.println("</TITLE></HEAD><BODY>");
>                 out.println("<H1>" + title + "</H1>");
>                 out.println("<P>
>                       This is output from SimpleServlet by WebDAV.");
>                 out.println("</BODY></HTML>");
>                 out.close();
>           }
>  }
>
> However, I don't exactly know the structure and format of writing a
> servlet with webdav and how I can run these servlets. I compiled this
> program and put it in the WEB-INF/classes directory in slide/webapp
> and
> then tried to run it by :
> http://mymachine:8080/servlet/SimpleServletForGet
> but unfortunately every time I give the ' not found
> /servlet/SimpleServletForGet '  error message. Could you please let me
>
> know what's wrong with my program.
>
> Please forgive me if it takes your time, sorry.
> Many thanks and great appreciate,
> Bita Shadgar

You're still using the wrong url and/or the wrong directory,
"slide/webapp" ???

Here's a start
Use this simple environment to test an example
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/bin/jakarta-tomcat-3.2.3.zip

When you unzip it you get the following files:
webapps\examples\WEB-INF\classes\HelloWorldExample.java
webapps\examples\WEB-INF\classes\HelloWorldExample.class

This servlet in invoked when you access this url:
http://localhost:8080/examples/servlet/HelloWorldExample

If that is working, you know your environment is correct...

remove the webdav import
change WebdavServlet to HttpServlet
change GET to doGet
and try your servlet in the examples directories...

If your normal servlet is working, install slide
(copy slide.war in webapps directory and restart)

Try to access http://localhost:8080/slide/

You now can start extending the default servlet...


Dirk

Reply via email to