Writing Java cgi for apache.

Posted on 2009-04-30
Last Modified: 2013-12-25
Hi experts,
I have a java servlet, which excepts username, password and domain values from a php file, does some authentication checks and returns a value if authentication succeds or fails using 'out.println("1") or 'out.println("0") and my php file reads these values.

Current situation: Since to run a java servlet i need a servlet container, i need to install the container in the machine where i intend to use it. But i cant do it in my present situation. Also i have to mandatorily use java as i have to extend other java classes for authentication purpose, that is the reason i have written a java servlet.  I also have a apache server installed in my system.

Q1. Now since apache has a built in support for cgi, is it possible to convert this servlet into a java cgi so that it can be called by php file and can save me from installing the servlet container.
Q2.I am very new to cgi. please let me know how can i do this.
Q3.Is it possible to do this using web services? I am very new to web services also.
Q4.Which will be the best under this situation cgi or webservices?
Q5.Any tutorials for this would be of great help (writing cgi/web services in java etc). As i have to mandatorily use java.

Please help.
Question by:sandhya01
    LVL 11

    Accepted Solution

    Check out these CGI tutorials

    You did not mention why you cannot install a servlet container?

    Author Comment

    Hi goodangel,
    I am going through the tutorials you mentioned and very thank you for that.

    For your question, I cannot install a servlet container as if i can do the same thiing using a  cgi java program, then why should i be installing a servlet container in the first place.  Also, this application is to be used by a very small user base. So ,cgi is actually reducing the amount of configuration changes i have to make in a already running system. I  want to avoid it if at all i can.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now