Web Server 6.02 Internationalization Question

Hello. I have a problem with WS:
it doesn't compile JSP with an error:
JSP: JSP1x compiler threw exception java.io.FileNotFoundException: /www/netscape/nextDocs/Acsadm/auth.jsp: Cp1251 at org.apache.jasper.compiler.JspReader.pushFile(JspReader.java:192) at org.apache.jasper.compiler.JspReader.<init>(JspReader.java:253) at org.apache.jasper.compiler.JspReader.createJspReader(JspReader.java:259) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:172) at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.java:252) at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.java:173) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:416)
or another:
Internal error: exception thrown from the servlet service function (uri=/Acsadm/userAdmins/StatServer/StatFull.jsp): java.io.UnsupportedEncodingException: Cp1251, Stack: java.io.UnsupportedEncodingException: Cp1251 at sun.io.Converters.getConverterClass(Converters.java:119) at sun.io.Converters.newConverter(Converters.java:155) at sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:64) at sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:187) at sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:170) at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:70) at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:82) at com.iplanet.server.http.servlet.NSServletOutputStreamWriter.<init>(NSServletOutputStream.java:609) at com.iplanet.server.http.servlet.NSServletOutputStream.getWriter(NSServletOutputStream.java:369) at com.iplanet.server.http.servlet.NSServletResponse.getWriter(NSServletResponse.java:166) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:160) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:152) at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:199) at jsps.Acsadm._userAdmins._StatServer._StatFull_jsp._jspService(_StatFull_jsp.java:322) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:464)
Can anybody help me with this problem?
I m using a native JRE in WS pack.
I've tried to use JDK 1.4.1 international - with same results
Application that i m trying to run has previously worked with WS 4 - only one add-on in java.conf - file.encoding=cp1251
Please reply here or mail me: [email protected]
Thanks.

Hi,
Thank you for your suggestion. I have tried with your option also. Still I am getting the second time userid/password dialogue box.
Is there any other solution to avoid the second time user authentication dialogue box?
Do you want to see the ACL file?
Thanks & Regards,
Murthy

Similar Messages

  • Iplanet web server 6.0 ACL question

    Hi,
    I am using ACLs to protect some of my URLs in iplanet web server 6.0.
    I am getting one problem. Its not a problem actually but would like to know how to avoid authenticating the users 2 times.
    In my ACL file, when ever I create an entry for a path, I am getting the following by default.
    authenticate (user,group) {
    database = "default";
    method = "basic";
    My entry is like this with the above lines.
    acl "path=/www/develop/itsecurity/admin";
    authenticate (user,group) {
    database = "default";
    method = "basic";
    allow absolute (all)
    (user = "modadmin");
    allow absolute (all)
    (user = "itsecadm");
    deny (all)
    (user = "anyone");
    Now if the entry is like this with
    authenticate (user,group) {
    database = "default";
    method = "basic";
    after the first line, then whenever that particulaar user "itsecadm" tries to access the URL, he gets userid and password dialogue box. After entring into the page, if he tries to access or click any other link, it is asking the userid and password again.If he gives this second time, next time onwards it is not asking userid and password.
    But When I remove the lines
    authenticate (user,group) {
    database = "default";
    method = "basic";
    from the file for that particular entry, it is not asking 2nd time userid/password.
    Could you please tel me why this happening. Why this entry is created whenever I am adding a new one into ACL file?
    Is any one facing the similar problem with iplanet web server 6.0 ACL files?
    Thanks & Regards
    Murthy

    Hi,
    Thank you for your suggestion. I have tried with your option also. Still I am getting the second time userid/password dialogue box.
    Is there any other solution to avoid the second time user authentication dialogue box?
    Do you want to see the ACL file?
    Thanks & Regards,
    Murthy

  • Web Server 7 - Switch to SSL - Automatic forwarding from non-SSL

    I just posted a similar question regarding Web server 6. This question is for Web server 7!
    I maintain Web tools on a non-SSL Web Server 7. I need to turn on SSL, because our organization requires the security feature for certain functions in the tool.
    The current non-SSL address for the tool is similar to http://mytool.com/. I want to make the switch to SSL transparent for users, so I want http://mytool.com/ to automatically forward to https://mytool.com. What is the best way to do that in Web server 7?
    Also, I'd like to make the changes without using the GUI, what are the XML commands for the server.xml file (I assume that's what I'll need to change, right?)
    Sincerely,
    dailysun
    THIS IS FOR WEB SERVER 7

    Hi
    Assuming you have figured out the way to setup a listener with SSL enabled, you can the following
    1. find out what object file is currently used by server
    bin/wadm get-virtual-server-prop user=admin config=<hostname> object-file
    this will either return as obj.conf or <vs>-obj.conf
    2. now open this file and add the following lines after <Object name="default" line
    <Object name="default">
    #add the following lines
    <Client match="all" security="false" urlhost="mytool.com">
    NameTrans fn="redirect" from="/" url-prefix="https://mytool.com"
    NameTrans fn="redirect" from="/*" url-prefix="https://mytool.com/"
    </Client>
    # end
    now save this file and test to see if this is what you are expecting.
    if you are satisfied, you will need to bring over this manual change into admin config repository by doing something like
    bin/wadm pull-config user=admin  config=<..>
    You can also save the commonly used parameter like <user> and <password> within the .wadmrc file. Please see - http://blogs.sun.com/natarajan/date/20070131
    hope this helps

  • Using IIS 5.0 as web server to App Server 8.0 PE

    I am developing a site for a company which has IIS 5.0 as the web server. The sysad there would like to allow only IIS to receive request and hide the App Server internally. I read that one can configure IIS 5.0 to forward request to App Server 7.0. Can you do that in App Server 8.0? How? I have read a post on how to configure Apache to forward request to App Server 8.0 but I don't seem to understand. Sorry, I am very new to the area of App Server and Web server.
    My second question, Are there any advantages of configuring IIS 5.0 to accept request and forward any JSP/Servlet request to AP 8.0? How does the performance of HTTP service of AP 8.0 compared to that of IIS 5.0? Are there any performance or security or other issues associating with this option?
    Cheers,
    Nocell

    you could try this AS7 but it may work, have being looking at how to do this myself
    http://swforum.sun.com/jive/thread.jspa?forumID=114&threadID=19196
    John

  • When does Crystal use the Webi Server?

    I have a Crystal 2008 off a R3.0 Universe.  When does the Webi server get accessed?
    Question is only for Crystal Designer
    When I open the report in Crystal Designer?  Or when I run the report?

    Hi Brian,
    When creating a report based of a Universe, Crystal Reports will communicate with the Webi Report Server to get the following information:
    - SQL Query
    - Database information
    When you open a report based of a Universe in Crystal Reports, it needs to communicate with the Webi Report server to verify the security set in the Universe, as well as to see if there were any change, then the information is passed to Crystal Reports.
    When refreshing the report, it will  then use the SQL Query and database information sent from the Webi Report Server to communicate directly with the data source to retreive the data.
    Note that the above are general information on how a report based of a Universe semantic layer works.
    Hope this answer your question.
    Patrick

  • [SOLVED Noob question about web server permissions

    Hi I have setup up succesfully my web server. Now I am having some permission's questions/problems.
    First of all, I want the /home/httpd/home folder not to be show to the other machine users and only to root.
    I have created a user www-data and I have conf the apache file.
    This is my settings:
    My server directory is: /home/httpd and the permissions I have set:
    home dir:
    ~edited because solved~
    I have set .htaccess to some folders. I don't know If the permissions are safe or not. Can you help me?
    I think that I have different permissions to files and different to the folders...
    Thank you!
    Edited:
    And an example of my permission (phpMyAdmin):
    ~edited because solved~
    Last edited by k3rn31 (2008-02-28 22:26:09)

    This is more of a chat item for me, if you feel like it you can find me most of the time here at http://zaxter.org/xmpp.html if you have flash you can join via a simple click on connect.
    Sorry I've not been of much help to you.

  • Mini Web Server Question

    I'm guessing there might be a person or two who can help me with a solution for a new mini that I'm using as a web server. Everything is set up and working perfectly. Apache is running well, and I've established my Virtual Hosts and enabled PHP and MySQL. What I haven't been able to figure out, however, is how to go about limiting access to particular directories on my server.
    Here is what I would like to accomplish.
    I've got a couple of sights that have the root directory of /www/sitename/publichtml/.
    In those public_html directories are resource directories with names like "images" "downloads" etc.
    From my websites, I pull resources from those directories in order to serve images, resources, etc.
    What I would LIKE to do is still allow those directories to serve the resources to the sites, but prohibit direct access to those directories from direct web access. In other words, I want my images to pull from those directories, but I don't want someone to be able to directly navigate to the directory www.sitename/images/imagename.jpg.
    I would like some message to show up along the lines of "You do not have permission to access this directory".
    I attempted to do this with file permissions, but it either allows total access to the directory or won't allow the web pages to pull the resources.
    Does anyone know of any other solution that will help me accomplish my goal?
    Thanks!
    Chris

    You are going to be more likely to get a good answer to this question in the Mac OS X Server forums. If you are using Leopard Server, go [here|http://discussions.apple.com/forum.jspa?forumID=1237].
    If you are using Mac OS X Web Sharing you should post [here|http://discussions.apple.com/forum.jspa?forumID=1225].
    Best of luck.

  • Iws 6.0 web server load question

    What are the advantages (if any) of running multiple web server instances (iplanet 6.0 sp4) vs. one server with increased thread count. I'm unclear after reading through documentation what the limits of one iplanet httpd server are...I know you can manupulate threads as needed but how does one process scale with increased load vs. having two on the box?
    Can one process handle all the traffic from a 100mb full duplex qfe card (ie, could the card handle the pipe being fully utilized)? It seems to me that if it's threaded than it should be able to...what would another process do that threads can't?
    I ask this question because I've got an application coming with these specs:
    Top end load capability of 150 hits per second.
    13,500 users per day with average 3.6 server interactions per second
    And I've got two Sun 280r's with 2 900mhz cpu each sitting behind a load balancer.
    TIA

    What are the advantages (if any) of running multiple
    web server instances (iplanet 6.0 sp4) vs. one server
    with increased thread count.Using multiple web server instances (or a single instance with multiple processes) can improve scalability on machines with large numbers of processors, especially when using in-process dynamic content, such as Java Servlets or NSAPI plugins, or when using SSL.
    Using a single web server instance with a single process generally results in a more efficient use of resources, particularly memory, and consolidates configuration and administration activities.
    Can one process handle all the traffic from a 100mb
    full duplex qfe card (ie, could the card handle the
    pipe being fully utilized)?A single iPlanet Web Server 6.0 process on the hardware you describe (2 CPU 280R) should be able to saturate a 100Mb link when serving unencrypted static content. Using multiple processes would not improve performance in this situation.

  • Questions Tags Users Badges Unanswered Ask Question 502 - Web server received an invalid response while acting as a gateway or proxy server while accessing wcf hosted in azure

    I have just a simple WCF service and which is protected by azure ACS .I am getting this error while trying to invoke the service from a client.The WCF is hosted as a simple azure website.
          502 - Web server received an invalid response while acting as a gateway or proxy server
          There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
    This is my web.config for the service and I am guessing there is something wrong with it .It is working just fine on local IIS so I am not sure what exactly is causing the issue.Can someone please have a look and see if they can find something or point me to
    a direction.
        <?xml version="1.0"?>
        <configuration>
          <configSections>
            <!--WIF 4.5 sections -->
            <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </configSections>
          <system.diagnostics>
            <trace>
              <listeners>
                <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                  name="AzureDiagnostics">       
                </add>
              </listeners>
            </trace>
          </system.diagnostics>
          <appSettings>
            <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
          </appSettings>
          <system.web>
            <authentication mode="None"/>
            <customErrors mode="Off"></customErrors>
            <compilation debug="true" targetFramework="4.5" />
            <httpRuntime targetFramework="4.5"/>
          </system.web>
          <system.serviceModel>
            <services>
              <service name="SidService.Service1">
                <endpoint address="https://sidwcfservice.azurewebsites.net/sidservice.svc"
                          binding="ws2007FederationHttpBinding"
                          contract="SidService.IService1" />
              </service>
            </services>
            <bindings>
              <ws2007FederationHttpBinding>
                <binding closeTimeout="10:10:10" openTimeout="10:30:00" sendTimeout="10:30:00" receiveTimeout="10:30:00"  
                        bypassProxyOnLocal="false" transactionFlow="false" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000"   >
                  <security mode="TransportWithMessageCredential">
                    <message establishSecurityContext="true"   negotiateServiceCredential="true"  issuedKeyType="BearerKey">
                      <issuer address="https://sidaccess.accesscontrol.windows.net/v2/wstrust/13/certificate"></issuer>
                      <issuerMetadata address="https://sidaccess.accesscontrol.windows.net/v2/wstrust/mex" />
                    </message>
                  </security>
                </binding>
              </ws2007FederationHttpBinding>
            </bindings>
            <behaviors>
              <serviceBehaviors>
                <behavior>
                  <serviceAuthorization principalPermissionMode="Always"></serviceAuthorization>
                  <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
                  <serviceCredentials useIdentityConfiguration="true"></serviceCredentials>
                  <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                  <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                  <serviceDebug includeExceptionDetailInFaults="true"/>
                  <serviceSecurityAudit  auditLogLocation="Application"   serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true"/>
                </behavior>
              </serviceBehaviors>
            </behaviors>
            <protocolMapping>
              <add binding="basicHttpsBinding" scheme="https" />
              <add binding="ws2007FederationHttpBinding" scheme="https" />
              <add binding="basicHttpBinding" scheme="http" />      
            </protocolMapping>    
            <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
          </system.serviceModel>
          <system.webServer>
            <modules runAllManagedModulesForAllRequests="true">
              <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    preCondition="managedHandler" />
              <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    preCondition="managedHandler" />
            </modules>
            <directoryBrowse enabled="true"/>
          </system.webServer>
          <system.identityModel>
            <identityConfiguration saveBootstrapContext="true">     
              <certificateValidation certificateValidationMode="None" revocationMode="NoCheck"/>
              <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <trustedIssuers>         
                  <add name="ACS2SigningCertificate"
                   thumbprint="DAE85FDA621FC090A8B0583we4380C52E484AE36" />
                </trustedIssuers>
              </issuerNameRegistry>  
              <audienceUris>
                <add value="https://sidwcfservice.azurewebsites.net/sidservice.svc" />
              </audienceUris>
              <securityTokenHandlers>
                <add type="System.IdentityModel.Tokens.Saml2SecurityTokenHandler, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                  </securityTokenHandlers>   
            </identityConfiguration>
          </system.identityModel>
         <system.identityModel.services>
            <federationConfiguration>
              <cookieHandler mode="Default" requireSsl="true" />
              <!--<wsFederation passiveRedirectEnabled="true" issuer="https://localhost:123/issue/wsfed" realm="https://localhost:44300" reply="https://localhost:44300" requireHttps="false"
    />-->
              <wsFederation passiveRedirectEnabled="true" issuer="https://sidaccess.accesscontrol.windows.net" realm="https://sidwcfservice.azurewebsites.net/"  requireHttps="true" />
            </federationConfiguration>
          </system.identityModel.services>
        </configuration>
    This is the IIS log
        #Software: Microsoft Internet Information Services 8.0
        #Fields: date time s-sitename cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
        2014-06-11 05:19:51 SIDWCFSERVICE GET / X-ARR-LOG-ID=f7e6da2f-78f0-4c27-9cae-bb1623d150d6 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 210675 863 694
        2014-06-11 05:21:07 SIDWCFSERVICE GET /sidservice.svc X-ARR-LOG-ID=dd15d3bc-3307-4b26-8787-1399a5e890ed 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - - sidwcfservice.azurewebsites.net
    200 0 0 1800 718 1044
        2014-06-11 05:21:08 SIDWCFSERVICE GET /SidService.svc wsdl&X-ARR-LOG-ID=bb415471-866f-48a1-8b7a-e01d4410779e 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445
    http://sidwcfservice.azurewebsites.net/sidservice.svc sidwcfservice.azurewebsites.net 200 0 0 2417 878 0
        2014-06-11 05:21:16 SIDWCFSERVICE GET /Sidservice.svc wsdl/$metadata&X-ARR-LOG-ID=f5c6415d-9c18-4305-aad5-9cbe4fe16d43 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 3458 813 15
        2014-06-11 05:21:16 SIDWCFSERVICE POST /Sidservice.svc wsdl/mex&X-ARR-LOG-ID=c2e3eeee-f5d9-49bf-b988-c524679409f3 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 500 0 0 1548 1336 62
        2014-06-11 05:21:16 SIDWCFSERVICE GET /Sidservice.svc wsdl&X-ARR-LOG-ID=66bac0fb-476d-4104-bf4b-22d3cd55e906 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 8138 793 0
        2014-06-11 05:21:16 SIDWCFSERVICE OPTIONS /Sidservice.svc wsdl/_vti_bin/ListData.svc/$metadata&X-ARR-LOG-ID=82bf4ff4-4842-44a6-815e-adb8fdf01d13 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 400 0 0 398 764 31
        2014-06-11 05:21:16 SIDWCFSERVICE POST /Sidservice.svc wsdl&X-ARR-LOG-ID=6d7ba68e-67cd-4596-9bf9-861cab3140c2 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 500 0 0 1548 1324 31
        2014-06-11 05:21:16 SIDWCFSERVICE GET /SidService.svc xsd=xsd0&X-ARR-LOG-ID=d5890f1b-793e-4b13-9c75-ccd133be1cab 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 1688 887 250
        2014-06-11 05:21:16 SIDWCFSERVICE GET /Sidservice.svc wsdl/_vti_bin/ListData.svc/$metadata&X-ARR-LOG-ID=e15347e4-a7c0-4512-b3b7-a0ddf8d4ba6b 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 3458 857 250
        2014-06-11 05:21:16 SIDWCFSERVICE GET /SidService.svc xsd=xsd2&X-ARR-LOG-ID=377aaf45-1c59-4254-a320-6f4028bf8928 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 992 887 31
        2014-06-11 05:21:16 SIDWCFSERVICE GET /SidService.svc xsd=xsd1&X-ARR-LOG-ID=29fddc12-c18f-42b5-b232-53c9cef6d982 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 2701 887 15
        2014-06-11 05:27:16 ~1SIDWCFSERVICE POST /diagnostics/settings X-ARR-LOG-ID=984746fe-583c-46f0-a241-2817286262f5 443 - 70.37.162.148 Azure-Portal/4.5.00298.11 - - sidwcfservice.scm.azurewebsites.net 204 0 0 462 1286 234
        2014-06-11 05:33:23 SIDWCFSERVICE GET /sidservice.svc X-ARR-LOG-ID=5e5047a3-839b-467d-9d7e-8e79cfe931b7 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445
    - sidwcfservice.azurewebsites.net 200 0 0 1800 804 499
        2014-06-11 05:33:27 SIDWCFSERVICE GET /Sidservice.svc wsdl/$metadata&X-ARR-LOG-ID=af5d2b66-366f-465b-9b38-b5fa6c49d103 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 3458 813 0
        2014-06-11 05:33:27 SIDWCFSERVICE POST /Sidservice.svc wsdl&X-ARR-LOG-ID=a93f30b4-289c-4752-9e32-ba4b23cd5590 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 500 0 0 1548 1324 31
        2014-06-11 05:33:27 SIDWCFSERVICE POST /Sidservice.svc wsdl/mex&X-ARR-LOG-ID=68505196-ed63-4d65-adf2-af6413f450b6 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 500 0 0 1548 1336 31
        2014-06-11 05:33:27 SIDWCFSERVICE GET /Sidservice.svc wsdl/_vti_bin/ListData.svc/$metadata&X-ARR-LOG-ID=8afaa4f2-643e-4534-b8e3-59d2c3755dee 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 3458 857 0
        2014-06-11 05:33:27 SIDWCFSERVICE GET /Sidservice.svc wsdl&X-ARR-LOG-ID=abb68806-eb59-493f-a727-016115e60357 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 8138 793 15
        2014-06-11 05:33:27 SIDWCFSERVICE OPTIONS /Sidservice.svc wsdl/_vti_bin/ListData.svc/$metadata&X-ARR-LOG-ID=5e9ebc9a-e0e0-431a-bbb8-02204af9f10e 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 400 0 0 398 764 31
        2014-06-11 05:33:27 SIDWCFSERVICE GET /SidService.svc xsd=xsd0&X-ARR-LOG-ID=2c7a504a-3c31-4875-add8-c17fd018ff01 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 1688 887 234
        2014-06-11 05:33:28 SIDWCFSERVICE GET /SidService.svc xsd=xsd2&X-ARR-LOG-ID=1727b880-7148-4d15-9e9b-0f866def7c2f 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 992 887 31
        2014-06-11 05:33:28 SIDWCFSERVICE GET /SidService.svc xsd=xsd1&X-ARR-LOG-ID=40fc3543-d6a4-46ce-af1b-5aea83fb86df 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 2701 887 110
        2014-06-11 05:42:21 SIDWCFSERVICE GET /SidService.svc X-ARR-LOG-ID=70ce2aaa-a11b-4862-878b-2a67bbeb1bc5 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 1800 904 46
        2014-06-11 05:42:25 SIDWCFSERVICE GET / X-ARR-LOG-ID=4d51ab01-d247-404f-8d78-3bfda8635a3b 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 304 0 0 364 961 47
        2014-06-11 05:42:34 SIDWCFSERVICE GET / X-ARR-LOG-ID=31d335ef-604f-4653-930f-6f6cf05664b6 443 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 150476 1020 46
        2014-06-11 05:42:35 SIDWCFSERVICE GET /favicon.ico X-ARR-LOG-ID=2fe77edb-dcd9-4fc6-b418-8bdcf2313473 443 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 404 0 2 468 971 31
        2014-06-11 05:42:39 SIDWCFSERVICE GET / X-ARR-LOG-ID=bf6e0cfb-7e5b-408f-9881-37e236b98a49 443 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 150476 1046 15
        2014-06-11 05:42:44 SIDWCFSERVICE GET /SidService.svc X-ARR-LOG-ID=263108d8-4e68-4b52-94bd-5b87186ba45e 443 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/35.0.1916.114+Safari/537.36
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 1801 1048 0
        2014-06-11 05:57:41 SIDWCFSERVICE GET /sidservice.svc X-ARR-LOG-ID=d2ada703-123a-4842-b480-a150aec1080e 80 - 98.192.67.81 Mozilla/5.0+(Windows+NT+6.3;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445
    - sidwcfservice.azurewebsites.net 200 0 0 1800 804 967
        2014-06-11 05:57:44 SIDWCFSERVICE GET /Sidservice.svc wsdl/_vti_bin/ListData.svc/$metadata&X-ARR-LOG-ID=d53f52a5-8a77-439c-9ae7-cc58842d456f 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 3458 857 0
        2014-06-11 05:57:44 SIDWCFSERVICE GET /Sidservice.svc wsdl&X-ARR-LOG-ID=31b4a024-c05d-47a6-91dd-1149f28c73bd 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 8138 793 15
        2014-06-11 05:57:44 SIDWCFSERVICE GET /Sidservice.svc wsdl/$metadata&X-ARR-LOG-ID=68e0c1da-8eb2-4b0d-ad2b-33a88cde8225 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    - - sidwcfservice.azurewebsites.net 200 0 0 3458 813 0
        2014-06-11 05:57:44 SIDWCFSERVICE OPTIONS /Sidservice.svc wsdl/_vti_bin/ListData.svc/$metadata&X-ARR-LOG-ID=9ca1a5ac-d8d3-4a41-bf7a-e118ef3a0e34 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 400 0 0 398 764 31
        2014-06-11 05:57:44 SIDWCFSERVICE POST /Sidservice.svc wsdl&X-ARR-LOG-ID=d9142d70-b052-4355-85cf-54a14e96209a 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 500 0 0 1548 1324 15
        2014-06-11 05:57:44 SIDWCFSERVICE POST /Sidservice.svc wsdl/mex&X-ARR-LOG-ID=19e8da83-aaaf-4ff8-b5ea-73508c494ac1 443 - 98.192.67.81 - - - sidwcfservice.azurewebsites.net 500 0 0 1548 1336 64
        2014-06-11 05:57:44 SIDWCFSERVICE GET /SidService.svc xsd=xsd0&X-ARR-LOG-ID=252dd0dd-1b84-4675-b855-750f69a49d07 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 1688 887 234
        2014-06-11 05:57:44 SIDWCFSERVICE GET /SidService.svc xsd=xsd2&X-ARR-LOG-ID=cc247b32-9145-4823-9927-d417f12cb360 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 992 887 0
        2014-06-11 05:57:44 SIDWCFSERVICE GET /SidService.svc xsd=xsd1&X-ARR-LOG-ID=ae402fb1-5caf-4e76-997a-6b2551cb3d49 443 - 98.192.67.81 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+4.0.30319.34014)
    ARRAffinity=bd0ad669a44c5d1cd8901d2d8014718c9386a2f2ad52bb066cf1cfd489ed6445 - sidwcfservice.azurewebsites.net 200 0 0 2701 887 15

    hi,
    Firstly, I suggest you could see the same error threads (http://social.msdn.microsoft.com/Forums/windowsazure/en-US/5cf817b3-1295-41d7-b156-ce7aa5e4d11e/502-web-server-received-an-invalid-response-while-acting-as-a-gateway-or-proxy-server?forum=windowsazurewebsitespreview
    ). And then, I recommend you could refer to this basic code sample(
    http://social.technet.microsoft.com/wiki/contents/articles/4027.wcf-soap-service-with-federated-authentication.aspx ). And I recommend you could download this code sample and try to use it(http://code.msdn.microsoft.com/Windows-Azure-AD-Access-0dcde385/sourcecode?fileId=71587&pathId=477793108
    Please try it.
    hope this helps.
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • 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

  • Sun Web Server 6 to 7 Command Line Migration - Syntax Question

    I have used the GUI-based migration tool in a development environment and it works flawlessly. However, in prod environments I cannot use the GUI as a matter of policy. In reading the 6x to 7x migration guide, the following example is included for command-line based migrations:
    wadm> migrate-server [--user=admin-user] [--passwordfile=*admin-pswd-file*][--host=admin-host][--port=admin-port][--no-ssl][--rcfile=*rcfile*][--echo][--no-prompt][--verbose][--search-collection-copy-path=directory][--log-dir=directory]([--all|[--config=newconfigname[--instance=instancename]) --server-root=path
    In looking at my 6 and 7 web server instances, I cannot locate a password file or the rcfile. Is the password file optional? Do you have to create one or does the server generate this for you? Also, what is the rcfile and where would I find it?
    Thanks!

    As a rule, any option mentioned b/w [ and ] is optional.
    Both password-file and rcfile are provided to avoid any prompts by the CLI.
    For example if the password-file is provided (with the passwords) then the CLI will not prompt for the passwords. If not, the CLI will prompt for passwords.
    In the rcfile you may set variables for path to the password file, user name, standard option values like config name, vs name, etc.
    Find more details in http://blogs.sun.com/yamini/entry/starting_off_with_web_server.
    For more details on the individual commands check out http://docs.sun.com/app/docs/doc/820-2204/6ndqrqrou?l=en&a=view

  • Personal Web Server - Configuration Question

    Hi All,
    I am attempting to change the 'home directory' of the personal web server from the default to '\www'. Based on my understanding this can be done by simply editing 'httpd.conf'.
    However, I am unable to edit this file, or even make a copy of it. The account that I am using has got the 'administrator' check enabled, and when attempt to type 'su' in the console, and enter my password, it responds with 'sorry'.
    How does one therefore get enough permissions to edit this file?
    Regards
    Olaf

    You probably can't su to root in the terminal because root is disabled by default as a security measure. If you want to edit that file you can use sudo to execute a command as root. In the terminal try:
    sudo emacs httpd.conf
    and then enter your password. You'll probably have to save it to another location because of directory permissions and then copy it over or something. The rest is left as an exercise to the reader.

  • Question about writing a web server

    I was asked to write a simple Web server that responds to HTTP requests received on port 808
    It has the following features:
    1.a request for an HTML document or image file should generate a response with the appropriate MIME type
    2.a request for a directory name with a trailing / should return the contents of the index.html file in that directory (if it exists) or else a suitably formatted HTML listing of the directory contents, including information about each file
    3.a request for a directory name without a trailing / should generate an appropriate Redirect response
    4.a request for a non-existent file or directory should generate an appropriate error response
    5/the Web server should be multi-threaded so that it can cope with multiple
    how to do it?
    may anyone help me please?

    As a startert for ten, try this that I had lying around form a previous
    forum response.
    java -cp <whatever> Httpd 808
    and connect to http://localhost:808 to get an eye-full.
    If you should use this for anything approacing a commercial
    purpose, I will, of course, expect sizable sums of money to be
    deposited in my Swiss bank account on a regular basis.
    Darn it! I'm serious!
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Httpd
         implements Runnable
         private static String HTTP_400=
              "<HTML><BODY><H2>400 Bad Request</H2></BODY></HTML>";
         private static String HTTP_403=
              "<HTML><BODY><H2>403 Forbidden</H2></BODY></HEAD>";
         private static String HTTP_404=
              "HTML><BODY><H2>404 Not Found</H2></BODY></HTML>";
         public static void main(String[] argv)
              throws Exception
              new Thread(new Httpd(Integer.parseInt(argv[0]))).start();
         private int mPort;
         public Httpd(int port) { mPort= port; }
         public void run()
              try {
                   ServerSocket listenSocket= new ServerSocket(mPort);
                   System.err.println("HTTPD listening on port " +mPort);
                   System.setSecurityManager(new SecurityManager() {
                        public void checkConnect(String host, int p) {};
                        public void checkCreateClassLoader() {};
                        public void checkAccess(Thread g) {};
                        public void checkListen(int p) {};
                        public void checkLink(String lib) {};
                        public void checkPropertyAccess(String key) {};
                        public void checkAccept(String host, int p) {};
                        public void checkAccess(ThreadGroup g) {};
                        public void checkRead(FileDescriptor fd) {};
                        public void checkWrite(String f) {};
                        public void checkWrite(FileDescriptor fd) {};
                        // Make sure the client is not attempting to get behind
                        // the root directory of the server
                        public void checkRead(String filename) {
                             if ((filename.indexOf("..") != -1) || (filename.startsWith("/")))
                                  throw new SecurityException("Back off, dude!");
                   while (true) {
                        final Socket client= listenSocket.accept();
                        new Thread(new Runnable() {
                             public void run() {
                                  try {
                                       handleClientConnect(client);
                                  catch (Exception e) {
                                       e.printStackTrace();
                        }).start();
              catch (Exception e) {
                   e.printStackTrace();
         private void handleClientConnect(Socket client)
              throws Exception
              BufferedReader is= new BufferedReader(
                   new InputStreamReader(client.getInputStream()));
              DataOutputStream os= new DataOutputStream(client.getOutputStream());
              // get a request and parse it.
              String request= is.readLine();
              StringTokenizer st= new StringTokenizer(request);
              if (st.countTokens() >= 2) {
                   String szCmd= st.nextToken();
                   String szPath= st.nextToken();
                   if (szCmd.equals("GET")) {
                        try {
                             handleHttpGet(os, szPath);
                        catch (SecurityException se) {
                             os.writeBytes(HTTP_403);
                   else
                        os.writeBytes(HTTP_400);
              else
                   os.writeBytes(HTTP_400);
              os.close();
         private void handleHttpGet(DataOutputStream os, String request)
              throws Exception
              if (request.startsWith("/"))
                   request= request.substring(1);
              String path= request;
              File f;
              if (request.endsWith("/") || request.equals("")) {
                   path= request +"index.html";
                   f= new File(path);
                   if (!f.exists()) {
                        if (request.endsWith("/"))
                             path= request.substring(0, request.length()-1);
                        else if (request.equals(""))
                             path= ".";
                        f= new File(path);
              else
                   f= new File(path);
              if (!f.exists())
                   os.writeBytes(HTTP_404);
              else if (f.isFile())
                   getFile(os, f);
              else if (f.isDirectory())
                   getDirectory(os, f);
         private void getDirectory(DataOutputStream os, File f)
              throws Exception
              getDirectory(os, f, "");
         private void getDirectory(DataOutputStream os, File f, String prefix)
              throws Exception
              StringBuffer szBuf= new StringBuffer();
              String szTitle= "Index of /";
              if (!f.getPath().equals("."))
                   szTitle= "Index of " +f.getPath().substring(prefix.length());
              szBuf.append("<HTML><HEAD><TITLE>");
              szBuf.append(szTitle);
              szBuf.append("</TITLE></HEAD><BODY><H1>");
              szBuf.append(szTitle);
              szBuf.append("</H1><BR><PRE>");
              szBuf.append(
                   "Name                              Last Modified              Size<HR>");
              String dir= "";
              if (!f.getPath().equals(".")) {
                   dir= f.getPath() +"/";
                   szBuf.append("<A HREF=\"..\">Parent Directory</A><BR>");
              java.text.SimpleDateFormat fmt=
                   new java.text.SimpleDateFormat("EEE MMM d yyyy hh:m:ss");
              String[] list= f.list();
              for (int i= 0; i< list.length; i++) {
                   String path= list;
                   File d= new File(dir + path);
                   if (d.isDirectory())
                        path += "/";
                   szBuf.append("<A HREF=\"");
                   szBuf.append(path);
                   szBuf.append("\">");
                   szBuf.append(path);
                   szBuf.append("</A>");
                   for (int j= path.length(); j< 34; j++)
                        szBuf.append(" ");
                   if (d.isDirectory())
                        szBuf.append("[DIR]");
                   else {
                        szBuf.append(fmt.format(new java.util.Date(f.lastModified())));
                        szBuf.append(" ");
                        szBuf.append(formatFileSize(d.length()));
                   szBuf.append("<BR>");
              szBuf.append("</PRE></BODY></HTML>");
              byte[] buf= szBuf.toString().getBytes();
              os.write(buf,0,buf.length);
         private String formatFileSize(long size)
              if (size < 1024)
                   return "" +size;
              if (size < (1024*1024))
                   return (new Float(size/1024).intValue()) +"K";
              if (size < (1024*1024*1024))
                   return (new Float(size/(1024*1024)).intValue()) +"M";
              if (size < (1024*1024*1024*1024))
                   return (new Float(size/(1024*1024*1024)).intValue()) +"G";
              return "Massive!";
         private void getFile(DataOutputStream os, File f)
              throws Exception
              DataInputStream in= new DataInputStream(new FileInputStream(f));
              int len= (int) f.length();
              byte[] buf= new byte[len];
              in.readFully(buf);
              os.write(buf,0,len);
              in.close();

  • Netscape Messaging Server & iPlanet Web Server question

    The netscape messaging server (v 4.1) is receiving emails which are html-only formatted. Through webmail, the body appears to be empty. When checking the message store, the message is not empty. When accessing through webmail, we are able to view the emails that arrive in the html and plain text formats (both together) or plain text, but not those that arrive html-only. The webserver is iPlanet Web Server, Enterprise Edition.
    Is there any workaround for that, or is it a limitation of the web server?

    WEll, um,
    1. Netscape Messaging Server 4.xx, all versions have been End Of Support life for over 2 years.
    2. There is no web server involved, here. Messaging itself serves the http interface.
    3. Yes, there is a workaround. Upgrade. You're using very old bits, and the only real answer is for you to use a current product, if you need current features.
    Messaging Server 5.2p2 is considered "mature", though still under support. No new features are getting added.
    Messaging Server 6.2 is the current product. It's part of the Sun Java Enterprise System, and may be downloaded.

  • Newbie Web server question

    Hello,
    I've been able to setup my J2EE web server on localhost (my computer). But now I want to access this web server from within my intranet network, on another machine.
    How do I do this? Right now the URL to the servlet is
    http://locahost:8000/foo
    How do I configure my server to run that URL on another machine within the network?
    Thanks!

    I think you don't need to. Try http://your_LOCAL_ip_address:8080/foo
    That should work if I'm not terribly mistaken. I've never tried it actually. This is all assuming you don't have a nasty firewall that will block the incoming connection of course.

Maybe you are looking for

  • Cross Plant Planning- MRP activation indicator turned after the creation of Material code

    Dear Experts, Working on Cross plant planning, where 1001 Production plant will stock transfer material to 8 different plants. Right now, only 10001 plant had MRP and planning file entry ticked in customizing OMDU. The other 8 plants have Materials c

  • Error while doing EHP4 upgrade in downtime phase

    HI . Iam facing the below error while doing the EHP4 upgrade , in downtime phase. Checks after phase MAIN_SWITCH/STARTSAP_TRANS were negative! Last error code set: RFC call to subst_get_uvers failed with key RFC_ERROR_COMMUNICATION (open): SAP_CMINIT

  • How can I print all events in iCal?

    Hello, I need to print all the events I have in 2013 on one page (using iCal). When I select a list, it prints all days, whether they have events or not. I only need to have a list of events in 2013. Is that possible to view or print in iCal ?

  • Latest version of firefox is sluggish opening new tab

    This has been an ongoing problem on last several updates and definitely intermittent ,but seems worse in last two updates.Mostly when opening new site locations.

  • Error on task manager BPEL 10.1.3.4.7 - oc4j

    Hi, I'm having problem with Task Manager on bpel 10.1.3.4.7 using oc4j, cluster environment. The following errors appears on error log intermittently, if I try to reprocess the same bpel process it works: ERROR> <segmentacao.collaxa.cube> <BaseCubeSe