Advanced web: mod_fastcgi / suexec

Hello,
MacMini OS X server 10.6x, Apache/2.2.17 (Unix), mod_fastcgi/2.4.2
I'm a novice fastCGI user here and only am begginning to learn about Mac OSX Server. I am O.K. with apache config in a *nix environment. I have set up "PHP-like" fcgi apps on occasion to utilize suexec for added security (on linux systems).. however, I couldn't get this to work on SL Server.  I am guessing it is because suexec appears not to be installed by default (and the docs below say the use of "FastCgiWrapper" require suexec support?? but not sure).
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiWrapper
Example Apache Error:
[Sun Jul 03 14:02:31 2011] [alert] [client xxx.xxx.xxx.xxx] /Library/WebServer/Documents/fastcgitest/www/.htaccess: Invalid command 'FCGIWrapper', perhaps misspelled or defined by a module not included in the server configuration
Before I go trying to add suexec or muddle my way into trouble, I thought I'd make a post to see if someone can explain the basis behind SL Server's apache2 implimentation of secure hosting environements. What takes place of suexec if suexec is not installed by default?
Thx,
Donovan

Hello,
MacMini OS X server 10.6x, Apache/2.2.17 (Unix), mod_fastcgi/2.4.2
I'm a novice fastCGI user here and only am begginning to learn about Mac OSX Server. I am O.K. with apache config in a *nix environment. I have set up "PHP-like" fcgi apps on occasion to utilize suexec for added security (on linux systems).. however, I couldn't get this to work on SL Server.  I am guessing it is because suexec appears not to be installed by default (and the docs below say the use of "FastCgiWrapper" require suexec support?? but not sure).
http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiWrapper
Example Apache Error:
[Sun Jul 03 14:02:31 2011] [alert] [client xxx.xxx.xxx.xxx] /Library/WebServer/Documents/fastcgitest/www/.htaccess: Invalid command 'FCGIWrapper', perhaps misspelled or defined by a module not included in the server configuration
Before I go trying to add suexec or muddle my way into trouble, I thought I'd make a post to see if someone can explain the basis behind SL Server's apache2 implimentation of secure hosting environements. What takes place of suexec if suexec is not installed by default?
Thx,
Donovan

Similar Messages

  • How do I disable guest access in the advanced web controls? E2000

    Due to cisco connect not connecting and my rouer having some problems I have reset it and gone straight into the advanced web control panel. I have everything set up and running, but I see no way to turn off guest access. I do not want any "guests" to be able to access my  E2000 router, how do I disable that in the advanced web control panel?

    sabertooth is correct. The Guest network is managed by Cisco connect software only.
    You can reset the router and reconfigure it manually.
    Press and hold the reset button on the router for 30 seconds. Release the reset button and wait for 30 seconds. Power cycle the router and reconfigure it manually.

  • Did not found advanced web part gallery and options in web part categories when tried to add a webpart in webpart page

    HI
    I created a web part page and try to add a web part
    in web part categories  i did not found advanced web part gallery and options 
    how i  found this optino
    adil

    Hi,
    In SharePoint 2010, the “Advanced Web Part Gallery and Options” is gone, you can add web part into page in SharePoint 2010 like this:
    Add, move, minimize, or delete a Web Part from a page
    https://support.office.com/en-ca/article/Add-move-minimize-or-delete-a-Web-Part-from-a-page-d5d533c3-db66-4105-a5e8-8ae15fb60087
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • Beginner looking for route to advanced web design

    Hi.  I'm an IBM web programmer.  I am very well versed in html, css, and javascript.  I have been using those three to develop for the web for about two years now.  Currently, I'm looking to start designing web sites with flash.  I don't really care about banners and other things yet.  I just want to get to the point where I can create great looking flash websites.  I am starting a subscription to lynda.com today and will be watching as many tutorials as possible.
    So far, I've figured out how to create an extremely basic website, but I want to go from that to things like BK design's website.  Will I need anything more than flash and photoshop for sites like this?  I currently have photoshop and flash CS3 versions.  How important is it that I upgrade to CS4?
    I'm a lot more experienced with photoshop.  So, things in flash like layers have been pretty easy to get used to.  I've used motion tweens and actionscript (which so far is very similar to javascript).  What are methods and strategies that I need to educate myself on to get to the advanced level of website design?

    Flex uses an XML based "language of convience" called mxml. Mxml translates to actionscript much like jscript translates to Java. A typically page consist of mxml with sections of actionscript.  Flex has no timeline and is more of a developers tool it's designed to integrate with well with middleware and has a larger set of components.  In some ways it's a lot like ASP.net.

  • Advanced Web Dynpro Training Scheduled

    SAP has scheduled JA312 Advanced Java Web Dynpro.  Virtual Training course, March 21st.  Please enroll now!
    https://training.sap.com/course/ja312-advanced-java-web-dynpro-classroom-062-us-en/#course-details_content

    This link works a little better:   https://training.sap.com/course/ja312-advanced-java-web-dynpro-classroom-062-us-en/

  • Advanced Web Gallery CS4

    I have recently upgraded from CS2. I have a handful of these galleries on the same site I created using CS2. I have modified them heavily from what CS2 would do. In reality I only used the Thumbnails, Images and the XML file that were created. Even then I wrote a php file that rewrote the xml file to my needs.
    When upgrading to CS4 I found that I liked the Lightroom Flash gallery. It is better than what I created in the past it is, well, Flashier .
    I can modify it almost enough to get it to do what I want it to except one thing: Create more than a 'view' menu item.
    Without decompiling the swf file is there a way to modify the Events?
    When creating the gallery there are 3 XML files created:
    style.xml <!-- Defines CSS Styles
    group.xml <!-- In addition to containing all info leading to images within the gallery it contains some Info:
            <custom>
                <siteTitle>My Site Name Here</siteTitle>
                <groupTitle>This is the title of the gallery</groupTitle>
                <groupDescription>This is the description.....</groupDescription>
                <contactName>This is the name Displayed</contactName>
                <contactEmail>This is the email you get when clicking the above displayed name</contactEmail>
            </custom>
    These can be changed to change the text that is displayed on the Gallery.
    localText.xml <!-- Contains:
    <localization>
        <galleryMenus>
    <!-- I created the following Menu Item and it shows up. It just doesn't
    do anything without an event -->
           <menuitem label="Awwww" event="MenuView">
                <menuitem label="Come On!!!!" type="radio" event="MenuViewSomething"/>
            </menuitem>
    <!-- End -->
            <menuitem label="View" event="MenuView">
                <menuitem label="Gallery" type="radio" event="MenuViewGallery"/>
                <menuitem label="Slideshow" type="radio" event="MenuViewSlideshow"/>
                <menuitem label="Separator" event="Separator"/>
                <menuitem label="About this Gallery" type="radio" event="MenuViewAbout"/>       
            </menuitem>
        </galleryMenus>
    </localization>
    The javafiles files need no modification to help me in my aim.

    I think the problem is that the options in the output module are too limited in how far they can be customised without getting into the code.
    Personally I use other programs to generate sites quickly or create them myself.

  • Personal Web Sharing and Filemaker Server Advanced

    After migrating from FileMaker Server-7 Advanced and installing version-8 Advanced web components (w/Easy Install) and restarting the Mac, Personal Web Sharing refuses to activate. I also cannot access the Filemaker Admin Console to create the FMSA account to register it with the database server.
    OSX Console log listed this error below when trying to start Apace with Personal Web Sharing:
    Syntax error on line 1 of /Library/FileMaker Server/Web Publishing/web-configuration/WEB-INF/conf/mod_jk.conf:
    Cannot load /usr/libexec/httpd/modjkfm.so into server: (reason unknown)
    /usr/sbin/apachectl start: httpd could not be started
    Line 1 of the mod_jk.file reads:
    LoadModule jkfmmodule libexec/httpd/modjkfm.so
    What needs to be corrected so I can start web sharing and access the FileMaker Web Publishing Engine in the browser?
    Using Mac OSX 10.4.6 on Mac Mini w/Intel dual core

    Apache is trying to load modjkfm.so which should be stored in /usr/libexec/httpd, but it isn't.
    This file should be installed by the Filemaker Server installer. If it wasn't installed by the Easy Install option, check the other install options to see if it's there.

  • Sharepoint web analytics does not show any data

    Hello,
    We installed Sharepoint Web Analytics some days ago (separated application pool).
    Installation completed successfully.
    Search works fine and returns expected results.
    But reports still don't show any data :
    Data Last Updated: 15.08.2014 02:00:16 There is no data available for this report. Here are some possible reasons: (1) Web Analytics has not been enabled long enough to generate data; (2)
    There is insufficient data to generate this report; (3) Data logging required for this report might not be enabled; (4) Data aggregation might not be enabled at the level required for this report.
    What I tried :
    connect to website using different users (admin user included)
    checked that needed services on server are started (especially analytics services)
    restart services Web Analytics Data Processing Service and
    Web Analytics Web Service
    checked that all services applications are started (WSS_UsageApplication status was
    stopped so I started it using Sharepoint 2010 Management Shell)
    checked service application associations (especially if Analytics Service Application Proxy is checked)
    manual execution of jobs (Web Analytics Trigger Workflows Timer Job, Microsoft SharePoint Foundation Usage Data Import, Microsoft SharePoint Foundation Usage Data Processing)
    manual start of incremental crawling
    restart IIS
    checked scope of data logging (especially if Enable usage data collection and
    Enable health data collection are checked)
    checked that the .usage file are generated correctly on the disk
    checked in the Logging database (WSS_UsageApplication) that the
    RequestUsage view contains data collected from the .usage files
    checked that data is successfully extracted from the logging database into the staging database (LastLoggingExtractionTime)
    checked that data was successfully copied from the staging database to the reporting database (LastDataCopyTime)
    checked on the website side that Advanced Web Analytics feature is
    Active
    recreate web analytics application
    checked for any message in ULS logs that could help... I only noticed that error :
    The SharePoint Health Analyzer detected an error.  Drives are running out of free space.  Available drive space is less than twice the value of physical memory. Can it cause the problem ?
    All appears to work fine but I can't see any data in the reports.
    The thing is that Inventory data is collected successfully and I can see the related reports. Traffic and Search data are still empty.
    Anything else I can try ?
    Thanks.

    Yes I have granted application pool identity full control on the Web Analytics Service Application.
    I also checked that Sharepoint 2010 timer service is started.
    I can't see anything in the logs that could help, when accessing the reports. The only thing I noticed is this kind of log which occurs
    regularly and seems to be an exception :
    Enumerating all sites in SPWebApplication Name=SharePoint - 80.
    Site Enumeration Stack:
    at Microsoft.SharePoint.Administration.SPSiteCollection.get_Count()
    at Microsoft.SharePoint.Taxonomy.UpdateHiddenListJobDefinition.Execute(Guid targetInstanceId)
    at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result)
    at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result)
    Maybe it can be the cause ?
    I have also cleaned the drive where .usage file are generated so the error "Drives are running out of free space.  Available drive space is less than twice the value of physical memory." does not appear anymore.

  • Error while installing web tier on soalaris X86-64 bit

    Hi All,
    I want to install Oracle WEB TIER(HTTP server and oracle web cache), but in the step that "Specify WebLogic Domain", I obtain the following error.
    INST- 07281: JRF is not setup in the specified domain
    - Enter a domain wich has JRF setup.
    Then I tried to extend current domain with JRF product support to enable web cache. But I am not getting the JRF option when I extend my domain or create a new domain. I am getting only 3 options on the domain creation page:
    1. Basic WebLogic server Domain
    2. Weblogic advanced Web Services for JAX-RPC Extension
    3. Weblogic advanced Web Services for JAX-WS Extension
    I am using WebLogic Server Version: 10.3.5.0 installed in production mode and using latest java jdk1.6.0_21. I am getting those option in Windows platform but not on Solaris!!!!
    To resolve this i tried to install Oracle Application Development Runtime 11.1.1.2.xxx (and 11.1.1.3.xxx)
    from http://www.oracle.com/technetwork/middleware/downloads/fmw-11-download-092893.html
    But it is also failing giving an error “cannot execute” –
    *./runInstaller: /export/home/weblogic/WEBTIER/Application_Development_Runtime_v12/Disk1/install/solaris/runInstaller: cannot execute*
    Any idea about this error or how to install Oracle WEB TIER on Solaris X86 (64 bit)???
    Thanks,
    Anshul
    Edited by: user13566109 on Apr 2, 2012 3:39 AM

    Hi Cris,
    Thanks for reply. I checked the permission, It was rwxr-xr-x.
    Then I changed to 0777 i.e. to rwxrwxrwx But no effect....
    Do you think that is there any possibility that Application Development Runtime version 11.1.2.0 and 11.1.3.0 are not compatible with Solaris X86- 64 bit environment?
    I downloaded files from http://www.oracle.com/technetwork/middleware/downloads/fmw-11-download-092893.html.
    Also I am trying to use 11.1.1.6 from -
    http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html
    Do you have any idea how to install JRF to weblogic?
    I am trying to install this from " Application Development Runtime" or shall I try with "SOA module- ofm_soa_generic_11.1.1.2.0_disk1_1of1"???
    Thanks,
    Anshul

  • Problem with Adobe 9.5.2 stalling when appending Web Links

    Every time I go to append a multi-level web link to a PDF using Adobe Acrobat Pro 9.5.2 it stalls (this problem also occurs on a computer I have with Adobe Acrobat Pro 9.2 installed). I have tried repairing the program, installing updates, and restarting the computer with no luck. This problem only started happening 5 days ago after using the program with no problems for over a year. How can I fix this?   Steps to reproduce the problem: 1. Open PDF. 2. Click on Advanced > Web Capture > View Web Links 3. Select desired web link > click "Properties" > chose number of levels or entire site > Press OK 4. Select desired web link again > click on Download   Results: Adobe starts to convert the web link for a few seconds and then stalls for hours with no success on a web link that previously only took two minutes to convert a week ago. Sometimes it will crash and I get the message "Adobe Acrobat has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available."   Expected results: To be able to append the multi-level web link to the PDF.

    Hi Jamie,
    I was able to reproduce this crash. I've logged a bug with our engineering team.  When I hear more, I'll update this thread.
    I do not have a workaround for this issue at this time.
    -David

  • BI 7 Web template - HIERARCHICAL_FILTER_ITEM

    Can I show hierarchies which are defined in a Web Template using HIERARCHICAL_FILTER_ITEM as collapsed and also like a drop down box? Thanks

    Hi,
    check these posts
    Re: Freeze a Column in WAD (Web Application Designer)
    Re: **Urgent** Freeze Columns on the Web Template on BI 7.0
    See these docs
    Web template creation for beginners
    Advanced Web Reporting with SAP BW
    Web Application and Query Design FAQ
    Tips and Tricks for SAP BIusiness Intelligence Web Applications
    How to Enhance SAP BEx Web Analyzer (0ANALYSIS_PATTERN)

  • Trying to activate the Web Inspector in Safari on my iPad

    When I turn the Web Inspector "on" (Settings->Safari->Advanced->Web Inspector "switch" to "on" state), it tells me the following (under the Web Inspector option):
    "To use Web Inspector, connect to Safari on your computer using a cable and access your iPad from the Develop menu."
    I am connected using a 30pin to USB cable (that came with my iPad, that I use to sync using iTunes).  I have the Develop menu in Safari on my computer (enabled it long ago).  So, how do I "access [my] iPad from the Develop menu" (presumably from Safari on my computer)?
    I don't see anything that looks like some "connect to iPad", or some such, within the Develop menu in Safari on my computer.
    Thanks in advance.
    David

    What generation iPad?
    What is the iOS version?
    You need to be signed into iCloud with the same Apple ID on both devices:
    Mac: System Preferences > iCloud
    iOS: Setting > iCloud
    and make sure sync for Safari is turned on:
    Mac: System Preferences > iCloud > check the Safari box
    iOS: Setting > iCloud > turn Safari on

  • Print PDF file with the lay out created in the BEx web application designer

    Got the following questions (problems) when print a web report created in BEx Web Application Designer to a PDF file:
    1. The tile (which has a company logo and report name in it) was not printed, is it possible to print a title (with company logo) on each page of the PDF file?
    2. Want print the filters that have value specified on the PDF file, is it possible to do this?
    Any help is appreciated, thanks.

    Hi Simon,
    you can achieve this requirement i.e. using this way of implementation:
    1. Create a new template which contains the required fields (company logo etc) and set the visibility of the top container to "hidden". Add a empty data provider to this template and add the filter values (variable names) you want to display on the PDF. However be aware that the name for the (empty) data provider must match the name of the data provider within the original template you want to print.
    2. Open your original template and include the template you created in step 1 (Advanced: Web Templates). Choose the appropriate location (above/below the analysis item.
    3. Check the settings of your export command: do not set a special web item to be printed.
    If you export the template within web the second template should be printed correctly.
    Brgds,
    Marcel

  • Writing a web server.

    i am trying to write a tiny web server, with a gui, and want the gui to be a able to stop and start the server, the server is in a separate class called web server, and i need some code to destroy the instance of the class. thx in advance.

    web server code
    package tinywebserver;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class WebServer implements HttpConstants {
        /* static class data/methods */
        /* print to stdout */
        protected static void p(String s) {
            GUI.main.append(s + "\n");
            System.out.println(s);
        /* our server's configuration information is stored
         * in these properties
        protected static Properties props = new Properties();
        /* Where worker threads stand idle */
        static Vector threads = new Vector();
        /* the web server's virtual root */
        static File root;
        /* timeout on client connections */
        static int timeout = 0;
        /* max # worker threads */
        static int workers = 5;
        //port to serve from
        static int port = 8080;
        /* load www-server.properties from java.home */
        static void loadProps() throws IOException {
            File f = new File("server.properties");
            if (f.exists()) {
                InputStream is =new BufferedInputStream(new
                               FileInputStream(f));
                props.load(is);
                is.close();
                String r = props.getProperty("root");
                if (r != null) {
                    root = new File(r);
                    if (!root.exists()) {
                        throw new Error(root + " doesn't exist as server root");
                r = props.getProperty("timeout");
                if (r != null) {
                    timeout = Integer.parseInt(r);
                r = props.getProperty("workers");
                if (r != null) {
                    workers = Integer.parseInt(r);
                r = props.getProperty("serverPort");
                if (r != null) {
                    port = Integer.parseInt(r);
            /* if no properties were specified, choose defaults */
            if (root == null) {
                root = new File(System.getProperty("user.dir")+File.separator+"html");
            if (timeout <= 1000) {
                timeout = 5000;
            if (workers < 25) {
                workers = 5;
        static void printProps() {
            p("Tiny Web Server Starting on " + System.getProperty("os.name") +" "+System.getProperty("os.arch"));
            p("root="+root);
            p("timeout="+timeout);
            p("workers="+workers);
            p("port="+port);
        public static void start() throws Exception{
            loadProps();
            printProps();
            /* start worker threads */
            for (int i = 0; i < workers; ++i) {
                Worker w = new Worker();
                (new Thread(w, "worker #"+i)).start();
                 threads.addElement(w);
            ServerSocket ss = new ServerSocket(port);
            while (true) {
                Socket s = ss.accept();
                Worker w = null;
                synchronized (threads) {
                    if (threads.isEmpty()) {
                        Worker ws = new Worker();
                        ws.setSocket(s);
                        (new Thread(ws, "additional worker")).start();
                    }else {
                        w = (Worker) threads.elementAt(0);
                        threads.removeElementAt(0);
                        w.setSocket(s);
    class Worker extends WebServer implements HttpConstants, Runnable {
        final static int BUF_SIZE = 2048;
        static final byte[] EOL = {(byte)'\r', (byte)'\n' };
        /* buffer to use for requests */
        byte[] buf;
        /* Socket to client we're handling */
        private Socket s;
        Worker() {
            buf = new byte[BUF_SIZE];
            s = null;
        synchronized void setSocket(Socket s) {
            this.s = s;
            notify();
        public synchronized void run() {
            while(true) {
                if (s == null) {
                    /* nothing to do */
                    try {
                        wait();
                    } catch (InterruptedException e) {
                        /* should not happen */
                        continue;
                try {
                    handleClient();
                } catch (Exception e) {
                    e.printStackTrace();
                /* go back in wait queue if there's fewer
                 * than numHandler connections.
                s = null;
                Vector pool = WebServer.threads;
                synchronized (pool) {
                    if (pool.size() >= WebServer.workers) {
                        /* too many threads, exit this one */
                        return;
                    } else {
                        pool.addElement(this);
        void handleClient() throws IOException {
            InputStream is = new BufferedInputStream(s.getInputStream());
            PrintStream ps = new PrintStream(s.getOutputStream());
            /* we will only block in read for this many milliseconds
             * before we fail with java.io.InterruptedIOException,
             * at which point we will abandon the connection.
            s.setSoTimeout(WebServer.timeout);
            s.setTcpNoDelay(true);
            /* zero out the buffer from last time */
            for (int i = 0; i < BUF_SIZE; i++) {
                buf[i] = 0;
            try {
                /* We only support HTTP GET/HEAD, and don't
                 * support any fancy HTTP options,
                 * so we're only interested really in
                 * the first line.
                int nread = 0, r = 0;
    outerloop:
                while (nread < BUF_SIZE) {
                    r = is.read(buf, nread, BUF_SIZE - nread);
                    if (r == -1) {
                        /* EOF */
                        return;
                    int i = nread;
                    nread += r;
                    for (; i < nread; i++) {
                        if (buf[i] == (byte)'\n' || buf[i] == (byte)'\r') {
                            /* read one line */
                            break outerloop;
                /* are we doing a GET or just a HEAD */
                boolean doingGet;
                /* beginning of file name */
                int index;
                if (buf[0] == (byte)'G' &&
                    buf[1] == (byte)'E' &&
                    buf[2] == (byte)'T' &&
                    buf[3] == (byte)' ') {
                    doingGet = true;
                    index = 4;
                } else if (buf[0] == (byte)'H' &&
                           buf[1] == (byte)'E' &&
                           buf[2] == (byte)'A' &&
                           buf[3] == (byte)'D' &&
                           buf[4] == (byte)' ') {
                    doingGet = false;
                    index = 5;
                } else {
                    /* we don't support this method */
                    ps.print("HTTP/1.0 " + HTTP_BAD_METHOD +
                               " unsupported method type: ");
                    ps.write(buf, 0, 5);
                    ps.write(EOL);
                    ps.flush();
                    s.close();
                    return;
                int i = 0;
                /* find the file name, from:
                 * GET /foo/bar.html HTTP/1.0
                 * extract "/foo/bar.html"
                for (i = index; i < nread; i++) {
                    if (buf[i] == (byte)' ') {
                        break;
                String fname = (new String(buf, 0, index,
                          i-index)).replace('/', File.separatorChar);
                if (fname.startsWith(File.separator)) {
                    fname = fname.substring(1);
                File targ = new File(WebServer.root, fname);
                if (targ.isDirectory()) {
                    File ind = new File(targ, "index.html");
                    if (ind.exists()) {
                        targ = ind;
                boolean OK = printHeaders(targ, ps);
                if (doingGet) {
                    if (OK) {
                        sendFile(targ, ps);
                    } else {
                        send404(targ, ps);
            } finally {
                s.close();
        boolean printHeaders(File targ, PrintStream ps) throws IOException {
            boolean ret = false;
            int rCode = 0;
            if (!targ.exists()) {
                rCode = HTTP_NOT_FOUND;
                ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " not found");
                ps.write(EOL);
                ret = false;
            }  else {
                rCode = HTTP_OK;
                ps.print("HTTP/1.0 " + HTTP_OK+" OK");
                ps.write(EOL);
                ret = true;
            p("\nRequest from " +s.getInetAddress().getHostAddress()+": GET " + targ.getAbsolutePath()+"-->"+rCode);
            ps.print("Server: Simple java, Tiny Web Server");
            ps.write(EOL);
            ps.print("Date: " + (new Date()));
            ps.write(EOL);
            if (ret) {
                if (!targ.isDirectory()) {
                    ps.print("Content-length: "+targ.length());
                    ps.write(EOL);
                    ps.print("Last Modified: " + (new
                                  Date(targ.lastModified())));
                    ps.write(EOL);
                    String name = targ.getName();
                    int ind = name.lastIndexOf('.');
                    String ct = null;
                    if (ind > 0) {
                        ct = (String) map.get(name.substring(ind));
                    if (ct == null) {
                        ct = "unknown/unknown";
                    ps.print("Content-type: " + ct);
                    ps.write(EOL);
                } else {
                    ps.print("Content-type: text/html");
                    ps.write(EOL);
            return ret;
        void send404(File targ, PrintStream ps) throws IOException {
            ps.write(EOL);
            ps.write(EOL);
            ps.println("404 error, the requested object was not found\n\n"+
                       "The requested resource was not found.\n\n\nTiny Web Server has encountered an error.");
        void sendFile(File targ, PrintStream ps) throws IOException {
            InputStream is = null;
            ps.write(EOL);
            if (targ.isDirectory()) {
                listDirectory(targ, ps);
                return;
            } else {
                is = new FileInputStream(targ.getAbsolutePath());
            try {
                int n;
                while ((n = is.read(buf)) > 0) {
                    ps.write(buf, 0, n);
            } finally {
                is.close();
        /* mapping of file extensions to content-types */
        static java.util.Hashtable map = new java.util.Hashtable();
        static {
            fillMap();
        static void setSuffix(String k, String v) {
            map.put(k, v);
        static void fillMap() {
            setSuffix("", "content/unknown");
            setSuffix(".uu", "application/octet-stream");
            setSuffix(".exe", "application/octet-stream");
            setSuffix(".ps", "application/postscript");
            setSuffix(".zip", "application/zip");
            setSuffix(".sh", "application/x-shar");
            setSuffix(".tar", "application/x-tar");
            setSuffix(".snd", "audio/basic");
            setSuffix(".au", "audio/basic");
            setSuffix(".wav", "audio/x-wav");
            setSuffix(".gif", "image/gif");
            setSuffix(".jpg", "image/jpeg");
            setSuffix(".jpeg", "image/jpeg");
            setSuffix(".htm", "text/html");
            setSuffix(".html", "text/html");
            setSuffix(".text", "text/plain");
            setSuffix(".c", "text/plain");
            setSuffix(".cc", "text/plain");
            setSuffix(".c++", "text/plain");
            setSuffix(".h", "text/plain");
            setSuffix(".pl", "text/plain");
            setSuffix(".txt", "text/plain");
            setSuffix(".java", "text/plain");
        void listDirectory(File dir, PrintStream ps) throws IOException {
            ps.println("<TITLE>Directory listing</TITLE><P>\n");
            ps.println("<A HREF=\"..\">Parent Directory</A><BR>\n");
            String[] list = dir.list();
            for (int i = 0; list != null && i < list.length; i++) {
                File f = new File(dir, list);
    if (f.isDirectory()) {
    ps.println("<A HREF=\""+list[i]+"/\">"+list[i]+"/</A><BR>");
    } else {
    ps.println("<A HREF=\""+list[i]+"\">"+list[i]+"</A><BR");
    ps.println("<P><HR><BR><I>Tiny Web Server on "+ port + " at " + (new Date()) + "</I>");
    interface HttpConstants {
    /** 2XX: generally "OK" */
    public static final int HTTP_OK = 200;
    public static final int HTTP_CREATED = 201;
    public static final int HTTP_ACCEPTED = 202;
    public static final int HTTP_NOT_AUTHORITATIVE = 203;
    public static final int HTTP_NO_CONTENT = 204;
    public static final int HTTP_RESET = 205;
    public static final int HTTP_PARTIAL = 206;
    /** 3XX: relocation/redirect */
    public static final int HTTP_MULT_CHOICE = 300;
    public static final int HTTP_MOVED_PERM = 301;
    public static final int HTTP_MOVED_TEMP = 302;
    public static final int HTTP_SEE_OTHER = 303;
    public static final int HTTP_NOT_MODIFIED = 304;
    public static final int HTTP_USE_PROXY = 305;
    /** 4XX: client error */
    public static final int HTTP_BAD_REQUEST = 400;
    public static final int HTTP_UNAUTHORIZED = 401;
    public static final int HTTP_PAYMENT_REQUIRED = 402;
    public static final int HTTP_FORBIDDEN = 403;
    public static final int HTTP_NOT_FOUND = 404;
    public static final int HTTP_BAD_METHOD = 405;
    public static final int HTTP_NOT_ACCEPTABLE = 406;
    public static final int HTTP_PROXY_AUTH = 407;
    public static final int HTTP_CLIENT_TIMEOUT = 408;
    public static final int HTTP_CONFLICT = 409;
    public static final int HTTP_GONE = 410;
    public static final int HTTP_LENGTH_REQUIRED = 411;
    public static final int HTTP_PRECON_FAILED = 412;
    public static final int HTTP_ENTITY_TOO_LARGE = 413;
    public static final int HTTP_REQ_TOO_LONG = 414;
    public static final int HTTP_UNSUPPORTED_TYPE = 415;
    /** 5XX: server error */
    public static final int HTTP_SERVER_ERROR = 500;
    public static final int HTTP_INTERNAL_ERROR = 501;
    public static final int HTTP_BAD_GATEWAY = 502;
    public static final int HTTP_UNAVAILABLE = 503;
    public static final int HTTP_GATEWAY_TIMEOUT = 504;
    public static final int HTTP_VERSION = 505;
    the gui is just normal gui stuff, it contains the main method

  • How to develop web service using Intellij Idea 6.0

    How to develop web services using Intellij Idea 6.x. A sample web service and service client is needed with full procedure. Thanx in advance.

    Web service is technology not a tools that bundle with IDE.
    For example you can't say how can I develope object orented program with Eclipse.
    1- You should get some general info about SOAP, WSDL and Web sevice usage
    2- Start to implmenet a simple Hello world web service and deploy it on application(web service) server
    3- Write Client code and test it.
    for step 2,3 Apache Axis(2) could be a good solution for developement or you can use JAX-WS for sun

Maybe you are looking for

  • Invoice wise cleared item in Clearing doc.

    Hi Guru, I am clearing the line item of a customer individually, around 10 line items at one item. But when I am viewing the cleared doc. in FB03 it shows me only one cleared line item with the sum of all 10 line items. Gurus please help me asap. Wil

  • Apple TV2 and Denon ARV-1911

    I would like to have step-by-step instructions on how to set up the ATV2 with the Denon ARV-1911 receiver. The TV is a Samsung 6500. I have been able to use it for Netfix. Can stream photos from my computer. But not able to stream music. Shows it is

  • Finding referenced files

    I am unable to get my referenced files to re-link to the original RAW file on my external hard drive. I have gone through many post and have experience relocating referenced files which works great when you can actually get to that screen. I have tri

  • Error : print jnlp content instead of launching application

    Hi all, I need to deploy an application (which is not mine) using java web start. I succeeded deploying 'Sun dynamic tree example', but when I try to launch my app, the browser print the jnlp content : <?xml version="1.0" encoding="UTF-8"?> <jnlp spe

  • S205 XP won't stay on standby, can't adjust screen timeout

    A couple of weeks ago I bought an S205 without OS and installed my own copy of XP on it (SP3). I spent a long time trying to dual boot with Linux but the UEFI system seems to prevent this... I'm not tech enough to understand why, but I gave up trying