Hi all,

Guilherme and I has worked together to solve this issue.

We have solved our problem getting more information about setting up Jetty
and deploying restlet on Servlet container.

Here go our sample code:

//Jetty server

Server server = new Server(8080);


//Restlet context

ServletContextHandler restletContext =
newServletContextHandler(ServletContextHandler.
SESSIONS);

restletContext.setContextPath("/restlet");

ServerServlet serverServlet = new ServerServlet();

ServletHolder servletHolder = new ServletHolder(serverServlet);

servletHolder.setInitParameter("org.restlet.application",
"main.RestletApplication");

restletContext.addServlet(servletHolder, "/*");


//War context

WebAppContext warContext = new WebAppContext();

warContext.setContextPath("/war");

warContext.setWar("/somepath/minhawar.war");


//Gwt context

WebAppContext gwtContext = new WebAppContext();

gwtContext.setContextPath("/gwt");

gwtContext.setWar("/somepath/hellogwt.war");


//File server context

ContextHandler fileHandler = new ContextHandler();

fileHandler.setContextPath("/files");

ResourceHandler resourceHandler = new ResourceHandler();

resourceHandler.setResourceBase("/somepath/public_html");

resourceHandler.setDirectoriesListed(true);

fileHandler.setHandler(resourceHandler);


//Redireciton context

MovedContextHandler movedContextHandler = new MovedContextHandler();

movedContextHandler.setContextPath("/data");

movedContextHandler.setNewContextURL("/files");

movedContextHandler.setPermanent(false);



//Jetty start up

ContextHandlerCollection contexts = new ContextHandlerCollection();

contexts.setHandlers(new Handler[] { restletContext,
warContext, gwtContext, fileHandler, movedContextHandler });



HandlerCollection handlerCollection = new HandlerCollection();

handlerCollection.setHandlers(new Handler[] { contexts });

server.setHandler(handlerCollection);


server.start();

server.join();

We had to add the following libraries to the project classpath:

> jetty-distribution-7.6.1.v20120215/lib/jetty-servlet-7.6.1.v20120215.jar
> restlet-jee-2.0.11/lib/org.restlet.ext.servlet.jar
> restlet-jee-2.0.11/lib/org.restlet.jar
> jetty-distribution-7.6.1.v20120215/lib/servlet-api-2.5.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-webapp-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-server-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-util-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-http-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-io-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-security-7.6.1.v20120215.jar
>
> jetty-distribution-7.6.1.v20120215/lib/jetty-continuation-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jetty-xml-7.6.1.v20120215.jar
> jetty-distribution-7.6.1.v20120215/lib/jsp/org.eclipse.jdt.core-3.7.1.jar
>
> jetty-distribution-7.6.1.v20120215/lib/jsp/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar
>
> jetty-distribution-7.6.1.v20120215/lib/jsp/org.apache.jasper.glassfish-2.1.0.v201110031002.jar
>
> jetty-distribution-7.6.1.v20120215/lib/jsp/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
>
> jetty-distribution-7.6.1.v20120215/lib/jsp/javax.servlet.jsp-2.1.0.v201105211820.jar
> jetty-distribution-7.6.1.v20120215/lib/jsp/javax.el-2.1.0.v201105211819.jar
>
> jetty-distribution-7.6.1.v20120215/lib/jsp/com.sun.el-1.0.0.v201105211818.jar


Best regards,


On Thu, Feb 23, 2012 at 2:42 PM, Guilherme Gotardo <[email protected]>wrote:

> Hi all,
>
> I have a .WAR file that contains a simple HelloWorld, and I want to add it
> into my server. I'm using the Jetty connector.
>
> When I run my war directly with Jetty Server, works fine, but when I try
> to run using Restlet, the following error occurs:
>
> Fev 23, 2012 2:40:47 PM org.restlet.engine.Engine createHelper
> Warning: No available server connector supports the required protocols:
> 'WAR' . Please add the JAR of a matching connector to your classpath.
> 2012-02-23 14:40:47.274:INFO::jetty-7.1.6.v20100715
> 2012-02-23 14:40:47.367:INFO::Started [email protected]:8080
>
>
> I've attached my code, please, what can I do to resolve that?
> Thanks in advanced.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2925951




-- 
Danilo Rosetto Muñoz
[email protected]
http://br.linkedin.com/in/danilomunoz

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

Reply via email to