Hello Thomas,
could you provide us your web.xml file also?
Can you have a look at this documentation page? =>
http://www.restlet.org/documentation/1.1/firstSteps
best regards,
Thierry Boileau
Hello,
I've got some problems concerning the integration of a simple Application into
the Tomcat container. I followed the instructions on the restlet.org FAQs,
however it doesn't work with my code, I get HTTP 500 internal errors. The
application works in the Noelios engine.
package com.interaktivestadt;
import java.io.File;
import org.restlet.Component;
import org.restlet.Context;
import org.restlet.Restlet;
import org.restlet.Route;
import org.restlet.Router;
import org.restlet.data.Protocol;
import org.restlet.util.Variable;
import org.restlet.Directory;
import com.db4o.Db4o;
import com.db4o.ObjectContainer;
import com.db4o.config.Configuration;
/**
* The main Web application.
*
* @author Thomas Fuhrmann
*/
public class Application extends org.restlet.Application {
private ObjectContainer container;
public static void main(String[] args) throws Exception {
// Create a component with an HTTP server connector
Component comp = new Component();
comp.getServers().add(Protocol.HTTP, 3000);
comp.getClients().add(Protocol.FILE);
// Attach the application to the default host and start it
comp.getDefaultHost().attach("/", new Application(comp.getContext()));
comp.start();
}
public Application(Context context) {
super(context);
// the db4o container is a simple database for storing objects
// setting the update depth to two, because the user object we store
contains a non primitive member
// system property "user.home" means the local user directory
Db4o.configure().updateDepth(2);
this.container = Db4o.openFile(System.getProperty("user.home") +
File.separator + "userdb.dbo");
}
public Restlet createRoot() {
// Router routes client requests to their according resources
// taken from the Restlet docs:
// The context property is typically provided by a parent
Component as a way
to encapsulate access to shared features such as logging and client connectors.
Router router = new Router(getContext());
// Add a route for the homepage resource
router.attach("",HomeResource.class);
// Add a route for the user input validation
router.attach("/users/participation", ParticipationResource.class);
// Add a route for the users resource
Route usersRoute = router.attach("/users/{username}",
UserResource.class);
usersRoute.getTemplate().getVariables().put("username", new
Variable(Variable.TYPE_ALL));
return router;
}
/**
* Returns the database container.
*
* @return the database container.
*/
public ObjectContainer getContainer() {
return this.container;
}
}
Thanks, for your help!