Developer: I can't host a static website

classic Classic list List threaded Threaded
4 messages Options
M E
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Developer: I can't host a static website

M E
Hi

This code is in Restlet tutorial

// Create a component
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);

// Create an application
Application application = new Application() {
@Override
public Restlet createRoot() {
return new Directory(getContext(), ROOT_URI);
}
};

// Attach the application to the component and start it
component.getDefaultHost().attach("", application);
component.start();

I can't have the navigated resource on my browser whatever the ROOT_URI
is, what is chances?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Developer: I can't host a static website

Thierry Boileau
Hello,


I wonder if you set up properly the ROOT_URI variable (something like "file://....").
if you want to be sure, you can use the LocalReference#createFileReference method. It takes a directory path (something like "d:/temp/..." or "/tmp/...") as an argument.

That is to say:
return new Directory(getContext(), LocalReference.createFileReference("path to your directory"));


Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


Hi

This code is in Restlet tutorial

// Create a component
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);

// Create an application
Application application = new Application() {
    @Override
    public Restlet createRoot() {
        return new Directory(getContext(), ROOT_URI);
    }
};

// Attach the application to the component and start it
component.getDefaultHost().attach("", application);
component.start();

I can't have the navigated resource on my browser whatever the ROOT_URI
is, what is chances?
        
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Developer: I can't host a static website

StephanKoo
In reply to this post by M E
Hi Thierry,

as I startet with Restlet, I stumbled about the same stone. You should add a constant or something like that at the start of the example code in the example on www.restlet.org.

best regards
   Stephan

> -----Urspr√ľngliche Nachricht-----
> Von: "Thierry Boileau" <[hidden email]>
> Gesendet: 12.11.08 10:53:07
> An: [hidden email]
> Betreff: Re: Developer: I can't host a static website
>
> Hello,
>  
>  I wonder if you set up properly the ROOT_URI variable (something
> like "file://....").
>  if you want to be sure, you can use the LocalReference#createFileRefer
> ence method. It takes a directory path (something like "d:/temp/..."
> or "/tmp/...") as an argument.
>
>  That is to say:
>  return new Directory(getContext(), LocalReference.createFileReference(
> "path to your directory"));
>
>
>  Best regards,
>  Thierry Boileau
>  --
> Restlet ~ Core developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com
>
> Hi This code is in Restlet tutorial // Create a componentComponent
> component = new Component();component.getServers().add(Protocol.HTTP,
> 8182);component.getClients().add(Protocol.FILE);// Create an
> applicationApplication application = new Application() { @Override
> public Restlet createRoot() { return new Directory(getContext(), ROOT_
> URI); }};// Attach the application to the component and start
> itcomponent.getDefaultHost().attach("", application);component.start()
> ; I can't have the navigated resource on my browser whatever the ROOT_
>
> URI is, what is chances?
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Developer: I can't host a static website

Thierry Boileau
Hi Stephan, hi all,

I've upated the tutorial pages (for both 1.0 and 1.1 documentation) in order to clarify the usage of the ROOT_URI constant.
Actually the tutorial code makes implicit reference to the code of the org.restlet.example module (especially the org.restlet.example.tutorial.Constant class). But as you say, this reference is not obvious.
I hope the things are clearer now.

Thanks for reporting this!

Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


Hi Thierry,

as I startet with Restlet, I stumbled about the same stone. You should add a constant or something like that at the start of the example code in the example on www.restlet.org.

best regards
   Stephan

  
-----Ursprüngliche Nachricht-----
Von: "Thierry Boileau" [hidden email]
Gesendet: 12.11.08 10:53:07
An: [hidden email]
Betreff: Re: Developer: I can't host a static website

Hello,
 
 I wonder if you set up properly the ROOT_URI variable (something 
like "file://....").
 if you want to be sure, you can use the LocalReference#createFileRefer
ence method. It takes a directory path (something like "d:/temp/..." 
or "/tmp/...") as an argument.

 That is to say:
 return new Directory(getContext(), LocalReference.createFileReference(
"path to your directory"));


 Best regards,
 Thierry Boileau
 --
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

Hi This code is in Restlet tutorial // Create a componentComponent 
component = new Component();component.getServers().add(Protocol.HTTP, 
8182);component.getClients().add(Protocol.FILE);// Create an 
applicationApplication application = new Application() { @Override 
public Restlet createRoot() { return new Directory(getContext(), ROOT_
URI); }};// Attach the application to the component and start 
itcomponent.getDefaultHost().attach("", application);component.start()
; I can't have the navigated resource on my browser whatever the ROOT_

URI is, what is chances?
  
Loading...