Did you try it to see if you get the same behavior using a connector other
than Grizzly?  (e.g. Jetty or the included HTTP connector)  On refresh, most
Mozilla based browsers will try a conditional GET first to see if the
resource has changed, then if the server indicates that it has changed, will
repeat with the full GET.  The weird behavior you describe is also found
when running under Tomcat 5 if you don't send a large enough entity from
Restlet ... where that first conditional GET will fail and cause the same
symptoms in the browser.  So I'm wondering if it's connector-specific here,
too.

On Thu, Oct 22, 2009 at 8:38 AM, Sopasakis Pantelis <ch...@mail.ntua.gr>wrote:

> Dear List,
>  Hi for the first time, cause I'm a new member. I've developed a web
> service based on Restlet 1.1.5 which runs as a standalone application
> using Grizzly. I deciided to migrate to Restlet version 2.0. m3 and
> after some refactoring and changes in my code, I managed to make the
> whole thing work just fine!
>
> In the server class, I attach both an application and some static html
> files including a javadoc directory. This is the server class:
>
>
> *******************************************************************
>
> package org.opentox.server;
>
> import java.util.logging.Level;
> import java.util.logging.Logger;
> import org.opentox.Applications.OpenToxApplication;
> import org.opentox.Resources.AbstractResource;
> import org.restlet.Application;
> import org.restlet.Component;
> import org.restlet.data.LocalReference;
> import org.restlet.data.Protocol;
> import org.restlet.resource.Directory;
> import org.restlet.routing.VirtualHost;
>
> /**
> *
> * @author chung
> */
> public class Server {
>
>    public static void main(String[] args){
>        // Create a component
>           Component component = new Component();
>
>           component.getServers().add(Protocol.HTTP, 3000);
>
>           component.getClients().add(Protocol.FILE);
>
>
>           LocalReference javadoc =
>                    LocalReference.createFileReference(
>                  AbstractResource.javadocDir);
>
>           LocalReference home =
>                   LocalReference.createFileReference(
>                  AbstractResource.HTMLDir);
>
>
>           Directory javadocDirectory = new
> Directory(component.getContext().createChildContext(), javadoc);
>           Directory homeDirectory = new
> Directory(component.getContext().createChildContext(), home);
>
>
>           Application application = new OpenToxApplication();
>
>           VirtualHost host = new VirtualHost();
>
>           host.attach("/OpenToxServices",application);
>           host.attach("",homeDirectory);
>           host.attach("/OpenToxServices/javadoc", javadocDirectory);
>
>
>
>           component.setDefaultHost(host);
>        try {
>            component.start();
>        } catch (Exception ex) {
>            Logger.getLogger(Server.class.getName()).log(Level.SEVERE,
> null, ex);
>        }
>
>    }
>
> }
> ********************************************************************
>
> The problem is that when I reload any of the resources that corresponds
> to a static HTML file (e.g. the javadoc), I get a status code 405
> (Method Not allowed). If I reload the page again, I get the HTML but
> without the CSS. I reload it again to get the correct HTML
> representation but without the Images contained in it. Another reload
> gives once again a status 405, then HTML without css and finally the
> correct HTML. This happens each time I press F5 on mozilla BUT NOT if I
> request the resource again, i.e. if I retype the URL. Note that this
> happens only with the static html files. Other resources that are based
> on java classes (MyResource extends ServerResource) don't have such
> problems!
>
> Having no idea how to solve that, I just separated the static files from
> the service. I set up an apache server on another port (80) to deploy
> the static html files and the services run on 3000. However I think
> other people are experiencing the same problem, because I had the same
> problem on 2 different machines.
>
> I would appreciate any suggestions or ideas on that.
>
> You can find the source code of the application at
> http://github.com/sopasakis/yaqp
>
> Thank you in advance,
> Sopasakis Pantelis
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2410202
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2410217

Reply via email to