Restfulie outside vraptor

35 views
Skip to first unread message

danicuki

unread,
Jul 21, 2011, 2:02:42 PM7/21/11
to restfulie-java
Is it possible to use Restfulie without vraptor (as a standalone
Server or deployed in a container)?

Apache CXF has can do this with:

JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(MyResource1.class, MyResource2.class);
sf.setAddress("http://localhost:8080/");
sf.create();

Is there any documentation on how to do the same with restfulie?

Thanks

Daniel Cukier

Guilherme Silveira

unread,
Jul 22, 2011, 10:39:38 AM7/22/11
to restful...@googlegroups.com
Hi Daniel!

Yes, we can! Here is the example with embedded jetty:
https://github.com/caelum/vraptor-test/blob/master/src/main/java/br/com/caelum/vraptor/test/RealVRaptor.java#L30

Server server = new Server(port);
WebAppContext context = new WebAppContext();
context.setDescriptor(base.getAbsolutePath() + "/WEB-INF/web.xml");
context.setResourceBase(base.getAbsolutePath());
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();

If you use a war file, you do not need the setDescriptor call. Is that all?

Regards

Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/

Daniel Cukier

unread,
Jul 31, 2011, 11:20:50 AM7/31/11
to restful...@googlegroups.com
Yes, I think for now this helps! 

Thanks Gui
Reply all
Reply to author
Forward
0 new messages