Hi everyone, I've been investigating the restlet framework for several service
based projects which I may inherit and I've been looking for examples of
deployment outside of any Servlet Container.
I ended up here: http://restlet.org/learn/guide/2.1/editions/gwt/examples but
the download link leads to nothing.
I'm wondering if it's doable. I currently have a little Guice + Restlet
integration which works well enough. Everything is built through Guice modules
and I start restlet with a Component class in a runner using the jetty
connector. (attached)
If I wanted to do similar for a GWT deployment of a setup application (as proof
of concept), could I use the same approach or would I need to modify how
everything is bootstrapped?
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3068495
package com.equisoft.rogers.card.services.rest;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.inject.persist.PersistService;
import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Server;
import org.restlet.data.Protocol;
import javax.inject.Inject;
public class RestletServerRunner implements ServerRunner {
private final Application application;
private final RunnerConfiguration configuration;
private final PersistService persistService;
@Inject
public RestletServerRunner(final RunnerConfiguration configuration, final Application application,
final PersistService persistService) {
this.configuration = configuration;
this.application = application;
this.persistService = persistService;
}
@Override
public void runServer() {
final String address = configuration.getAddress();
final Component component = new Component();
final Server server = Strings.isNullOrEmpty(address)
? component.getServers().add(Protocol.HTTP, configuration.getPort())
: component.getServers().add(Protocol.HTTP, address, configuration.getPort());
component.getDefaultHost().attach(configuration.getContext(), application);
server.getContext().getParameters().add("type", "1");
try {
persistService.start();
component.start();
} catch (final Exception ex) {
throw Throwables.propagate(ex);
}
}
}