Havw a search on the Wt Interest mailing list. I went through this with Wt and jython servlet. The servlet aproach is dependency and classpath hell. But it does work.

Sent from Yahoo Mail on Android



From: Debabrata Pani <debabrata.pani@gmail.com>;
To: <jython-users@lists.sourceforge.net>;
Subject: Re: [Jython-users] Trying to create a jython servlet application
Sent: Sun, Jan 5, 2014 5:42:05 PM

Hi Jython Users,


I think it answers some of my questions very well.

Regards,
Debabrata


On Sun, Jan 5, 2014 at 10:56 PM, Debabrata Pani <debabrata.pani@gmail.com> wrote:
Hi Jython Users,


I am trying to create a medium complexity servlet based web-app .
This webapp is a kind of diagnostic application that will query the status of various java services deployed in the particular server. There are quite a few services and I may plan to write one servlet for each service. I also want to organize the jython servlets in packages, just like we do with the java servlet code.


To me, it seems that the PyServlet example will only work if we directly invoke the .py in the URL .  The URL will be something like 
hostname:port/context-root/NewJythonServlet.py

If that is the case , why does the example ask us to add the servlet mapping in Listing 13-2 (of the link given above)?

Is it possible to invoke the NewJythonServlet by hitting a url like :

hostname:port/context-root/NewJythonServlet ?

The organization of the code in the final war is :

JythonWebApp
--WEB-INF
-- web.xml
-- glassfish-web.xml
----lib
------jython.jar
----classes
TestJython.py
index.jsp

and web servlet mapping is :

<servlet>
    <servlet-name>PyServlet</servlet-name>
    <servlet-class>org.python.util.PyServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>PyServlet</servlet-name>
    <url-pattern>*.py</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>TestJython</servlet-name>
    <servlet-class>TestJython</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>TestJython</servlet-name>
    <url-pattern>/TestJython</url-pattern>
</servlet-mapping>


There is a discussion about using PlyJy and some PlyJy servlets. But I don't want to go down that path.

So, is it possible to invoke the jython servlet by hitting a "non-py" URL, as asked above ? What do we need to do achieve that ?

I apologize if I overlooked something mentioned in the document or something that is very obvious to a servlet expert. 


Regards,
Debabrata Pani