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.

Similar Messages

  • 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

  • How to get Server Name and port. Urgent.....

    Hi,
    Please let me know how can i get the server name and port without using request object.
    I am getting it :- request.getServerName();
    But, pl. let me know how can I get it without using this request object.
    Waiting for reply..

    I don't know of any way to trivially access that, but why do you need to do this? If you need access to that information in a method that can't see your HttpServletRequest, then perhaps your architecture has a flaw, and you'll be better off in the long run restructuring it.

  • How to get customer number and name from the SD document

    Hi All,
    Can you please let me know how to get Customer Number and Name from the SD Document?
    Thanks a lot....
    Anil

    Hi,
    It will be displayed in the SD (BIlling document) itself,  you clikc on the VF03. The customer name and number will also appear in the SO document also Tcode VA03
    regards,
    radhika
    Edited by: kolipara radhika on Jul 10, 2009 5:32 AM

  • 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

  • Retriving server IP and port from webservice context

    Hello
    In a JSP page its possible to do this:
    request.getServerName()
    request.getServerPort()
    In order to retrieve the server IP and port.
    How is this done in a webservice context?
    Oliver Billing
    DIF

    No. The way to get that information is to go to the database administrator and ask.

  • How to get my photos and music from my iphone to my hp laptop without having windowed on my laptop

    i just got anew hp laptop.  it does not have windows.  I want to be able to link my iphone with my laptop but don't know how.  want to be able to get my photos and music from my phone to my laptop and be able to load music on to my ipod. Is this possible to do

    I think there is still no APP or a way to copy music or videos from Iphone to PC. Pictures can be copied when you access the storage of the iphone from PC. Not sure if you are using other laptop before with itunes where you organize everything about your iphone. If you have, copy the Itunes folder from My Music folder and paste it on the new laptop you have, (you need to install Itunes first on your new laptop before doing this)

  • How to change/set the browser title from web forms (XP platform with SP2)

    I am running Form9i, I have set the browser windows title from Web Forms dynamically by using following method. However, when my PC has changed to XP, the function seems not work. Does anybody have same problem and how to solve it? Any suggestions would be appreciated.
    Add the Javascript code to your baseHTML file. For example,
    if you are using the basejini.htm:
    <HEAD><TITLE>%pageTitle%</TITLE>
    <script language="javascript1.2" type="text/javascript1.2">
    function Change(a) {    document.title=a;    } </script>
    </HEAD>
    In web Forms , call the javascript function with WEB.SHOW_DOCUMENT built.
    For Example the following code set the browser title with username . web.show_document('javascript:Change('||'"'|| get_application_property(USERNAME)||'"'||')','_self');
    Best Regards,
    Bowie

    Dear Frank,
    Thanks for your reply. Can you tell me in detail which built-in function in Webutil can set value in browser title ?
    Btw, is it possible for me to set parameter "separateFrame=True" in formsweb.cfg and set the form window title by using SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,TITLE,v_msg_string)?
    Best Regards,
    Bowie

  • How to get Host name and port inside UDF

    Hi,
    I want to access the Host and port in UDF to pass it to a link http://host:port/AdapterFramework/ChannelAdminServlet?party=&service=&channel=*&action=status dynamically.
    How can I acieve it?
    Manisha

    Hi
    With this code. I am getting error:
    try
    java.net.InetAddress addr = java.net.InetAddress.getLocalHost();
    String host = addr.getCanonicalHostName();
    catch (UnknownHostException e){}
    if (ProcessMode.equals("P"))
    try{
    String xyz="/AdapterFramework/ChannelAdminServlet?party=&service=&channel="Name"&action=stop";
    URL server = new URL("http", host, 8XXX, xyz);
    tring userPassword =Userid + ":" + Password;
       String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
        URLConnection uc=server.openConnection();
        uc.setRequestProperty ("Authorization", "Basic " + encoding);
        BufferedReader br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
         while ((inputLine = br.readLine()) != null)
         output+=inputLine;
        br.close();
    catch (Exception e){}
    ERROR:
    cannot resolve symbol
    symbol : variable host location: class com.sap.xi.tf._MM_CommunicationChannel_Stop
    _ URL server = new URL("http", host, 8xxx, xyz);
    ^ 1 error
    Any other way to get host and port?
    Manisha

  • How to get server data without reading from the socket stream?

    My socket client checks for server messages through
                while (isRunning) { //listen for server events
                    try {
                            Object o = readObject(socket); //wait for server message
                                tellListeners(socket, o);
                    } catch (Exception e) {
                        System.err.println("ERROR SocketClient: "+e);
                        e.printStackTrace();
                    try { sleep(1000); } catch (InterruptedException ie) { /* ignore */ }
                }//next client connectionwith readObject() being
        public Object readObject(Socket socket) throws ClassNotFoundException, IOException {
            Object result = null;
    System.out.println("readObject("+socket+") ...");
            if (socket != null && socket.isConnected()) {
    //            ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
                ObjectInputStream ois = new ObjectInputStream(new DataInputStream(socket.getInputStream()));
                try {
                    result = ois.readObject();
                } finally {
    //                socket.shutdownInput(); //closing of ois also closes socket!
        //            try { ois.close(); } catch (IOException ioe) { /* ignore */ }
            return result;
        }//readObject()Why does ois.readObject() block? I get problems with this as the main while loop (above) calls readObject() as it's the only way to get server messages. But if i want to implement a synchronous call in adition to this asynchronous architecture (call listeners), the readObject() call of the synchronous method comes to late as readObject() call of the main loop got called before and therefore also gets the result of the (later) synchronous call.
    I tried fideling around with some state variables, but that's ugly and probably not thread safe. I'm looking for another solution to check messages from the server without reading data from the stream. is this possible?

    A quick fix:
    - Add a response code at the beginning of each message returned from the server indicating if the message is a synchronous response or a callback (asynch);
    - Read all messages returned from the server in one thread and copy callback messages in a calback message queue and the synch responses in an synch responses queue;
    - Modify your synchronous invocation to retrieve the response from the responses queue instead from the socket. Read the callback messages from the corresponding queue instead from the socket.
    Also take a look at my website. I'm implementing an upgraded version of this idea.
    Catalin Merfu
    High Performance Java Networking
    http://www.accendia.com

  • How to get your pictures and contacts from one device to another

    hey guys I just bought an iphone 5s and I wanted to transfer all my photos and contacts from my old iphone which was a 4s to my 5s. when I tried to do it first time a message appeared on my computer and said that it couldn't transfer anything because the software on my iphone 4s was too old. I updated everything and I tried to restore the backup, but instead of restoring it from my most recent backup it restored it from a backup that happened about a year ago. So i need to know how to restore a backup from my iphone 4s and transfer it to my 5s

    The following has instructions for transferring to a new iPhone via either iCloud or iTunes: Transfer content from an iPhone, iPad, or iPod touch to a new device - Apple Support

  • How to get my Music and videos from my Macbook pro to apple TV

    I have some music and videos from my macbook that i have added to itunes from CD's and DVDs. Whenever i try to play music or movies on my apple TV it says that there is no music in the library. Is this because the items were not bought on itunes and were added from my computer??

    If the music and video is compatible, it should play from Computers.
    The Mac and iTunes must be running, the media files must be accessible on an internal or attached external drive.
    I assume you have enabled Home Sharing.

  • How to get server name and/or IP address from client (10g)?

    Thanks.

    SELECT SYS_CONTEXT( 'USERENV', 'IP_ADDRESS' ) FROM dual;
    SELECT SYS_CONTEXT( 'USERENV', 'HOST' ) FROM dual;assuming you have a two-tier system (i.e. the client is actually making the connection to the database). If you have a three-tiered system, the middle tier would have to pass in this information.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How can I get the username and password from Oracle Forms to PJC !

    Dear Sir,
    I have username,password and push button fields in oracle forms. When user clicks the push button, I need to get username and password field contents to my Pluggable Java Program to authenticate the user trying to login. How can I get those text field contents to my java program..? Looking forward from you soon sir.
    Thanks in Advance,
    S Ramkumar

    I tried that trigger but nothing reflects. I write that method in WHEN_BUTTON_PRESSED trigger.
    In the form module I written,
    Set_Custom_Property('BL.USERNAME',1,'NAME','');
    Set_Custom_Property('BL.PASSWORD',1,'PASS','');
    Implementation class of the push button I gave my java class file name.
    In Java Code I tried register the form fields like,
    public static final ID userName = ID.registerProperty("NAME");
    public static final ID passWord = ID.registerProperty("PASS");
    In Java Code I tried get the contents from registered properties,
    public boolean setProperty(ID property, Object value) {
    if(property == userName) {
    System.out.println("Just I wish to see the name entered" + value.toString());
    if(property == passWord) {
    System.out.println("Just I wish to see the pass entered" + value.toString());
    But even System.out.println() is working.
    What's wrong with this code sir ???
    Can you tell me How to register and get those field values in Java ?

  • How to get server date and time using java code

    Hi,
    I'm new to java. I have one doubt about getting date and time of the server. can anyone give some sample code to get that.
    thanks in regards
    Gopi.

    you need 2 things
    1. something on the application server which exposes the servers time/date
    2. something on the client which makes use of your time service
    for instance, you could write a ServerTimeServlet that clients can call to get the time according to the server. or, if you've got a database in the server, often database software will provide a Time procedure or similar that does this, so you can use a simple SQL query to get the latest time

Maybe you are looking for

  • Unable to have field in selection screen of Infopackage

    Hello Gurus, I have a small problem, I am unable to bring on field in selection screen in Infopackage, even thou the object is ticket in DataSources selection option, I have noted that the object is of type DEC is it something to do with, Or is their

  • PCI Implementation

    Hi, Can u please guide me the how to setup Payment Card Industry.What are the security products are required and how to implement those products . Waiting for your reply. Regards Sivaji.P

  • ITunes Library errors

    I have two macs. My iTunes library is on an external hard drive so I can move it between macs. I hooked it up to my second mac and imported my songs to the iTunes on that computer. Then when I went back toi the first some of my compilation songs had

  • I want to correct only part of my image. What tools do I use?

    CORRECTING PART OF YOUR PHOTO – USING SELECTIONS When you want to modify or adjust a specific area of a photo or image, you need to make a selection first. Once an area is selected you can use Photoshop image adjustment tools. This video covers  the

  • An Error Occurred - Photos on Front Row

    Hi, I really hope someone can help me.... Whenever I try to show photos on Front Row, the message comes up "an error occurred" Press play/pause to exit front row. I think I must have some corruption in my iPhoto library so I have tried the following: