How to get running application host and port?

How can I get the host name and the port number of the currently running application?
http://<host>:port/<context root>/faces/<page>
Thanks,
Mitesh.

FacesContext.getCurrentInstance().getExternalContext().getRequest().getRemoteHost()
FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath()
FacesContext fctx = FacesContext.getCurrentInstance();
HttpServletRequest rq = (HttpServletRequest)fctx.getExternalContext().getRequest();
rq.getServerPort()

Similar Messages

  • SDK : how to get the server adress and port ?

    Almost everything is in the title, I'm look for code to get the server URL and port where the ME is running ;o)
    There should be some standard API I guess.
    Thanks
    Regards

    Hi,
    In the code that I write I usually have access to the HTTP Request Object.
    String serverName = request.getServerName();
    String serverPort = request.getServerPort();
    Then I just do a compare on the returned value to see if I am on our Test or Production server.
    if(request.getServerName().indexOf("prodservername") >= 0)
      // PRODUCTION CODE HERE
    else
      // TEST CODE HERE
    Hope this helps,
    Mike

  • HTTP Proxy: My grogram runs even I put a wrong proxy host and port

    I'm new to network programming, so I just use System.setProperty() for easy. But I don't know why this piece of code runs with whatever proxy I set:
    (I download a file and display in a in JTextArea, this is the ActionListener for 'Download' button)
         private class GetFileListener implements ActionListener
              public void actionPerformed(ActionEvent event)
                   if (completeRadioButton.isSelected())
                       try
                            viewFileTextArea.setText("");
                        System.setProperty("http.proxyHost", "http://123.123.123.123");
                        System.setProperty("http.proxyPort", "123");
                        System.setProperty("proxySet", "true");
                           URL url = new URL(completeURLTextField.getText());
                           BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                           String str;
                           while ((str = in.readLine()) != null)
                               viewFileTextArea.append(str + "\n");
                           in.close();
                       catch (MalformedURLException e)
                            viewFileTextArea.setText("URL not found!");
                       catch (IOException e)
         }Please help! Thank you very much!

    This is the new version:
         private class GetFileListener implements ActionListener
              public void actionPerformed(ActionEvent event)
                   if (completeRadioButton.isSelected())
                       try
                            viewFileTextArea.setText("");
                        SocketAddress addr = new InetSocketAddress("123.123.123.123", 123);
                        Proxy proxy = new Proxy(Proxy.Type.HTTP, addr);
                        URL url = new URL(completeURLTextField.getText());
                        URLConnection conn = url.openConnection(proxy);
                           BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                           String str;
                           while ((str = in.readLine()) != null)
                               viewFileTextArea.append(str + "\n");
                           in.close();
                       catch (MalformedURLException e)
                            viewFileTextArea.setText("URL not found!");
                       catch (IOException e)
         }but it still runs regardless of what proxy host and port I set in InetSocketAddress. Did I wrongly use Proxy class in the code above?

  • How to get web application to use Tuscany without conflicting with SAP SDO

    Hi,
    We are attempting to run a web application on SAP NetWeaver CE 7.1 SP1 which uses Tuscany SDO.  As it now stands We must use Tuscany because the web application will not run with the SAP SDO implementation provided by Netweaver. To ensure that Tuscany is loaded with priority, we have packaged the Tuscany JAR files and their dependencies as a heavy resource, as described here:
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60642a88-95fe-2b10-d387-a245d48fc257?overridelayout=true
    The final check showed that Tuscany was correctly deployed as a heavy resource and included the following JAR files:
    common-2.2.3.jar
    ecore-2.2.3.jar
    ecore-change-2.2.3.jar
    ecore-xmi-2.2.3.jar
    tuscany-sdo-impl-1.1.1.jar
    tuscany-sdo-lib-1.1.1.jar
    tuscany-sdo-tools-1.1.1.jar
    xsd-2.2.3.jar
    We also verified that the web application using Tuscany has a hard reference to the Tuscany heavy resource.
    However, when we try to run the web application, the following error is logged:  java.lang.LinkageError: Class commonj/sdo/DataGraph violates loader constraints
    The issue is definitely due to some kind of classloading conflict with the SAP SDO library, as the application runs normally when SAP SDO is manually removed from the classpath. Doing this on a production system is unfortunately not an option, though.
    So the question is: how to get web application to use Tuscany without conflicting with SAP SDO?

    I took a look at the "printerReady" example.  Looks like I may be able to use the InetPing (...) function to ping through a range of IP addresses looking for a response.
    Any ideas on how to find the MAC address associated with the IP addresses that respond?
    We may have multiple units responding and the MAC address will allow the operator to determing which unit to connect to.
    I'll try the InetPing to see how it works,
    Kirk

  • I've got OSX/Genieo.A virus on my mac and don't know how to get rid of it and why I have it

    I've got OSX/Genieo.A virus on my mac and don't know how to get rid of it and w I have it

    There is no need to download anything to solve this problem.
    You installed the "Genieo" malware. The product is a fraud, and the developer knowingly distributes an uninstaller that doesn't work. I suggest the procedure below to disable Genieo. This procedure may leave a few small files behind, but it will permanently deactivate the malware (as long as you never reinstall it.)
    Malware is always changing to get around the defenses against it. These instructions are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
    Back up all data before proceeding.
    Step 1
    Triple-click anywhere in the line below on this page to select it:
    /Library/Frameworks/GenieoExtra.framework
    Right-click or control-click the line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.
    If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.
    A folder should open with an item named "GenieoExtra.framework" selected. Move that item to the Trash. You'll be prompted for your administrator password.
    Move each of these items to the Trash in the same way:
    /Applications/Genieo.app
    /Applications/Reset Search.app
    /Applications/Uninstall Genieo.app
    /Library/LaunchAgents/com.genieo.completer.update.plist
    /Library/LaunchAgents/com.genieo.engine.plist
    /Library/LaunchAgents/com.genieoinnovation.macextension.plist
    /Library/LaunchDaemons/com.genieoinnovation.macextension.client.plist
    /Library/PrivilegedHelperTools/com.genieoinnovation.macextension.client
    /usr/lib/libgenkit.dylib
    /usr/lib/libgenkitsa.dylib
    /usr/lib/libimckit.dylib
    /usr/lib/libimckitsa.dylib
    ~/Library/Application Support/com.genieoinnovation.Installer
    ~/Library/LaunchAgents/com.genieo.completer.download.plist
    ~/Library/LaunchAgents/com.genieo.completer.update.plist
    If there are other items with a name that includes "Genieo" or "genieo" alongside any of those listed above, move them as well. Some of these items will be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
    Restart and empty the Trash. Don't try to empty the Trash until you have restarted.
    Step 2
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Uninstall any extensions you don't know you need, including ones called "Genieo" or "Omnibar," and any that have the word "Spigot" or "InstallMac" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
    Your web browser(s) should now be working, and you should be able to reset the home page and search engine. If not, stop here and post your results.
    Make sure you don't repeat the mistake that led you to install this trojan. Chances are you got it from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad has a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If youever download a file that isn't obviously what you expected, delete it immediately.
    You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that this Internet criminal has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing, has not done so, even though it's aware of the problem. This failure of oversight has compromised both Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
    Finally, be forewarned that when Genieo is mentioned on this site, the attacker sometimes shows up under the name "Genieo support." He will tell you to run a fake "uninstaller." As he intends, the uninstaller does not completely remove the malware, and is in fact malware itself.

  • Host and Port

    Hi
    WHere can I get the Host and Port no of the PI Server
    Thanks
    PR

    Hi,
    In addition to above, Just FYI that in PI 7.1 the Http and J2ee port are same..
    The discussion about same can be found [here|Re: Architecture of PI 7.1] and [here|Re: ABAP & Java ports in PI 7.1?]
    and to check all the info @ single place:
    Login to XI ABAP stack -> Run tcode SXMB_IFR -> Choose Option Administration -> Properties Administration ->All properties
    Sachin
    Edited by: Sachin Dhingra on Apr 2, 2009 10:01 AM

  • Error establishing socket to host and port: EPM11:1433

    Hi Planning Experts,
    I am trying to configure EPM 11.1.2.1 (Planning)
    RDBMS: SQL server 2005 (Express Edition)
    OS: 2008 R2 x64
    i am getting error after providing RDBMS credentials "error establishing socket to host and port: EPM11:1433 Reson: connection refused: connect"
    Please help....
    Regards
    Kumar

    You may need to enable tcp/ip
    SQL Server Express listens on local named pipes and shared memory. With a default installation, you cannot remotely connect to SQL Server Express. You will need to enable TCP/IP and check if the firewall is enabled.
    To enable TCP/IP:
    From the Start menu, choose All Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Configuration Manager.
    Optionally, you can open Computer Manager by right-clicking My Computer and choosing Manage. In Computer Management, expand Services and Applications, expand SQL Server Configuration Manager.
    Expand SQL Server 2005 Network Configuration, and then click Protocols for InstanceName.
    In the list of protocols, right-click the protocol you want to enable, and then click Enable.
    The icon for the protocol will change to show that the protocol is enabled.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Determining Message Server Host and Port information

    Hi,
    I am working on the NWDS creating a Java WD application and I was told which Netweaver system I should work on but I was not told the Message Server Host  information neither the Port information. I ran transaction SM51 (right click->details)in the Netweaver system but the information it is not working. Even though I can telnet this server port if I go to the J2EE Engine window within the NWDS I do not see the green light. I just see "N/A". I also tried to deploy my application but I keep getting this message: "Cannot determine sdm host (is empty). Please configure your engine/sdm correctly".
    Please advice,
    Diego.

    Hi Diego,
    in order to see Message Server Host information and Port information go to SAP J2EE Engine start page: e.g. http://system-name:57100/index.html (use administrator pws).
    Then click on System Information, here on the top you can read the Message Server Host and Port.
    Hope this help you.
    Bye,
    Vito

  • How can I run applications in full screen on my MacBook Pro?

    I recently started using an external HP w1858 monitor as a secondary display with my MacBook Pro. I'm having troubles with running applications in full screen mode on the secondary display. How can I run applications in full screen mode on the secondary monitor?

    If you always have the external display connected, you can configure the OS to consider it as the default or main display. Once everything is connected and set to your liking (resolution, color depth, etc.), "bless" the external display by clicking & dragging the menubar from the Mac's internal display onto the external. This only works if you are not using video mirroring.
    Once this is done, applications will open by default on the external and now "main" display and you can configure them to go fullscreen or whatever.

  • HT2474 when I am opening any application including safari, these icons are not showing in dock, how to get open applications in my dock?

    when I am opening any application including safari, these icons are not showing in dock, how to get open applications in my dock?

    This could be a plist corruption problem, but I'm not sure.
    Sometimes, the preference list files get corrupted. You can usually just remove them and they'll get re-created. This may require you to reset certain settings. A notable exception to this is the Mail plist which actually stores the Library structure of your email accounts. Deleting the Mail plist will definitely cause lots of problems, but is recoverable.
    The plist files are stored in the /Users/username/Library/Preferences/ folder. They usually have the naming convention of com.company.programname.plist.
    A simple troubleshooting technique is to move a suspect plist file out of the Preferences folder and start up the app, again. It will re-create the plist from scratch.
    In your case, I would try the com.apple.dock.plist. You can use Activity Monitor to kill the Dock app and it will restart. Or, you can log out and log back in.
    There is a new file with Leopard called com.apple.dock.db. I haven't figured out what it does, but you might try moving it out. If anything gets worse, you can move the old file back in replacing the newly created one.
    This all sound somewhat odd, so I don't know if this will help.

  • Hi can anyone help me how to get facetime application for iphone 4s

    Hi
    can anyone help me how to get facetime application for iphone 4s since i am not able to find it.

    FaceTime is builtin, there's no icon. Use your Contacts app and if the recipient has iPhone 4/4S, iPod Touch 4th G, iPad 2 or Mac, you can FaceTime them using Wi-Fi.
    Message was edited by: ckuan

  • How to get the kerning value and set it to back use script?

    hi,guys
    I come back again.
    I encountered a kerning problem.
    how to get the kerning value and set it to back use script?
    Thanks very much!

    For both cases, the filename can be found on the FILE.ReceivedFileName Context Property.  You can access this Property in a Pipeline Component or Orchestration and take any action you want, such as apply to a database.
    The value is accessed by: MyReceivedMessage(FILE.ReceivedFileName)
    In the case of a duplicate EDI Interchange, you would use the Failed Message Routing feature to capture the error message with either an Orchestration or Send Port.

  • How to get running Daqmx task handles

    HI,
    We are creating a TestStand module using CVI 8.5, in that module we have to close all the running Daqmx tasks, please provide help on how to get running Daqmx task handles. We could not find any API function which can return list of running Daqmx task handles so that we can close one by one.
    Thanks in advance for the help

    I just had a similar issue.  Stumbled on this forum in the hopes of getting an answer and found no reply to the original message.  I think this is what we are both looking for DAQmxGetSysTasks.  
    I havent used it yet.  Still in the excited I found something stage.

  • Find host and port

    My J2EE application has an EJB module and web module. I need to call the servlet in the web module from EJB module, via HTTPUrl connection. To make the web application portable and not-hardcoded, is there any way for EJB module to find out programatically the host and port number of where my J2EE application is deployed?

    Hi,
    I don't know weather it helps you or if you need the information now:
    I have a "half" solution for it: With the instance-number you can calculate all standard(!)-ports. I saw this calculating-ports-stuff in a word-doc.
    //HTTP-Port = 50000InstanceNumber*1000
    String InstanceNumber = java.lang.System.getProperty("SAPSYSTEM");
    int temp = 50000 + Integer.valueOf(InstanceNumber).intValue() * 100;
    String port = String.valueOf(temp);
    For the IP...maybe you can use "localhost"? But my problem with this solution is: I don't know weather the standard ports can be changed manually. When yes: this solution can have a problem...
    regards,
    Remo

  • Does anyone know how to get an application you had once without using App Store?

    Does anyone know how to get an application you had once without using App Store?
    Because I'm underage and I couldn't get it back.
    I just want it back, I'm not going to use any money in App Store...

    When you say you "had it once", how did you get it then?  The App Store has only been around for a few years, so there are lots of apps out there that you would once get from the developer, but now they're only available on the App store.  Which app(s) are you referring to? 

Maybe you are looking for

  • DELETE TABLE STATEMENT WITHIN A LOOP IN A PROCEDURE

    i am using delete table tablename statement inside a cursor for loop which is inside a procedure it is telling error in that delete statement can't i put it inside the loop

  • Any problem with AMD Radeon or FirePro graphic cards?

    Hi. I know that Adobe recommend Nvidia cards for SpeedGrade, but I ask to owners of AMD cards if they have found any problems with AMD cards: bad performance, not realtime with relatively few layers, etc, etc Which is your experience? Thanks.

  • PLEASE HELP 64bit Photoshop CS4 no open GL

    Looked online for solutions for a good 3 hours and still cant fix the problem I have 2 ATI HD 4800 video cards and the thing is that if I run regular PS i have open GL it sees my cards just fine but when I run the default 64 bit its not even recogniz

  • Descargue el itunes pero cuando intento abrirlo en mi pc no lo ejecuta?

    descargue el itunes pero cuando intento abrirlo en mi pc no lo ejecuta?

  • IMac i7 sleep problems

    So I've been pretty happy with my iMac i7 so far but in the last few days, I've been having some issues with the sleep function. I first noticed an issue where I couldn't wake my iMac back up from sleep. The screen wouldn't turn on after pressing a b