Servlet in Orion server [message #1037981] |
Wed, 10 April 2013 04:49  |
Eclipse User |
|
|
|
Hi,
We are using Orion client and server.
We have downloaded the source code to eclipse IDE.
We need to do the following sequence:
User writes code in the Orion editor->user clicks on a button->http request is being sent to the Orion server->Orion server should notify via http to another server.
I need to implement the code that listen in the Orion server to the http request from the editor and send and http request to the other server.
We thought on doing it by adding a new servlet to org.eclipse.orion.server.servlets.
My servlet name is :serverNew.js and it contains a doGet function.
How do I run a servlet in Orion? I don't understand how should the serverNew.js and the doGet function should be run? What is the mechanism?
As far as I know we should configure a key/value in some xml, is this is the case here? If yes where should I do it?
I saw that there is a NewFileServlet.java servlet with doGet, but I don't understand how does the doGet is being activated?
Also, is there an API to work with servlets in Orion?
Thank you very much,
Tsahar
|
|
|
Re: Servlet in Orion server [message #1041862 is a reply to message #1037981] |
Mon, 15 April 2013 13:19  |
Eclipse User |
|
|
|
For this use case, a servlet filter is better. Each servlet handles requests against a particular resource path, like /file, /search, etc. A filter lets you intercept requests to some path and do some pre- or post-processing. Most of the details here are just standard Java EE programming and don't require any special knowledge of Orion. You can start by looking at the Java EE documentation for details:
http://docs.oracle.com/javaee/5/api/javax/servlet/Filter.html
There are quite a few filter implementations in Orion that you can also take a look at. A very simple example is WelcomeFileFilter, which redirects requests ending in a slash (/) to index.html.
John
|
|
|
Powered by
FUDForum. Page generated in 0.02652 seconds