Funkční CGI servlet. Adresa: http://hg.frantovo.cz/cgi-bin/hgweb.cgi – adresu je potřeba vylepšit!
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 16 Feb 2009 18:59:16 +0100
changeset 14bec1ea05529
parent 0 3bde60804fb7
child 2 97e5b3d7c945
Funkční CGI servlet. Adresa: http://hg.frantovo.cz/cgi-bin/hgweb.cgi – adresu je potřeba vylepšit!
java/hg-projekty/web/WEB-INF/cgi/hgweb.cgi
java/hg-projekty/web/WEB-INF/web.xml
java/hg-projekty/web/index.jsp
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/hg-projekty/web/WEB-INF/cgi/hgweb.cgi	Mon Feb 16 18:59:16 2009 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +#!/usr/bin/env python
     1.5 +#
     1.6 +# An example CGI script to use hgweb, edit as necessary
     1.7 +
     1.8 +# adjust python path if not a system-wide install:
     1.9 +#import sys
    1.10 +#sys.path.insert(0, "/path/to/python/lib")
    1.11 +
    1.12 +# enable importing on demand to reduce startup time
    1.13 +from mercurial import demandimport; demandimport.enable()
    1.14 +
    1.15 +# Uncomment to send python tracebacks to the browser if an error occurs:
    1.16 +import cgitb
    1.17 +cgitb.enable()
    1.18 +
    1.19 +# If you'd like to serve pages with UTF-8 instead of your default
    1.20 +# locale charset, you can do so by uncommenting the following lines.
    1.21 +# Note that this will cause your .hgrc files to be interpreted in
    1.22 +# UTF-8 and all your repo files to be displayed using UTF-8.
    1.23 +#
    1.24 +import os
    1.25 +os.environ["HGENCODING"] = "UTF-8"
    1.26 +
    1.27 +from mercurial.hgweb.hgweb_mod import hgweb
    1.28 +import mercurial.hgweb.wsgicgi as wsgicgi
    1.29 +
    1.30 +application = hgweb("/var/hg/projekty/pokus", "Pokus")
    1.31 +wsgicgi.launch(application)
     2.1 --- a/java/hg-projekty/web/WEB-INF/web.xml	Mon Feb 16 15:13:48 2009 +0100
     2.2 +++ b/java/hg-projekty/web/WEB-INF/web.xml	Mon Feb 16 18:59:16 2009 +0100
     2.3 @@ -1,5 +1,22 @@
     2.4  <?xml version="1.0" encoding="UTF-8"?>
     2.5  <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
     2.6 +    <servlet>
     2.7 +        <servlet-name>cgi</servlet-name>
     2.8 +        <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
     2.9 +        <init-param>
    2.10 +            <param-name>debug</param-name>
    2.11 +            <param-value>0</param-value>
    2.12 +        </init-param>
    2.13 +        <init-param>
    2.14 +            <param-name>cgiPathPrefix</param-name>
    2.15 +            <param-value>WEB-INF/cgi</param-value>
    2.16 +        </init-param>
    2.17 +        <load-on-startup>10</load-on-startup>
    2.18 +    </servlet>
    2.19 +    <servlet-mapping>
    2.20 +        <servlet-name>cgi</servlet-name>
    2.21 +        <url-pattern>/cgi-bin/*</url-pattern>
    2.22 +    </servlet-mapping>
    2.23      <session-config>
    2.24          <session-timeout>
    2.25              30
    2.26 @@ -7,5 +24,5 @@
    2.27      </session-config>
    2.28      <welcome-file-list>
    2.29          <welcome-file>index.jsp</welcome-file>
    2.30 -        </welcome-file-list>
    2.31 -    </web-app>
    2.32 +    </welcome-file-list>
    2.33 +</web-app>
     3.1 --- a/java/hg-projekty/web/index.jsp	Mon Feb 16 15:13:48 2009 +0100
     3.2 +++ b/java/hg-projekty/web/index.jsp	Mon Feb 16 18:59:16 2009 +0100
     3.3 @@ -15,6 +15,6 @@
     3.4      </head>
     3.5      <body>
     3.6          <h1>Projekty – Frantovo.cz</h1>
     3.7 -        <p>Úložiště zdrojových kódů – mercurial (Hg)…</p>
     3.8 +        <p>Úložiště zdrojových kódů – mercurial (Hg).</p>
     3.9      </body>
    3.10  </html>