Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » General (non-technical) » Jobs and employment » Eclipse RCP plugin + embedded Jetty + JSF
Eclipse RCP plugin + embedded Jetty + JSF [message #892916] Sun, 01 July 2012 20:50 Go to next message
elena ctinescu is currently offline elena ctinescuFriend
Messages: 2
Registered: July 2012
Junior Member
Hello,

I made an RCP plugin with embedded Jetty as following:

1) In plugin.xml -> Dependencies, I have added the following:
org.eclipse.equinox.http.jetty
org.eclipse.equinox.http.registry
org.mortbay.jetty.server
javax.servlet
2) In plugin.xml -> Extensions, I have added a Servlet extension point (org.eclipse.equinox.http.registry.servlet)
class: TemperatureServlet
alias:/temperature


The TemperatureServlet looks like this:


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TemperatureServlet extends HttpServlet {

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

System.out.println("doGet Called");

resp.sendRedirect("Convertor.jsp");
}
}

The file Convertor.jsp looks like this:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="Celsius"></h:outputLabel>
<h:inputText value="#{temperatureConvertor.celsius}"></h:inputText>
</h:panelGrid>
<h:commandButton action="#{temperatureConvertor.celsiusToFahrenheit}" value="Calculate"></h:commandButton>
<h:commandButton action="#{temperatureConvertor.reset}" value="Reset"></h:commandButton>
<h:messages layout="table"></h:messages>
</h:form>


<h:panelGroup rendered="#{temperatureConvertor.initial!=true}">
<h3> Result </h3>
<h:outputLabel value="Fahrenheit "></h:outputLabel>
<h:outputLabel value="#{temperatureConvertor.fahrenheit}"></h:outputLabel>
</h:panelGroup>
</f:view>
</body>
</html>

The file faces-config.xml contains:

<?xml version="1.0" encoding="UTF-8"?>

<faces-config

<managed-bean>
<managed-bean-name>temperatureConvertor</managed-bean-name>
<managed-bean-class>hellojsf.TemperatureConvertor</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

</faces-config>

My plugin has the following hierarchy:

plugin-name
---src
------class package
---------Activator.java
---------Application.java
---------ApplicationActionBarAdvisor.java
---------ApplicationWorkbenchWindowAdvisor.java
---------Perspective.java
---------TemperatureConvertor.java
---------TemperatureServlet.java
---META-INF
------MANIFEST.MF
---resources
-------WebContent
----------WEB-INF
-------------faces-config.xml
-------------web.xml
----------Convertor.jsp
---plugin.xml

In Activator class, method start(), I have started the web server like this:

public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;

Bundle bundle = Platform.getBundle("org.eclipse.equinox.http.registry");
if (bundle.getState() == Bundle.RESOLVED) {
bundle.start(Bundle.START_TRANSIENT);
}

Dictionary settings = new Hashtable();
settings.put("http.enabled", Boolean.TRUE);
settings.put("http.port", 8080);
settings.put("http.host", "0.0.0.0");
settings.put("https.enabled", Boolean.FALSE);
settings.put("context.path", "/");
settings.put("context.sessioninactiveinterval", 1800);

try {
JettyConfigurator.startServer(PLUGIN_ID + ".jetty", settings);
} catch (Exception e) {
e.printStackTrace();
}
}


To this plugin I have added also the following libraries:
- JSTL: javax.servlet.jsp.jstl-1.2.1-javadoc.jar; javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar
- JSF 2.0 (Apache MyFaces JSF Core-2.0 API 2.0.2)

After I launch the application, if I type in my browser:
localhost:8080/temperature

It doesn't know where to find Convertor.jsp.
My question is: how can I configure this plugin to know the resource location WebContent and the most important, how can I configure the plugin to know how to process JSFs and to know about the faces-config.xml and web.xml.

Can I, for example, when I define the extension org.eclipse.equinox.http.registry.servlets, do something like this?
class: javax.faces.webapp.FacesServlet
alis: /*.jsp

(all the files *.jsp to be processed by the FacesServlet)?

Thank you very much and sorry if the questions are silly, but I am new in this area of RCP plugins, Jetty and JSF.
Re: Eclipse RCP plugin + embedded Jetty + JSF [message #892917 is a reply to message #892916] Sun, 01 July 2012 21:02 Go to previous message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

Elena, this forum is meant for posting Job opportunities for Eclipse related technologies, not a place for techincal issues.

Please post your problem at the RCP forum : http://www.eclipse.org/forums/index.php/f/106/
Previous Topic:Eclipse RCP/RAP Development Services
Next Topic:Eclipse RCP Developer - Full Time - Esprow - Singapore or Remote
Goto Forum:
  


Current Time: Mon Dec 22 23:42:52 GMT 2014

Powered by FUDForum. Page generated in 0.02259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software