Retrieve the Hostname and port of the server

Hi,
How can i from my webdynpro code get the hostname and the port of the server in which the program is running?
Thanks in Advance!
Jo

Hi Jo,
I think so u can retrive using this URL:
http://<host name>:<port number>/webdynpro/dispatcher/local/<Web Dynpro project>/<name of Web Dynpro application>.
check on to this link for more details:
http://help.sap.com/saphelp_erp2005/helpdata/en/7d/09044132bcef23e10000000a155106/frameset.htm
Hope tihs helps u,
Regards,
Nagarajan.

Similar Messages

  • How to get server hostname and port from web form

    Hi All,
    I need to find out server hostname and port number
    from 9i form.
    That is if the form was called via:
    http://myserver.com:1234/f90servlet?form=test,
    i would like to call some
    GET_XXX_PROPERTY(SERVER_HOSTNAME) that would return
    myserver.com
    and
    GET_XXX_PROPERTY(SERVER_PORT) that would return
    1234
    or alternatively
    GET_XXX_PROPERTY(SERVER_URL) that would return
    complete URL, so that i can parse it myself.
    Does anything like this exist? If not,would be
    possible to get that information from any Java
    function via java importer?
    BR,
    Robert
    BR,
    Robert

    Robert,
    I'd add the code as a Java Bean in Forms and get this information from the Forms request URL.
    Add the following bean to a Canvas and make it a size of 1x1 pixel so taht it appears hidden
    import java.applet.Applet;
    import java.net.URL;
    import oracle.forms.handler.IHandler;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.VBean;
    public class FrmRequestInfo extends VBean
    public static final ID pGetPort = ID.registerProperty("GET_PORT");
    public static final ID pGetHost = ID.registerProperty("GET_HOST");
    public static final ID pGetProtocol = ID.registerProperty("GET_PROTOCOL");
    private String _host;
    private String _port;
    private String _protocol;
    private URL FormsURL;
    Applet m_applet;
    /*Forms settings*/
    IHandler m_handler;
    public FrmRequestInfo()
    public final void init (IHandler handler)
    super.init(handler);
    m_handler = handler;
    // get the forms applet handler
    m_applet = m_handler.getApplet();
    // initialize cookie domain to the same domain that runs Forms
    // Services
    FormsURL = m_applet.getDocumentBase();
    _host = FormsURL.getHost();
    _port = new Integer(FormsURL.getPort()).toString();
    _protocol = FormsURL.getProtocol();
    public Object getProperty(ID p0)
    if (p0 == pGetHost)
    return _host;
    else if (p0 == pGetPort)
    return _port;
    else if (p0 == pGetProtocol)
    return _protocol;
    else
    return super.getProperty(p0);
    To get the port number you call
    VarcharVariable_Port := get_custom_property('beanblock.beanname',1,'GET_PORT');
    for the hostname
    VarcharVariable_Host:= get_custom_property('beanblock.beanname',1,'GET_HOST');
    Frank
    Ps.: just wrote the bean on the fly, without testing - but I am positive that it works as similar functionality works for me in other beans.

  • Web service invocation problem on host hostname and port 8000 protocol : http logical port name : LP_WS_SMDAGENT_MONITORING

    hello colleagues,
    In the phase Connect Diagnostics dont show the Agent available in SLD, but when go to SLD i have the agents,
    Error,
    Connect Diagnostics Agent
    The table does not contain any data
    Agent availables in all SLD
    SOAP:1.007 SRT: Unupported xstream found: ("HTTP Code 401 : Unauthorized")
    Web service invocation problem on host hostname and port 8000 protocol : http logical port name : LP_WS_SMDAGENT_MONITORING
    Thanks

    OK, then pls follow below steps;
    - Go to step 'Create Users' in solman_setup System Preparation scenario and make sure the user SM_INTERN_WS has a green status. Use the 'Test Login' button to make sure the user is not locked and has correct credentials maintained in solman_setup
    - Immediately after checking the user status, navigate to Configure Connectivity->Enable Web Services and execute again the 'Create Logical Ports' automatic activity, in order to propagate the correct credentials to the Logical Port definitions.
    - If the above operation is not successful, repeat the two steps above, providing a different user Id in 'Create Users' step, eg SM_INTERN_W1. This will prevent situations where the user gets locked by Logical Ports using an obsolete password.
    Let me know the results.
    Regards,
    Vivek

  • Getting Proxy name and proxy port using Hostname and port

    Hi Colleagues,
    I my Application i am consuming webserice and i am setting proxy host and proxy port using the below code :
    httpItf  = HTTPControlFactory.getInterface(port);
    httpItf.setHTTPProxy("proxy", 8080);
    But this "Proxy" is getting changed if the application is deployed to another network. (like some other landscape)
    So Could it be possible to get the proxy dynamically depending on the Hostname and port.
    such that it should automatically pick up the "ProxyHost" and "Proxy port".........depending upon the system it runs .
    Please help me out here
    Thanks & Regards
    Swetha
    Edited by: Swetha Nellore on Sep 17, 2009 7:52 AM

    Hi Colleagues,
    i have solved this by maintaining a proxy settings properties file.....where proxy settings can be changed using system administrator
    Thanks & Regards
    Swetha

  • How to read the J2EE server hostname and port programmatically

    Is there any API to read the J2EE server host and port programmatically? I am looking for the hostname where the components are deployed so that I can append the wsdl path to the server and create an URL.

    Hi Larry,
    there is a standard J2EE Servlet API  for your case.
    In a servlet or jsp file you can get the host and prot from the request object.
    For example in a JSP file :
    request.getScheme();
      request.getServerName()
        request.getServerPort()
    You can check the whole API here :
    http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRequest.html#getServerName()
    Bets Regards
    Bojidar

  • How to read the Domain and Port of our server

    hi guru,
    Is there any method to get the portal Domain and Port .
    http://<domain>:<port>/irj/portal
    http://<Domain><port>  /irj/servlet/prt/portal/prtroot/com.sap.portal.appintegrator.sap.bwc.Transaction?System=NIB_Aliase&SAP_TCode=se80
    in our project  we are hard coded the Domain and port .
    if we transfer the application is some other server again we want to change.
    So is there any solution for that.Please help me in this situation
    Advance thank's
    Regard's
    Vivekanathan.S

    Hi,
    import com.sap.tc.webdynpro.services.sal.deployment.api.WDDeployableObjectPart;
    import com.sap.tc.webdynpro.services.task.TaskBinder;
      WDDeployableObjectPart d = wdComponentAPI.getDeployableObjectPart();
      String hostName = TaskBinder.getCurrentTask().getProtocolAdapter().getServerName();
      int port = TaskBinder.getCurrentTask().getProtocolAdapter().getServerPort();
    With the above code you can get the host name, and port.
    If your problem is solved, award me the points.
    Thanks,
    Srini

  • What is the difference between SID,HOSTNAME and port number?

    I want to know difference between SID,HOSTNAME and portnumber with purposes. could any one explain me with examples,please?
    Thanks in advance.

    Raghavendra Rao J S V wrote:
    I want to know difference between SID,HOSTNAME and portnumber with purposes. could any one explain me with examples,please?http://bit.ly/PkIJfi
    http://bit.ly/PkIMri
    http://bit.ly/PkINvD
    Thanks,
    Hussein

  • How to retrieve the server IP address

    Hi Experts,
    In my scenario, if some problem occur, then the XSLT mapping sends a mail to some one,subject is 'PRD', if we execute this from production or quality or development server.
    But now i want to know this mail from which server, so i want to change the subject line as 'PRD' if it is only from production system otherwise 'OTH', how to achieve this ? No hard code allow at any where.
    I have one thought, if we find the server ip address then we can recognize, but how to get the server IP address ? Is it possible ?
    Thanks
    Ramesh

    Hi,
    My source is some WSDL file, this is more than 15000 characters so i am unable to send the full file.
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
         <wsdl:types>
              <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                   <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd" />
                   <xsd:element name="Pip3A4PurchaseOrderRequest" type="Pip3A4PurchaseOrderRequest" />
                   <xsd:complexType name="Pip3A4PurchaseOrderRequest">
                        <xsd:sequence>
                             <xsd:element name="fromRole" type="fromRole" />
                             <xsd:element name="GlobalDocumentFunctionCode" type="xsd:string" />
                             <xsd:element name="PurchaseOrder" type="PurchaseOrder" />
                             <xsd:element name="thisDocumentGenerationDateTime" type="thisDocumentGenerationDateTime" />
                             <xsd:element name="thisDocumentIdentifier" type="thisDocumentIdentifier" />
                             <xsd:element name="toRole" type="toRole" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="fromRole">
                        <xsd:sequence>
                             <xsd:element name="PartnerRoleDescription" type="PartnerRoleDescription" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="PartnerRoleDescription">
                        <xsd:sequence>
                             <xsd:element name="ContactInformation" type="ContactInformation" minOccurs="0" />
                             <xsd:element name="GlobalPartnerRoleClassificationCode" type="xsd:string" />
                             <xsd:element name="PartnerDescription" type="PartnerDescription" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="ContactInformation">
                        <xsd:sequence>
                             <xsd:element name="contactName" type="contactName" minOccurs="0" />
                             <xsd:element name="EmailAddress" type="xsd:string" minOccurs="0" />
                             <xsd:element name="facsimileNumber" type="facsimileNumber" minOccurs="0" />
                             <xsd:element name="telephoneNumber" type="telephoneNumber" minOccurs="0" />
                             <xsd:element name="PhysicalAddress" type="PhysicalAddress" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="contactName">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="FreeFormText">
                        <xsd:simpleContent>
                             <xsd:extension base="xsd:string">
                                  <xsd:attribute ref="xml:lang" />
                             </xsd:extension>
                        </xsd:simpleContent>
                   </xsd:complexType>
                   <xsd:complexType name="facsimileNumber">
                        <xsd:sequence>
                             <xsd:element name="CommunicationsNumber" type="xsd:string" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="telephoneNumber">
                        <xsd:sequence>
                             <xsd:element name="CommunicationsNumber" type="xsd:string" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="PartnerDescription">
                        <xsd:sequence>
                             <xsd:element name="BusinessDescription" type="BusinessDescription" />
                             <xsd:element name="GlobalPartnerClassificationCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="PhysicalAddress" type="PhysicalAddress" minOccurs="0" />
                             <xsd:element name="ContactInformation" type="ContactInformation" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="BusinessDescription">
                        <xsd:sequence>
                             <xsd:element name="GlobalBusinessIdentifier" type="xsd:string" minOccurs="0" />
                             <xsd:element name="GlobalSupplyChainCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="businessName" type="businessName" minOccurs="0" />
                             <xsd:element name="NationalBusinessTaxIdentifier" type="NationalBusinessTaxIdentifier" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="PurchaseOrder">
                        <xsd:sequence>
                             <xsd:element name="AccountDescription" type="AccountDescription" minOccurs="0" />
                             <xsd:element name="comments" type="comments" minOccurs="0" />
                             <xsd:element name="ContractInformation" type="ContractInformation" minOccurs="0" maxOccurs="unbounded" />
                             <xsd:element name="DocumentReference" type="DocumentReference" minOccurs="0" maxOccurs="unbounded" />
                             <xsd:element name="FinancingTerms" type="FinancingTerms" minOccurs="0" maxOccurs="unbounded" />
                             <xsd:element name="generalServicesAdministrationNumber" type="generalServicesAdministrationNumber" minOccurs="0" />
                             <xsd:element name="GlobalGovernmentPriorityRatingCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="GlobalPurchaseOrderFillPriorityCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="GlobalPurchaseOrderTypeCode" type="xsd:string" maxOccurs="unbounded" />
                             <xsd:element name="governmentContractIdentifier" type="governmentContractIdentifier" minOccurs="0" />
                             <xsd:element name="installAt" type="installAt" minOccurs="0" />
                             <xsd:element name="isDropShip" type="isDropShip" />
                             <xsd:element name="OrderShippingInformation" type="OrderShippingInformation" minOccurs="0" />
                             <xsd:element name="ProductLineItem" type="ProductLineItem" maxOccurs="unbounded" />
                             <xsd:element name="proprietaryInformation" type="proprietaryInformation" minOccurs="0" />
                             <xsd:element name="requestedEvent" type="requestedEvent" minOccurs="0" />
                             <xsd:element name="requestedShipFrom" type="requestedShipFrom" minOccurs="0" maxOccurs="unbounded" />
                             <xsd:element name="SecondaryBuyer" type="SecondaryBuyer" minOccurs="0" />
                             <xsd:element name="shipTo" type="shipTo" minOccurs="0" />
                             <xsd:element name="TaxExemptStatus" type="TaxExemptStatus" minOccurs="0" />
                             <xsd:element name="totalAmount" type="totalAmount" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="AccountDescription">
                        <xsd:sequence>
                             <xsd:element name="accountName" type="accountName" />
                             <xsd:element name="AccountNumber" type="xsd:string" minOccurs="0" />
                             <xsd:element name="billTo" type="billTo" minOccurs="0" />
                             <xsd:element name="CreditCard" type="CreditCard" minOccurs="0" />
                             <xsd:element name="financedBy" type="financedBy" minOccurs="0" />
                             <xsd:element name="GlobalAccountClassificationCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="prePaymentCheckNumber" type="prePaymentCheckNumber" minOccurs="0" />
                             <xsd:element name="WireTransferIdentifier" type="xsd:string" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="accountName">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="billTo">
                        <xsd:sequence>
                             <xsd:element name="PartnerRoleDescription" type="PartnerRoleDescription" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="PhysicalAddress">
                        <xsd:sequence>
                             <xsd:element name="addressLine1" type="addressLine1" minOccurs="0" />
                             <xsd:element name="addressLine2" type="addressLine2" minOccurs="0" />
                             <xsd:element name="addressLine3" type="addressLine3" minOccurs="0" />
                             <xsd:element name="cityName" type="cityName" minOccurs="0" />
                             <xsd:element name="GlobalCountryCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="GlobalLocationIdentifier" type="xsd:string" minOccurs="0" />
                             <xsd:element name="NationalPostalCode" type="xsd:string" minOccurs="0" />
                             <xsd:element name="postOfficeBoxIdentifier" type="postOfficeBoxIdentifier" minOccurs="0" />
                             <xsd:element name="regionName" type="regionName" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="addressLine1">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="addressLine2">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="addressLine3">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="cityName">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="postOfficeBoxIdentifier">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="regionName">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="businessName">
                        <xsd:sequence>
                             <xsd:element name="FreeFormText" type="FreeFormText" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="CreditCard">
                        <xsd:sequence>
                             <xsd:element name="cardHolderName" type="cardHolderName" />
                             <xsd:element name="creditCardIdentifier" type="creditCardIdentifier" />
                             <xsd:element name="expiryDate" type="expiryDate" />
                             <xsd:element name="GlobalCreditCardClassificationCode" type="xsd:string">

  • Retrieve Source IP and Port

    Hi!
    I want to write a client/server program. The client should send a udp packet and the server should answer the packet telling the client from which source ip address and port he received the packet.
    Is it somehow possible with java to retrieve the address/port a packet came from ?
    Thanks, Jack

    That's what I was looking for.
    Thanks

  • How to get server name and port of OSB server in a proxy service ?

    I need to get the server name and port of the OSB server inside a proxy service. How can I get this?

    You may use java callout for this purpose -
    How to get ServerName and ApplicationName in OSB (ALSB) ?
    Regards,
    Anuj

  • Changing IP Address and ports in Directory Server 5.1 SP 4 and 5.2 SP4

    I have installed multiple instance of Sun Directory Server 5.1 and 5.2 on ports 389 and 390,now I want to change the IP Address and ports, I am able to change the directory server port from 389 by editing the dse.ldif file, now I want to change the port 390 and the IP address same as directory server, can someone expert from the forum guide me.
    Thanks in Advance.
    Mukesh Kumar

    1) I don't know what you've typed in when installing... but I've never seen that message. Are you using any language specific characters ?
    Do you get the error after this screen ?
    <b>
    The suffix is the root of your directory tree. You may have more than
    one suffix.
    Suffix [dc=sun,dc=com]:
    </b>
    If yes, then this means that the value you typed in is not a valid DN... and you must enter a valid one.
    2)The Directory Server is installed under /usr/iplanet but the database is under /var/iplanet/ds5 and configuration is under /etc/iplanet/ds5 ...
    You can use symbolic links if you want to move things around.
    3) You mean you downloaded the tar.gx file of iDS 5.1 and install it on Solaris 9... No problem, I do this every day. As long as you have right to create directories and files, you should be able to install as anyone. If not, you should install as root and then let the server run as a special user.
    4) Solaris 9 comes with iDS5.1 packages already installed. But the server is not configured at all.
    Running directoryserver setup allows you to configure it and create the database, accounts...
    Running directoryserver uninstall remove the instance of the installed database... It doesn't remove the packages. You can start again a setup...
    By the way, I think that iDS 5.1 on Solaris 9 comes with the full documentation... May be you should start by reading it.
    Regards,
    Ludovic.

  • How to determine SMTP hostname, and port?

    I need create e-mail configure option in my application. And I have to determine what settings of e-mail is installed.
    Regards Kostya!

    Hi Kostyal,
    check out the interesting posting done by Jornica at http://jornica.blogspot.com/2007/01/apex-system-preferences.html
    Patrick
    Check out my APEX-blog: http://inside-apex.blogspot.com

  • OSB proxy hostname and port

    Hi All,
    I have a VIP(load balancer) in front of the machine where the OSB is installed.(The environment is not presently clustered but we have a VIP so we can extend it in future)
    There are few proxy's which the end consumers will be invoking .When we export the wsdl of the proxy , it has the actual IP in the address tag but we want the VIP address(we dont want to change the wsdl manually and pass it to consumer).
    Is there any setting that needs to be done on the OSB/weblogic side for the VIP?
    Thank You.

    The file is available but i dont see <cluster> in the file. I have only one node and is not a cluster installation. Is that the reason?
    Yes, cluster node (<cluster>) will be there only when you have a cluster in your domain. Metalink note 973743.1 is for clustered installations. For customizing host name in WSDL, refer metalink note 1073694.1
    Regards,
    Anuj

  • How do I find the name of the server?

    Hi all,
    I've finished a server program that returns a hard-coded html page via a socket but was hoping to make it as authentic as possible. Therefore is there a way of retrieving the server's name that I'm conecting to without using servlets?
    My code is:-
    /*This program is designed to take a GET request from HTTPClient.java and return
    *a hard-coded html document to the client. This program is run on the student
    *server and listens to requests from the client program which should be run
    *on the local machine.*/
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class HTTPServer{
        String version = null;
        public static void main(String argv[]){
        //I've added this statement for those that may be unfamiliar of how to run
        //the program.     
        if (argv.length != 1) {
             System.out.println("usage: java HTTPServer port");
             System.exit(1);
        //creates a new HTTPSever, argv[0] is the port.
         new HTTPServer(Integer.parseInt(argv[0]));
        public HTTPServer(int port){
         boolean listening = true;
        //Socket's must be created in a try and catch block as they may generate
        //exceptions, which the program must deal with.
         try{
              ServerSocket ss = new ServerSocket(port);
              System.out.println("HTTP Server running and listening for requests...");
              while (listening){
               Socket mySocket = ss.accept();
               //create an InputStream called 'in'
               InputStream in   = mySocket.getInputStream();
               //pass 'in' to the readHeaders method
               readHeaders(in);
               //call getResponse method to obtain the desired string and assign to
               //'response'
               String response = getResponse();
               //creates an OutputStream called 'out'
               OutputStream out = mySocket.getOutputStream();
               //transform 'response' into a byte array ready for output
               out.write(response.getBytes("US-ASCII"));
               //sends output to client
               out.flush();
               //close socket
               mySocket.close();
          catch(Exception e){System.out.println(e.getMessage());}
         /*This method creates a string buffer and appends the html to it. It then
          *gets transformed to a string and all leading and trailing white space
          *is trimmed. Finally the string is returned.*/
        private String getResponse(){
             //creates StringBuffer called 'responseBuf'.
             StringBuffer responseBuf = new StringBuffer();
             //get today's date and convert to a string
             Date date = new Date();
             String todayDate = date.toString();
             //appends values in brackets to responseBuf
             responseBuf.append (version + " 200 OK\r\n");
             responseBuf.append ("Date: " + todayDate + "\r\n");
             responseBuf.append ("Content-type: text/html\r\n");
             responseBuf.append ("Content-length: 119\r\n");
             responseBuf.append ("Last-modified: Thu, 21 July 2005 15:00:00 GMT \r\n");
             responseBuf.append ("<HTML>\r\n");
             responseBuf.append ("<TITLE> My served web document </TITLE>\r\n");
             responseBuf.append ("</HEAD>\r\n");
             responseBuf.append ("<BODY>\r\n");
             responseBuf.append ("<H1> Hello from the server! </H1>\r\n");
             responseBuf.append ("</BODY>\r\n");
             responseBuf.append ("</HTML>\r\n\r\n");
             //converts responseBuf to String called 'response'
             String response = responseBuf.toString();
             //trims any leading or trailing white space from string.
             response = response.trim();
             //returns the string
              return response;
         /*This method reads in the string from the client until either a header
          *block termination (\r\n\r\n) is read, or when the client disconnects
          *(ch == -1). When a character is received it gets stored in an array and
          *also in a string buffer. I decided to use a character array as it enabled
          *me to check for the header block termination commands with relative ease.
          *When the if loop condition is met the program breaks out of the while
          *loop. The StringBuffer sbuf now contains the full request from the client.
          *The program now converts the buffer to a string and trims any leading and
          *trailing white space. From here the string is then split into substrings
          *and stored in a string array. The program finally checks for the HTTP
          *version.*/
        private void readHeaders(InputStream in) throws IOException {
              //Creates a character array to store each character one-by-one.
              char [] inputArr = new char [200];
              //Creates StringBuffer called 'sbuf'
              StringBuffer sbuf = new StringBuffer();
              //Integer 'count' set to zero. Will be used to position each character
              //in the character array.
              int count = 0;
              //Initialise new integer called 'ch'
              int ch;
              //Initialise a new String called 'clientStr'
              String clientStr;
              //While there is something to read and socket is connected, add each
              //character to the character array and the buffer as long as the program
              //doesn't receive the header block termination.
              while ((ch = in.read()) != -1) {
                   inputArr[count] = (char) ch;
                   if ((inputArr[count] == '\n') && (inputArr[count - 1] == '\r')
                   && (inputArr[count - 2] == '\n') && (inputArr[count - 3] == '\r'))
                    break;
                    count++;
                    sbuf.append((char) ch);
         //clientStr will hold string in string buffer without any leading or
         //trailing white space.
             clientStr = sbuf.toString();
             clientStr = clientStr.trim();
         //Split clientStr into substrings and store them in an array.
         String [] tokens = clientStr.split(" ");
         //Obtains HTTP version
         version = tokens [2];
    }Thanks in advance,
    Chris

    When an HTTP message is sent to my client it should send something like:-
    HTTP/1.0 200 OK
    Date: Thurs, 21 Jul 2005 21:30:00 GMT
    Server: Apache/1.3.26
    etc....
    The bit I'm trying to obtain is the Server line. Is it the server type perhaps as opposed to the name? I would imagine it's something like String serverName = Server.getName().toString(); but that doesn't work.

  • Getting the Server Details.

    Hi All,
    I am required to develop a Composite Application Service which will give the server details like HOSTNAME and PORT NO of the deployment server.Is there any way of fetching these details ?
    Could someone please help me out with this issue ?
    Regards,
    Gaurav.

    HI,
    Are you talking about SAP server??
    If it is ABAP stack, you can get by system-->status
    If java stack, then you can get by URL http://<fully qualified hostname>:5<nn>00
    where nn is the instance number.
    Regards,
    Kunal.

Maybe you are looking for