Transmitting and Receiving an audio file in a web server

Hello all,
How do I transmit an audio file from a Web Server as requested by a web based thin client (jsp)?
Rgds,
Seetesh

If I were to use the programs : Transmitter and Receiver
Transmitter
http://java.sun.com/products/java-media/jmf/2.1.1/solutions/RTPTransmit.html
Receiver
http://java.sun.com/products/java-media/jmf/2.1.1/solutions/AVReceive.html
Can the same be writen as either a Servlet or JSP so that the same can be executed on a Web Server?
Any workaround on the code to make it run.
Rgds,
Seetesh

Similar Messages

  • Want to Tranmit and Receive an Audio file separately. Need Help??

    Basically i m implementing OFDM (Orthogonal Frequency Division Multiplexing) and data to process is an audio (wav) file. All i want is to transmit and receive audio file with separate transmitter and reciever. Both transmitter and receiver are working in combination (i.e in single VI) but when i separated them, transmitter is giving no response. Please tell what should i do?

    Hi Zaib
    It seams that you want to receive a lot, but you are not very interesting in transmitting something Before you post some code, we can not help you. This forum will probably offer you some advices. But you will never receive a "turn key" ready application.  
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Problem with the examples of Transmitting and Receiving Custom RTP Payloads

    I have tried the examples of this web:
    http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/CustomPayload.html
    Transmitting and Receiving Custom RTP Payloads
    I run the examples all right.
    But I want to transmit the sound using my own format, so i want to change the file PcmPacketizer.java
    and PcmDepacketizer.java
    I think the sound data is in the byte[] inData ---- {byte[] inData = (byte[])inBuf.getData();}
    so i change the data with my own function, so the inData have the diffrent length:
    then i transmit the data with the packet header
    public synchronized int process(Buffer inBuf, Buffer outBuf) {
    int inLength = inBuf.getLength();
    byte[] inData = (enbase((byte[])inBuf.getData()));
    byte[] outData = (byte[])outBuf.getData();
         if (outData == null || outData.length < PACKET_SIZE) {
         outData = new byte[PACKET_SIZE];
         outBuf.setData(outData);
         // Generate the packet header.
         int rate = (int)inFormat.getSampleRate();
         int size = (int)inFormat.getSampleSizeInBits();
         int channels = (int)inFormat.getChannels();
         outData[0] = 0;     // filler
         outData[1] = (byte)((rate >> 16) & 0xff);
         outData[2] = (byte)((rate >> 8) & 0xff);
         outData[3] = (byte)(rate & 0xff);
         outData[4] = (byte)inFormat.getSampleSizeInBits();
         outData[5] = (byte)inFormat.getChannels();
         outData[6] = (byte)inFormat.getEndian();
         outData[7] = (byte)inFormat.getSigned();
         int frameSize = inFormat.getSampleSizeInBits() * inFormat.getChannels();
         // Recompute the output format if the input format has changed.
         // The crucial info is the frame rate and size. These are used
         // to compute the actual rate the data being sent.
         if (rate != (int)outFormat.getFrameRate() ||
         frameSize != outFormat.getFrameSizeInBits()) {
              outFormat = new AudioFormat(CUSTOM_PCM,
                        AudioFormat.NOT_SPECIFIED, // rate
                        AudioFormat.NOT_SPECIFIED, // size
                        AudioFormat.NOT_SPECIFIED, // channel
                        AudioFormat.NOT_SPECIFIED, // endian
                        AudioFormat.NOT_SPECIFIED, // signed
                        size * channels,     // frame size
                        rate,               // frame rate
                        null);
    if (inLength + historyLength >= DATA_SIZE) {
         // Enough data for one packet.
                   int copyFromHistory = Math.min(historyLength, DATA_SIZE);
                   System.arraycopy(history, 0, outData, HDR_SIZE , copyFromHistory);
    int remainingBytes = DATA_SIZE - copyFromHistory;
    System.arraycopy(inData, inBuf.getOffset(),
                   outData, copyFromHistory + HDR_SIZE, remainingBytes);
    historyLength -= copyFromHistory;
    inBuf.setOffset( inBuf.getOffset() + remainingBytes);
    inBuf.setLength( inLength - remainingBytes);
         outBuf.setFormat(outFormat);
         outBuf.setLength(PACKET_SIZE);
         outBuf.setOffset(0);
    return INPUT_BUFFER_NOT_CONSUMED ;
    if (inBuf.isEOM()) { // last packet
    System.arraycopy(history, 0, outData, HDR_SIZE, historyLength);
    System.arraycopy(inData, inBuf.getOffset(),
                   outData, historyLength + HDR_SIZE, inLength);
         outBuf.setFormat(outFormat);
         outBuf.setLength(inLength + historyLength + HDR_SIZE);
         outBuf.setOffset(0);
    historyLength = 0;
    return BUFFER_PROCESSED_OK;
    // Not enough data for one packet. Save the remainder
         // for next time.
    System.arraycopy(inData, inBuf.getOffset(),
                   history, historyLength,inLength) ;
    historyLength += inLength;
    return OUTPUT_BUFFER_NOT_FILLED ;
    I think I change the data use my own function debase(), so i should decode the data in the file:PcmDepacketizer.java
    but int PcmDepacketizer.java the example is so simple that i don't know how to find and change the data.
    there is only a few lines here:
    Object outData = outBuf.getData();
         outBuf.setData(inBuf.getData());
         inBuf.setData(outData);
         outBuf.setLength(inBuf.getLength() - HDR_SIZE);
         outBuf.setOffset(inBuf.getOffset() + HDR_SIZE);
         System.out.println("the outBuf length is "+inBuf.getLength());
    I write a function : public static byte [] debase(byte[] str)
    but i don't know where can i use it.
    please tell me what should i do or where is wrong about my thought.

    the function in PcmPackettizer.java is
    public static byte[] enbase(byte [] b) {
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         //byte[] oo = new byte[(b.length + 2) / 3*4];
         //for (int i = 0; i < (b.length + 2) / 3; i++) {
         for (int i = 0; i < (b.length + 2) / 3; i++) {
              short [] s = new short[3];
              short [] t = new short[4];
              for (int j = 0; j < 3; j++) {
                   if ((i * 3 + j) < b.length)
                        s[j] = (short) (b[i*3+j] & 0xFF);
                   else
                        s[j] = -1;
              t[0] = (short) (s[0] >> 2);
              if (s[1] == -1)
                   t[1] = (short) (((s[0] & 0x3) << 4));
              else
                   t[1] = (short) (((s[0] & 0x3) << 4) + (s[1] >> 4));
              if (s[1] == -1)
                   t[2] = t[3] = 64;
              else if (s[2] == -1) {
                   t[2] = (short) (((s[1] & 0xF) << 2));
                   t[3] = 64;
              else {
                   t[2] = (short) (((s[1] & 0xF) << 2) + (s[2] >> 6));
                   t[3] = (short) (s[2] & 0x3F);
              for (int j = 0; j < 4; j++)
                   os.write(t[j]);
                   //os.write(t[j],(3*i+j),1);
                   //os.write(Base64.charAt(t[j]));
         //return new String(os.toByteArray());
         return os.toByteArray();
    just like the base64 function

  • In logic Pro, when I open up an audio track and load an audio file, there is no sound. I will finally get a sound out of one of the audio tracks after opening at least 5 of them alternately. Is anyone familiar with this kind of bug? It's really frustratin

    In logic Pro, when I open up an audio track or software track and load an audio file/loop or software file loop, there is no sound. I will finally get a sound out of one of the audio or software tracks after opening at least 5 of them alternately. Is anyone familiar with this kind of bug? It's really frustrating as this takes much time to complete work.
    os x, Mac OS X (10.6)

    I'm not sure I follow your words Fuzzynormal. You've helped by offering the insight that my issue in Logic Pro 9 is not a bug but a feature. But fell short of enlightenment by being a judge of character and of how one should interact in this forum. You insinuate that I haven't tried to solve the issue on my own when in fact I have. These forums are always my last resort. You further suggest that I am complaining. This is not a complaint. It is a genuine issue that I cannot figure out. Then you think that Brazeca is holding my hand and being a nice guy. Brazeca is helping people like me who might not be as adept at using Logic Pro as probably you are.This community forum was established to raise questions, answers and dicussion to help Apple's customers better undertand their operating systems and related issues. You are doing a disservice by not contributing positively and by trying to make this forum what you want it to be. You may have all the time in the world to try figuring out stuff but we are not all like you. We all have different schedules and different levels of understanding. And that is what this forum is for - to help people move forward. If you can't contribute positively then keep silent. And by the way, you say to "read the words that are printed down to explain to you how that works" what words are you talking about? Why don't you be of some help instead of trying to own this forum. 

  • Way to edit and save .AC3 audio files?

    Anyone know if there is a way to edit and save .AC3 audio files in Audition 3?

    Every time you open any coded file at all in Audition, you lose quality if you resave it in anything other than an uncompressed format. With most formats, what is even worse is saving them in a different compressed format, because you end up with twice as many different coding artefacts.
    What you need to understand is that all of these formats are distribution formats, not editing ones. The basic principle is that you work in an uncompressed format until the last possible moment - ie, distribution. And that, ideally, is the only time you use a compressed format at all. So if you want to use something that's compressed, you uncompress it once, and don't recompress until you absolutely have to.

  • I'm using iweb 3.4 and trying to load audio files to my web page.  everything looks good in iweb but after publishing instead of having a control bar i have a "?".  does anyone know what to do?

    I'm using iweb 3.4 and trying to load audio files to my web page.  Everything looks good in iweb but after publishing instead of having a control bar i have a "?".  Does anyone know what to do?

    Where are you hosting the site, how are you uploading the files and what's the URL of your site so we can examine it first hand?
    Adding audio files by dragging onto the web page forces the viewer to have Quicktime installed on their computer in order to be able to listen to them.  Look at the audio player options on this page of Roddy's iWeb for Musicians site: Audio Players for your Music Website. 
    OT

  • Recording video/audio files using Flash Meida Server through rmtp, and allow users to access the recorded files through http.

    As titled, what is the way to record video/audio files using Flash Meida Server through rmtp, and allow users to access the recorded files through http?
    What I am trying to do, is to record a user's microphone's input and save it to the server. Afterwards, I would like other users to be able to access the recorded files and mainuplating the audio data, by computeSpectrum(), to do some visualization of the audio. As I know computeSpectrum() cannot work on streaming files, so I think I need to access the recorded files using http instead of rmtp. Is that true?
    How can I redirect the http request to the files I was recorded into my applications/appName folder? Or I need to somehow moved the recorded files to the /webroot folder?
    Thanks!

    I probably have asked a stupid question.
    My recorded streams are still saved in the applications/appName/streams folder.
    And I redirect the www.mydomain.com/streams to point to the applications/appName/streams folder.
    And the rmtp recorded streams are abled to connect through http now.

  • Hi, when I go to "select files to send" and click on "sent files" I get: "Internal Server Error (500) Your request could not be completed due to an internal server error".  I tried rebooting and that didn't work.  Any help would be appreciated.  Thanks.

    Hi, when I go to "select files to send" and click on "sent files" I get: "Internal Server Error (500) Your request could not be completed due to an internal server error".  This never happened b4.  I tried rebooting and that didn't work.  Any help would be appreciated.  Thanks.

    Hi ,
    Thank you for your question.
    This error was caused by the incorrect site binding, I will give a reference of my test Lab. We add two A records in DNS which the FQDN of CAS and Mailbox could resolve IP address.;
    Default Web Site:
    Exchange Back End:
    Then IIS must be restarted.
    If there are any questions regarding this issue, please be free to let me know. 
    Best Regard,
    Jim

  • Captivate Files Loaded on Web Server

    I have loaded a captivate file (along with all its dependent files) onto a web server in order to link it to our Plateau LMS.  I had no problem with the link, but a narration that is supposed to start later in the file begins when the main Captivate page is opened.  I am not the creator of the Captivate file and have never worked with the program.  Is there something that needs to be done to the file to keep it from doing this?

    Are you using Aggregator? Or is is a very long project? I've noticed Aggregator projects often want to jump into the audio while the presentation is still loading. The easiest fix for that is via Edit --> Preferences. Select Start and End in the Project group, uncheck Auto Play, and, as a touch of class, add a graphic to be displayed until the user presses the play button (which will be in the middle of the presentation when it loads).

  • Problem uploading Muse-exported files on my Web server

    I'm using the FTP client Transmit for years and I'm very pleased with it.
    I use also Muse from the first preview and I always use the "Export to HTML" feature, and place the files on my remotely-hosted Web servers (NetSol).
    When I upload all kind of files (HTML, CSS, .ZIP, videos,…), everything works fine.
    Since yesterday, when I upload files generated by Muse, Transmit stalls and is unable to save the file on the Web server. I receive all kind of transfer errors.
    Something must have happened recently.
    I use the latest Muse CC2014 version and the latest Transmit version.
    I called NetSol support and they said they change nothing on their Web servers recently. They point out that all my non-Muse files upload correctly.
    The big problem is that I can't update my websites anymore.
    How to share here the exported Muse folder?
    Thank you.

    Switched to FileZilla
    Here's the current log and it is failing all the time.
    NetSol told me they have restarted the server and checked for authorisations, and they say it should work as it works for other files.
    Status:      Connection established, waiting for welcome message...
    Response: 230 Login successful.
    Command: SYST
    Response: 215 UNIX Type: L8
    Command: FEAT
    Response: 211-Features:
    Response:  EPRT
    Response:  EPSV
    Response:  MDTM
    Response:  PASV
    Response:  REST STREAM
    Response:  SIZE
    Response:  TVFS
    Response:  UTF8
    Response: 211 End
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Retrieving directory listing...
    Command: PWD
    Response: 257 "/"
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,122,127)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CWD /htdocs
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs"
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,123,133)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CWD /htdocs/indesign
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign"
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,124,119)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CWD /htdocs/indesign/digitalpublishing
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign/digitalpublishing"
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,125,9)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CWD /htdocs/indesign/digitalpublishing/twixl
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign/digitalpublishing/twixl"
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,125,96)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign/digitalpublishing/twixl/twixlfacts"
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,125,186)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Status:      Calculating timezone offset of server...
    Command: MDTM sitemap.xml
    Response: 213 20140918164807
    Status:      Timezone offsets: Server: 0 seconds. Local: 7200 seconds. Difference: 7200 seconds.
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CDUP
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign/digitalpublishing/twixl"
    Status:      Directory listing successful
    Status:      Retrieving directory listing...
    Command: CWD twixlfacts
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign/digitalpublishing/twixl/twixlfacts"
    Status:      Directory listing successful
    Command: DELE sitemap.xml
    Response: 250 Delete operation successful.
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/site_global.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/index.css
    Response: 250 Directory successfully changed.
    Command: TYPE A
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 250 Directory successfully changed.
    Command: TYPE A
    Response: 227 Entering Passive Mode (206,188,192,135,130,87)
    Command: STOR site_global.css
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,130,92)
    Command: STOR index.css
    Response: 150 Ok to send data.
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connection established, waiting for welcome message...
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/site_global.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/index.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Response: 227 Entering Passive Mode (206,188,192,135,133,227)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,135,193)
    Command: STOR site_global.css
    Response: 227 Entering Passive Mode (206,188,192,135,135,195)
    Command: STOR index.css
    Response: 150 Ok to send data.
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/site_global.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,139,52)
    Command: LIST
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 150 Here comes the directory listing.
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 227 Entering Passive Mode (206,188,192,135,139,81)
    Command: STOR site_global.css
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/index.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,139,110)
    Command: STOR index.css
    Response: 150 Ok to send data.
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/index.html
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,143,173)
    Command: STOR index.html
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/muse_manifest.xml
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,143,241)
    Command: STOR muse_manifest.xml
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/index.html
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,146,182)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,146,224)
    Command: STOR index.html
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/muse_manifest.xml
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,147,43)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,147,77)
    Command: STOR muse_manifest.xml
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/muse_manifest.xml
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,152,8)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,152,60)
    Command: STOR muse_manifest.xml
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/index.html
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,153,212)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,153,253)
    Command: STOR index.html
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/sitemap.xml
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,156,194)
    Command: STOR sitemap.xml
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/index.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts/css
    Response: 550 Failed to change directory.
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Command: MKD css
    Response: 257 "/htdocs/indesign/digitalpublishing/twixl/twixlfacts/css" created
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts/css
    Response: 250 Directory successfully changed.
    Command: PWD
    Response: 257 "/htdocs/indesign/digitalpublishing/twixl/twixlfacts/css"
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,158,202)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,158,252)
    Command: STOR index.css
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/sitemap.xml
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,161,149)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,161,186)
    Command: STOR sitemap.xml
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/css/index.css
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts/css
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,163,215)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,164,8)
    Command: STOR index.css
    Response: 150 Ok to send data.
    Error:        Connection timed out
    Error:        File transfer failed
    Status:      Resolving address of XXXXXXX.netsolhost.com
    Status:      Connecting to XXX.XXX.XXX.XXX:21...
    Status:      Connection established, waiting for welcome message...
    Response: 220 (vsFTPd 2.3.4)
    Command: USER ftpXXXXXXX
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: OPTS UTF8 ON
    Response: 200 Always in UTF8 mode.
    Status:      Connected
    Status:      Starting upload of /Users/blackmountainprod01/Documents/Google Drive/eCampus.pro/cours/Twixl Publisher/Twixl Facts!/export/sitemap.xml
    Command: CWD /htdocs/indesign/digitalpublishing/twixl/twixlfacts
    Response: 250 Directory successfully changed.
    Status:      Retrieving directory listing...
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,166,69)
    Command: LIST
    Response: 150 Here comes the directory listing.
    Response: 226 Directory send OK.
    Command: TYPE A
    Response: 200 Switching to ASCII mode.
    Command: PASV
    Response: 227 Entering Passive Mode (206,188,192,135,166,96)
    Command: STOR sitemap.xml

  • I want to cache all files in my web server for JRE auto installation

    Hi,
    I have written an application for my customer. When they access my web server, they will auto-install jre 6.12 and then load my application using jnlp. All that is done, but i want to improve in the following ways:
    1. I want to have more quiet installation of java. It should only show progress bar or just run in background. In the jre installation file (cab file), there is a file jinstall-6u12.inf, the last line is "run=%EXTRACT_DIR%\jinstall.exe /installurl=http://localhost/1.6.0_12-b04.xml /installmethod=plugin". What should I add to this line to make the installation more quiet?
    2. When my client install jre, i want them to fetch all necessary files from my web server, so when java web site is down, i can still provide files they need to install java. I am aiming jre 6.12 only.
    Thank you in advance.
    William

    Open Macintosh HD > Applications > Utilitiies > AirPort Utility
    Click on the Time Capsule icon
    In AirPort Utility 6.x.....click Edit to the right of the Time Capsule
    In AirPort Utility 5.x.....click Manual Setup
    Click the Disks icon/tab at the top of the next window
    Click Erase
    The "Quick Erase" option will only take a few minutes, but it is not a secure Erase.
    The "Zero Out" option will replace everything on the disk with zeros, and will likely take 4-6 hours for the process to complete, depending on the size of the drive.
    The erase procedure will only affect the disk. It will not affect any of the network settings, passwords, etc that you have stored on the Time Capsule.

  • File Based Multithreaded Web Server Question

    Hi friends,
    I have the code of a simple File Based Multithreaded Web Server. I have been asked to add proper http/1.1 Keep-Alive behavior to it. As far as I understand it means to use the same socket for the request coming from the same client without opening a new socket for every request by it. I am unable to implement it. Any help would be greatly appreciated. The entire code is as below:
    package multithreadedwebserver.com;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    /** This Class declares the general and HTTP constants
    * and defines general static methods:
    class Constants {
    /** 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 Web server's virtual root directory */
    public static File root;
    static PrintStream log = null;
    /* Configuration information of the Web server is present
    * in this props object
    protected static Properties props = new Properties();
    /* timeout on client connections */
    static int timeout = 0;
    /* maximum number of worker threads */
    static int workerThreads = 5;
    /* General method for printing strings */
    static void printString(String s) {
    System.out.println(s);
    /* print logs to the log file */
    static void log(String s) {
    synchronized (log) {
    log.println(s);
    log.flush();
    /* print to the log file */
    static void printProperties() { 
    printString("\n");
    printString("#####################################################################");
    printString("\n");
    printString("Web server's virtual root directory= "+root);
    printString("Timeout on client connections in milliseconds= "+timeout);
    printString("Number of Worker Threads= "+workerThreads);
    printString("\n");
    printString("#####################################################################");
    printString("\n\n");
    printString("********************WEBSERVER STARTED SUCCESSFULLY********************\n");
    /* load server.properties from java.home */
    static void loadServerConfigurationProperties() throws IOException {
    File f = new File(System.getProperty("java.home")+"\\lib\\"+"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 + " Server Root Directory does not exist");
    r = props.getProperty("timeout");
    if (r != null) {
    timeout = Integer.parseInt(r);
    r = props.getProperty("workerThreads");
    if (r != null) {
    workerThreads = Integer.parseInt(r);
    r = props.getProperty("log");
    if (r != null) {
    log = new PrintStream(new BufferedOutputStream(
    new FileOutputStream(r)));
    /* Assign default values to root, timeout,
    * workerThreads and log if the same have
    * not been specified in the server.propwerties file
    if (root == null) {   
    root = new File(System.getProperty("user.dir"));
    if (timeout <= 1000) {
    timeout = 5000;
    if (workerThreads > 25) {
    printString("\n");
    printString("#####################################################################");
    printString("\n");
    printString("Too many Threads!!!Maximum number of Worker Threads can be 15 only");
    printString("\n");
    printString("#####################################################################");
    workerThreads = 15;
    if (log == null) {
    log = System.out;
    public class WebServer extends Constants {
    /* Specifying Default port for listening the requests */
    static int port = 8080;
    /* The Vector class implements a growable array of objects.
    * Like an array, it contains components that can be accessed using an integer index.
    * The size of a Vector can grow or shrink as needed to accommodate adding and
    * removing items after the Vector has been created.
    * The workerThreads are added to the Vector object threads where the worker threads stand idle
    * Vector is used since it is synchronized
    static Vector threads = new Vector();
    public static void main(String[] userSpecifiedPort) throws Exception {
    if (userSpecifiedPort.length > 0) {
    port = Integer.parseInt(userSpecifiedPort[0]);
    loadServerConfigurationProperties();
    printProperties();
    /* Instantiate ThreadPoool class and call
    * the createThreadPool() method on threadPool object
    ThreadPool threadPool= new ThreadPool();
    threadPool.createThreadPool();
    /* This class implements java.lang.Runnable.
    * It runs in a worker thread to process the request and serve files to the clients.
    class Worker extends WebServer implements Runnable {
    static final byte[] EOL = {(byte)'\r', (byte)'\n' };
    final static int BUFFER_SIZE = 2048;
    /* A byte array buffer to read and write files.
    * Memory is allocated to it once in the construtor of the class Worker
    * and reused thereafter
    byte[] buffer;
    /* Socket for the client being handled */
    private Socket socket;
    Worker() {
    buffer = new byte[BUFFER_SIZE];
    socket = null;
    synchronized void setSocket(Socket socket) {
    this.socket = socket;
    notify();
    public synchronized void run() {
    do {
    if (socket == null) {
    /* Wait */
    try {
    wait();
    } catch (InterruptedException e) {
    continue;
    try {
    handleClientRequest();
    } catch (Exception e) {
    e.printStackTrace();
    socket = null;
    Vector pool = WebServer.threads;
    synchronized (pool) {
    /* When the request is complete add the worker thread back
    * into the pool
    pool.addElement(this);
    }while(true);
    void handleClientRequest() throws IOException {
    InputStream is = new BufferedInputStream(socket.getInputStream());
    PrintStream ps = new PrintStream(socket.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.
    socket.setSoTimeout(WebServer.timeout);
    socket.setTcpNoDelay(true);
    /* Refresh the buffer from last time */
    for (int i = 0; i < BUFFER_SIZE; i++) {
    buffer[i] = 0;
    try {
    /* We will only support HTTP GET/HEAD */
    int readBuffer = 0, r = 0;
    boolean endOfLine=false;
    while (readBuffer < BUFFER_SIZE) {
    r = is.read(buffer, readBuffer, BUFFER_SIZE - readBuffer);
    if (r == -1) {
    /* EOF */
    return;
    int i = readBuffer;
    readBuffer += r;
    for (; i < readBuffer; i++) {
    if (buffer[i] == (byte)'\n' || buffer[i] == (byte)'\r') {
    /* read one line */
    endOfLine=true;
    break;
    if (endOfLine)
    break;
    /*Checking for a GET or a HEAD */
    boolean doingGet;
    /* beginning of file name */
    int index;
    if (buffer[0] == (byte)'G' &&
    buffer[1] == (byte)'E' &&
    buffer[2] == (byte)'T' &&
    buffer[3] == (byte)' ') {
    doingGet = true;
    index = 4;
    } else if (buffer[0] == (byte)'H' &&
    buffer[1] == (byte)'E' &&
    buffer[2] == (byte)'A' &&
    buffer[3] == (byte)'D' &&
    buffer[4] == (byte)' ') {
    doingGet = false;
    index = 5;
    } else {
    /* This method is not supported */
    ps.print("HTTP/1.0 " + HTTP_BAD_METHOD +
    " unsupported method type: ");
    ps.write(buffer, 0, 5);
    ps.write(EOL);
    ps.flush();
    socket.close();
    return;
    int i = 0;
    /* find the file name, from:
    * GET /ATG/DAS6.3.0/J2EE-AppClients/index.html HTTP/1.0
    * extract "/ATG/DAS6.3.0/J2EE-AppClients/index.html "
    for (i = index; i < readBuffer; i++) {
    if (buffer[i] == (byte)' ') {
    break;
    String filename = (new String(buffer, 0, index,
    i-index)).replace('/', File.separatorChar);
    if (filename.startsWith(File.separator)) {
    filename = filename.substring(1);
    File targ = new File(WebServer.root, filename);
    if (targ.isDirectory()) {
    File ind = new File(targ, "index.html");
    if (ind.exists()) {
    targ = ind;
    boolean fileFound = printHeaders(targ, ps);
    if (doingGet) {
    if (fileFound) {
    sendResponseFile(targ, ps);
    } else {
    fileNotFound(targ, ps);
    } finally {  
    // socket.close();
    System.out.println("Connection Close nahi kiya");
    boolean printHeaders(File targ, PrintStream ps) throws IOException {
    boolean ret = false;
    int responseStatusCode = 0;
    if (!targ.exists()) {
    responseStatusCode = HTTP_NOT_FOUND;
    ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " not found");
    ps.write(EOL);
    ret = false;
    } else {
    responseStatusCode = HTTP_OK;
    ps.print("HTTP/1.0 " + HTTP_OK+" OK");
    ps.write(EOL);
    ret = true;
    log("From " socket.getInetAddress().getHostAddress()": GET " +
    targ.getAbsolutePath()+"-->"+responseStatusCode);
    ps.print("Server: Simple java");
    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 fileNotFound(File targ, PrintStream ps) throws IOException {
    ps.write(EOL);
    ps.write(EOL);
    ps.println("The requested file could not be found.\n");
    void sendResponseFile(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(buffer)) > 0) {
    ps.write(buffer, 0, n);
    } finally {
    is.close();
    /* mapping file extensions to content-types */
    static java.util.Hashtable map = new java.util.Hashtable();
    void listDirectory(File dir, PrintStream ps) throws IOException {
    ps.println("<TITLE>Multithreaded Webserver</TITLE><P>");
    ps.println("<html><body align=center>");
    ps.println("<center><h3><font color=#9999CC>Simple File Based MultiThreaded WebServer</font></h3></center>");
    ps.println("<table border=1 align=center>");
    ps.println("<tr bgcolor=#9999CC><td width=100% height=100% align=center><h3>Directory Listing</h3></td>");
    ps.println("<td width=40% height=40% align=center><h3>Type</h3></td>");
    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("<tr><td>");
    ps.println("<font size=\""+"2"+"\"face=\""+"Verdana"+"\"> <A HREF=\""+list[i]+"/\">"+list[i]+"</A></font><a href=\""+list[i]+"/\"></a>\n<BR></td>");
    ps.println("<td align=center><a href=\""+list[i]+"/\"><img src=\""+"/images/folder.jpg"+"\"></img></a>");
    ps.println("</td");
    ps.println("</tr>");
    } else {
    ps.println("<tr><td>");
    ps.println("<font size=\""+"2"+"\" face=\""+"Verdana"+"\"></A> <A HREF=\""+list[i]+"\">"+list[i]+"</A></font><A HREF=\""+list[i]+"\"></A>\n<BR></td>");
    ps.println("<td align=center><a href=\""+list[i]+"/\"><img src=\""+"/images/file.gif"+"\"></img></a>");
    ps.println("</tr>");
    ps.println("</table>");
    ps.println("<P><HR><I><font color=blue>"+(new Date())+"</font></I>");
    ps.println("<I><font color=blue>Copyright to HCL Technology Ltd</font></I>");
    ps.println("<I><font color=blue>Author Vivek Kumar Sinha</font></I>");
    ps.println("</body></html>");
    The ThreadPool class contains a Vector of WorkerThread objects.
    These objects are the individual threads that make up the pool.
    The WorkerThread objects will start at the time of their construction.
    If there are more HTTP requests than there are WorkerThreads,
    the extra requests will backlog until WorkerThreads free up.
    class ThreadPool extends WebServer{
    void createThreadPool(){
    for (int i = 1; i <= workerThreads; ++i) {
    Worker w = new Worker();
    Thread t=new Thread(w, "Worker Thread No."+i);
    t.start();
    /* Uncomment to check the number of worker threads running */
    // printString("Worker Thread No."+i+" Started");
    threads.addElement(w);
    try{
    ServerSocket serversocket = new ServerSocket(port);
    do {
    Socket socket = serversocket.accept();
    Worker w = null;
    synchronized (threads) {
    if (threads.isEmpty()) {
    /* Do nothing */
    } else {
    w = (Worker) threads.elementAt(0);
    threads.removeElementAt(0);
    w.setSocket(socket);
    } while (true);
    } catch (IOException e) {
    e.printStackTrace();

    Thank you for Welcoming me!!! I am very new to this forum so din't have this idea.
    I am unable to add the keep alive behavior . I don't have problem with any part of the code. The problem is i don't know how to make that enhancement in the existing code.
    Regards

  • Running a batch file on  a web server

    hi,
    i am facing a problem regarding running a batch file(with a java command in that file) on a web server.
    i am having a batch file which is running a chatapplication (this file is having a single line -- "java ChatServer 8080")
    i want to execute this command ( file ) on my web server
    can u help me plz ( i think u can)
    thanx 4 reading my problem...
    -ashish

    thanx 4 replying
    but as i am a developer and i am developing the aplication for a client, so should i speak to the client for this or can i do this without interrupting them?
    -ashish

  • Uploading a file to the web server

    How can i upload a file to the web server using JSP.

    hello sir,
    Could U even tell me performance which one is better.
    U have mentioned that Multipartrequest is Complex for Beginers,
    but as far as performance is concerned which is better.
    If Taglib is used is it error Free , as I do not know much abt taglib.
    have just read a little abt it , have never created my own Custome Tag.
    Could U just Guide me which is the best site where I could get know a little abt Taglib.An easy tutorial where I could read and start working on My application.
    I have been given a Deadline. So Please help me man.
    If U have the source Code for Uploading of a File Please Cut Paste it.
    I have to finish the project on time .
    Please
    With Regards
    Eklavya

  • Deploying war files on iplanet web server 6.0

    Hello All,
    I tried to deploy an war file on iplanet web server 6.0 using both command line wdeploy and iplanet webserver browser based admin tool. Both the times it did say successfully deployed. I checked the WEB-INF files and it does contain all class files..But the problem is when I try to post a form to one of the class files the error log says as if it cannot find the class file.(I tried the sample app HelloWorld supplied by vendor)
    =========
    05/Mar/2002:13:19:14] config (13777): for host xx.xx.xx.xx trying to POST /samples/helloworld/GreeterServlet, handle-processed reports: The request method is not applicable to this requested resource.
    =================
    any help in this regards is appreciated
    Thanks
    sudhir

    Hello,
    I got few steps to deploy the WAR file, if you followed the same steps and got the error then ignore this else try with this steps.
    a) Set your environment variable IWS_SERVER_HOME to your server_root directory.
    b) Add the server_root/bin/https/httpsadmin/bin directory to your classpath.
    c) Configure your virtual server for web applications.
    From the Server Manager page, select the VirtualServerClass tab, select a Class, and click the Manage button.
    Select a Virtual Server and go to the Java Web Apps Settings page for that virtual server. Make sure that the virtual server has Web Apps State turned On, and web-apps.xml is the name of Web Apps File.
    To extract the sample WAR file HelloWorld.war in server_root/plugins/servlets/examples/web-apps/HelloWorld, use the wdeploy command as follows:
    wdeploy deploy -u /hello -i server.iplanet.com -v testvs -d
    /iws60/https-server.mydomain.com/testvs/web-apps/hello
    /iws60/plugins/servlets/examples/web-apps/HelloWorld/HelloWorld.war
    The syntax for the command is as follows:
    wdeploy deploy -u uri_path -i instance -v vs_id [-d directory] war_file
    uri_path Specify the URI prefix (a path to access the web application from the browser).
    instance Specify the server instance name. (Note: Do not include "https" in the front.)
    vs_id Specify the Virtual Server name as it appears on the Manage Virtual Servers page.
    directory Specify a directory to extract WAR files. If this directory doesn't exist already, it will be created for you now.
    war_file Specify the name of the WAR file.
    If the WAR file is extracted successfully, the message "web application deploy successful" appears at the command line.
    For verification, go to the /iws60/https-server.iplanet.com/testvs/web-apps/hello directory. It should have the following contents:
    colors
    index.jsp
    META-INF
    WEB-INF/
    web.xml
    /classes/
    HelloWorldServlet.class
    HelloWorldServlet.java
    SnoopServlet.class
    SnoopServlet.java
    In the server_instance/config directory, the web-apps.xml file should have the following entry:
    <vs>
    <web-app uri="/hello"
    dir="/iws60/https-server.iplanet.com/testvs/web-apps/hello"/>
    </vs>
    Restart the server instance from the command line or go to the admin GUI and apply configuration changes to the server instance.
    Now when you access the webserver instance in your browser, the Error log of that server instance will record successful initialization of the web application environment(web-apps.xml) for the virtual server(vs name). You can access the web application from a browser as follows:
    http://server.Mydomain.com:80/hello/index.jsp
    or:
    http://server.Mydomain.com/hello/
    The syntax is as follows:
    http://vs_urlhost[:vs_port]/uri_path/[index_page]
    Thanks
    Selva

Maybe you are looking for

  • Address Book Wish List Additions???

    As a long time Mac user I find Address Book extremely lame in that it lacks many helpful usability features that were standard in older third party contact managers. Ever since Now-Up-to-Date bought out and stupidly extinguished Touchbase/Datebook, M

  • Issue with Adobe maybe?

    Hi, So I am having issues with adobe reader.  I work as tech support and someone called in with issues.  His issue is: Cannot open forms and enter information then save them back using his program.  The webprogram he is using is JIDS.  JIDS requires

  • HT2693 I can't buy anything it says contact iTunes support what can I do now

    I can't buy anything it says contact iTunes support what can I do now

  • Create Inspection Characteristics

    Hello Gurus, I'm developing a program to create Inspection Characteristics from a file (excel). I'm using the BAPI <b>BAPI_INSPECTIONPLAN_CREATE</b> but i don't know how to fill the parameters. Anyone can help me, please. Thank in advance.

  • Add to chart button in personalized mail

    Hi, Can anybody give me suggestion on how to insert an Add to chart button in a personalized html mail. There need to be functionality behind so that the customer are logged in when he presses the button. Thanks in advance. Regards Camilla