zoukankan      html  css  js  c++  java
  • Jython Interactive Servlet Console YOU WILL NEVER KNOW IT EXECLLENT!!! GOOD

    Jython Interactive Servlet Console


    Jython Interactive Servlet Console

    [Download] [License]
             Questions or Feedback? Send email to Vishal Goenka


    Q> What is Jython Interactive Servlet Console?

    A> It is an interactive Jython Console implemented as a Servlet, hence executable in a web server and
    accessible using a web browser.

    Q> Why do I need it?

    A> Well, I often use Jython for debugging/testing my Java application code. The command line version isn't
    deployable in a web server for web applications, so testing/troubleshooting in a running Web container is not an
    option with the standard Jython Interactive console.

    Q> How is this different from the Jython Servlet?

    A> The Jython Servlet can be used to run your Jython code in a WebServer as a servlet. It compiles as
    a Servlet, so it has access to the HttpServletRequest and such, which is useful for certain applications. However,
    it is not interactive, it requires you to have access to the server so you can upload the file after modifying it,
    and it requires that you explicitly print anything you want to see in the output. The Jython
    Interactive Servlet Console
    on the other hand does not give you access to HttpServletRequest objects and
    such, since it does not expose a servlet interface. However, it offers the interactivity and ease of use of a
    normal Jython console in a web environment.

    Q> How do you invoke Jython in this environment?

    A> When you access the Jython Interactive Servlet Console, you will see the usage screen as follows:

    Use the following syntax to pass any command line arguments to the Jython Interpreter,
    or simply press the submit button to launch the interpreter without any arguments. 
    
    Syntax: [options] [-jar jar | -c cmd | file ] [args]
    
    Options and arguments:
    -i       : inspect interactively after running script
    -S       : don't imply `import site' on initialization
    -v       : verbose (trace import statements)
    -Dprop=v : Set the property `prop' to value `v'
    -c cmd   : program passed in as string (terminates option list)
    -W arg   : warning control (arg is action:message:category:module:lineno)
    -E codec : Use a different codec the reading from the console.
    file     : program read from script file
    --help   : print this usage message and exit
    --version: print Jython version number and exit
    args     : arguments passed to program in sys.argv[1:]
    	

     

    You may enter any arguments in the command window at the bottom and submit, or simply enter submit to start Jython
    without any command arguments. These arguments are a subset of the arguments accepted by the command line version
    of the Jython Console. Note: Any file arguments will be relative to the server path, rather than the client
    path.

    Q> How do I install the Jython Interactive Servlet Console?

    Installation requires some knowledge of the web.xml deployment descriptors used for servlet deployments and
    assumes that you are familiar with Jython somewhat. You may use the binary
    download
    of jython.jar that contains the Java code for the servlet or build Jython from its CVS
    sources. Copy the following files relative to the webapps directory.

     

         JyCommandWindow.html
         JyConsole.jsp
         JyConsoleFrame.html
         JyLauncher.jsp
         JyTitleWindow.html
         WEB-INF/lib/jython.jar
    	


    Next merge the web.xml.fragment from the binary download with your
    application's web.xml to register the Jython Interactive Servlet Console. Finally, copy your existing jython
    registry file in the WEB-INF/lib directory and modify the paths according to the server environment.
    You may also copy the lib directory from your existing jython installation as it is under
    WEB-INF/lib.

    You are now ready to access the Jython Interactive Servlet Console by entering the URL that you associate with
    it in the web.xml. It should default to http://your.server.com/app-prefix/jython.

    Q> How do I build the Jython Interactive Servlet Console?

    A> You must download the jython source from its CVS repository and make sure you can build jython before you
    merge the code for the Jython Interactive Servlet Console. There are only two Java source files required by the
    Jython Interactive Servlet Console. These files are:
     

          src/org/python/util/InteractiveServlet.java
          src/org/python/util/Text2Html.java
    	

    The HTML/JSP files are deployed at the root of the webapp, but are not required during the build.

    Q> How do I use the Jython Interactive Servlet Console?

    A> Using the Jython Interactive Servlet Console is quite intuitive. See the following screen shot, annotated
    with relevant help.


    Download

    Download the binary distribution, which is packaged as a zip
    file. On Unix/Linux environments, simply use jar to unzip the file.

    This download is Not an official distribution. It was built from the CVS source of Jython on
    November 15, 2003 using JDK 1.3.1. It contains the following files:


    	JyCommandWindow.html
    	JyConsole.jsp
    	JyConsoleFrame.html
    	JyLauncher.jsp
    	JyTitleWindow.html
    	WEB-INF/lib/jython.jar
    	web.xml.fragment

    	src/org/python/util/InteractiveServlet.java
    	src/org/python/util/Text2Html.java
    	


    If you wish to merge this with the official binary download, you can unjar jython.jar from this distribution
    and include org.python.util.InteractiveServlet*.class and org.python.util.Text2Html.class in
    your existing jython.jar. It may work if there are no conflicting changes, but I cannot guarantee that.

    License

    You are welcome to use the source code or the binary distribution in any manner you deem fit as long as you
    retain the copyright in the source code. This code comes with no warranty, whatsoever. It is provided "AS IS",
    and you must use it at your own risk.

    If you are one of the Jython authorities yourself, and would like this to be included in the codebase, please
    send me an email at vgoenka@hotmail.com.

  • 相关阅读:
    MYSQL数据库查看被锁状态以及解锁
    MongoDB命令
    代码重构
    笔试常见之C类型转换
    WeakReference(弱引用)(转)
    Linux ubuntu16.04下vim的安装与配置
    mysql Access denied for user root@localhost之错误解决方法(错误码:1045)
    mysql服务无法启动报错1067解决办法 (mysql启动错误1067)
    js的ajax封装
    windows下apache tomcat整合
  • 原文地址:https://www.cnblogs.com/lexus/p/2372408.html
Copyright © 2011-2022 走看看