From: Debabrata P. <deb...@gm...> - 2014-01-05 17:26:48
|
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. I read up the documentation given @ http://www.jython.org/jythonbook/en/1.0/SimpleWebApps.html 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> In other parts of the documentation : http://www.jython.org/jythonbook/en/1.0/DeploymentTargets.html 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 |
From: Debabrata P. <deb...@gm...> - 2014-01-05 17:42:12
|
Hi Jython Users, I got hold of this reply in this mailing list - http://python.6.x6.nabble.com/Question-about-Jython-Servlet-Development-td4689517.html I think it answers some of my questions very well. Regards, Debabrata On Sun, Jan 5, 2014 at 10:56 PM, Debabrata Pani <deb...@gm...>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. > > I read up the documentation given @ > http://www.jython.org/jythonbook/en/1.0/SimpleWebApps.html > > 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> > > > In other parts of the documentation : > http://www.jython.org/jythonbook/en/1.0/DeploymentTargets.html > 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 > > > > > |
From: Jason H <sco...@ya...> - 2014-01-05 18:49:33
|
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 |