How to get the client's IP address from within Java Studio Creator JSP/Java

Hi there.
I just started using the Java Studio Creator 2 and now I need to get hold of the client IP address - this should be part of the request, but I cannot fint the right way to get hold of that information. I want to be able to access this information from within the Java-code in a JSP/JSPF-page.
Is there a new way of doing:
request.getRemoteAddr();
This is the way I remember it from the JSP/Servlet-days...
Sincerely,
- Oystein Saebo -

javax.servlet.http.HttpServletRequest req = (javax.servlet.http.HttpServletRequest) getExternalContext().getRequest();
req.getRemoteAddr();

Similar Messages

  • How to get the remote user IP address if behind the proxy or firewall

    Hi
    How do i get the remote user Ip address who is invoking the servlet behind from a firewall.
    When i use getRemoteHostAddr it gives the proxy ip address not the actuall user host address... Kindly let me know how to get the actual user ip address
    satish

    There is no reliable way to determine the original IP, and such information is not useful to you if the original IP is behind a firewall. What do you propose to use it for? There is probably an alternative way to do things that does not require the remote IP.

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

  • How to get the current path of my application in java ?

    how to get the current path of my application in java ?
    thanks

    To get the path where your application has been installed you have to do the following:
    have a class called "what_ever" in the folder.
    then you do a litte:
    String path=
    what_ever.class.getRessource("what_ever.class").toString()
    That get you a string like:
    file:/C:/Program Files/Cool_program/what_ever.class
    Then you process the result a little to remove anything you don't want:
    path=path.substring(path.indexOf('/')+1),path.lastIndexOf('/'))
    //Might be a little error here but you should find out //quickly if it's the case
    And here you go, you have a nice
    C:/Program Files/Cool_program
    which is the path to your application.
    Hooray

  • How to get the current logged in username from windows and put it into an AS var

    Hello,
    I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.
    Thanks in advance
    Michael

    Just for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.
    In the html page that publishes with the .swf file under the <head> section:-
    <script language="JavaScript" type="text/javascript">
    function findUserName() {
         var wshell=new ActiveXObject ("wscript.shell");
         var username=wshell.ExpandEnvironmentStrings("%username%");
         return username;
    </script>
    The ActionScript:-
    import flash.external.ExternalInterface;
    var username:String = ExternalInterface.call ("findUserName");
    trace (username); // a quick test to see it in output

  • How to get the information like IP address,Host name of connected clients v

    Hi Every one,
    I want to get the information like (IP Address,Hostname,Active sessions , Database Server….etc) of the connected clients
    via V$Views(ORACLE).
    And then I like to load these infromation into a table “Client_Table”.
    Could some one give me suggestion that which V$ views/method I use in order to get the above information and then
    how to load these information into a table “Client_table”?
    Your suggestions will be highly appreciated.
    With Regards
    BILAL

    You could use a LOGON TRIGGER so every session insert its own environment into your client_info table.
    You could use the following view and choose whatever attribute you need:
    create or replace view my_userenv (
    AUDITED_CURSORID ,
    AUTHENTICATION_DATA ,
    AUTHENTICATION_TYPE ,
    BG_JOB_ID ,
    CLIENT_IDENTIFIER ,
    CLIENT_INFO ,
    CURRENT_SCHEMA ,
    CURRENT_SCHEMAID ,
    CURRENT_SQL ,
    CURRENT_USER ,
    CURRENT_USERID ,
    DB_DOMAIN ,
    DB_NAME ,
    ENTRYID ,
    EXTERNAL_NAME ,
    FG_JOB_ID ,
    GLOBAL_CONTEXT_MEMORY ,
    HOST ,
    INSTANCE ,
    IP_ADDRESS ,
    ISDBA ,
    LANG ,
    LANGUAGE ,
    NETWORK_PROTOCOL ,
    NLS_CALENDAR ,
    NLS_CURRENCY ,
    NLS_DATE_FORMAT ,
    NLS_DATE_LANGUAGE ,
    NLS_SORT ,
    NLS_TERRITORY ,
    OS_USER ,
    PROXY_USER ,
    PROXY_USERID ,
    SESSION_USER ,
    SESSION_USERID ,
    SESSIONID ,
    TERMINAL
    ) AS SELECT
    SYS_CONTEXT ('USERENV', 'AUDITED_CURSORID') ,
    SYS_CONTEXT ('USERENV', 'AUTHENTICATION_DATA') ,
    SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE') ,
    SYS_CONTEXT ('USERENV', 'BG_JOB_ID') ,
    SYS_CONTEXT ('USERENV', 'CLIENT_IDENTIFIER') ,
    SYS_CONTEXT ('USERENV', 'CLIENT_INFO') ,
    SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA') ,
    SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMAID') ,
    SYS_CONTEXT ('USERENV', 'CURRENT_SQL') ,
    SYS_CONTEXT ('USERENV', 'CURRENT_USER') ,
    SYS_CONTEXT ('USERENV', 'CURRENT_USERID') ,
    SYS_CONTEXT ('USERENV', 'DB_DOMAIN') ,
    SYS_CONTEXT ('USERENV', 'DB_NAME') ,
    SYS_CONTEXT ('USERENV', 'ENTRYID') ,
    SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME') ,
    SYS_CONTEXT ('USERENV', 'FG_JOB_ID') ,
    SYS_CONTEXT ('USERENV', 'GLOBAL_CONTEXT_MEMORY') ,
    SYS_CONTEXT ('USERENV', 'HOST') ,
    SYS_CONTEXT ('USERENV', 'INSTANCE') ,
    SYS_CONTEXT ('USERENV', 'IP_ADDRESS') ,
    SYS_CONTEXT ('USERENV', 'ISDBA') ,
    SYS_CONTEXT ('USERENV', 'LANG') ,
    SYS_CONTEXT ('USERENV', 'LANGUAGE') ,
    SYS_CONTEXT ('USERENV', 'NETWORK_PROTOCOL') ,
    SYS_CONTEXT ('USERENV', 'NLS_CALENDAR') ,
    SYS_CONTEXT ('USERENV', 'NLS_CURRENCY') ,
    SYS_CONTEXT ('USERENV', 'NLS_DATE_FORMAT') ,
    SYS_CONTEXT ('USERENV', 'NLS_DATE_LANGUAGE') ,
    SYS_CONTEXT ('USERENV', 'NLS_SORT') ,
    SYS_CONTEXT ('USERENV', 'NLS_TERRITORY') ,
    SYS_CONTEXT ('USERENV', 'OS_USER') ,
    SYS_CONTEXT ('USERENV', 'PROXY_USER') ,
    SYS_CONTEXT ('USERENV', 'PROXY_USERID') ,
    SYS_CONTEXT ('USERENV', 'SESSION_USER') ,
    SYS_CONTEXT ('USERENV', 'SESSION_USERID') ,
    SYS_CONTEXT ('USERENV', 'SESSIONID') ,
    SYS_CONTEXT ('USERENV', 'TERMINAL')
    from dual;

  • GSS-API How to get the client-to-service ticket

    In Kerberos when requesting services, the client sends the following two messages to the TGS: A composed message of the Ticket-Granting Ticket and the ID of the requested serviceand authenticator (which is composed of the client ID and the timestamp), all encrypted using the client/TGS session key.
    Then upon receiving these messages the TGS sends the followings to the client:
    A: Client-to-server ticket (which includes the client ID, client network address, validity period and Client/server session key) encrypted using the service's secret key.
    B: Client/server session key encrypted with the client/TGS session key.
    Now I'm wondering how to obtain A and B throught the kerberos login in GSS-API . I have the following code that I use to request a kerberized service but it returns only a KerberosTicket in PrivateCredentialsSet for the Subject. A sessionKey can also be obtained form this KerberosTicket ! Which session key is this ? the session key B described above? and Where to get the Client-to-server ticket (A) described above ?
    Thanks for any help !
    Alex
    lc = new LoginContext("login-client", new TextCallbackHandler());
    lc.login();
    mysubject = lc.getSubject();
    java.util.Set principals = lc.getSubject().getPrincipals();
    java.util.Iterator iterador = principals.iterator();
    if (iterador.hasNext()){
    KerberosPrincipal principal = (KerberosPrincipal) iterador.next();
    clientName =principal.getName();
    PrivilegedAction generateServiceTicket = new ClientAction(clientName,"[email protected]");
    Subject.doAs(mysubject, generateServiceTicket);
    Set prvCredentials = lc.getSubject().getPrivateCredentials();
    for (Iterator i = prvCredentials.iterator(); i.hasNext(); j++) {
    KerberosTicket ticket = (KerberosTicket) i.next();
    prvKrbCrds = (KerberosTicket[]) mysubject.getPrivateCredentials().toArray(new KerberosTicket[0]);
    public Object run() {
    try{
    GSSManager manager = GSSManager.getInstance();
    Oid krb5Mechanism = new Oid("1.2.840.113554.1.2.2");
    Oid krb5PrincipalNameType = new Oid("1.2.840.113554.1.2.2.1");
    GSSName userName = manager.createName(pn,GSSName.NT_USER_NAME);
    GSSCredential cred = manager.createCredential(usr,
    GSSCredential.DEFAULT_LIFETIME,
    krb5Mechanism,
    GSSCredential.INITIATE_ONLY);
    GSSName peerName = manager.createName(servicename,
    GSSName.NT_HOSTBASED_SERVICE, krb5Mechanism);
    GSSContext setContext = manager.createContext(peerName, krb5Mechanism, cred,
    GSSContext.DEFAULT_LIFETIME);
    setContext.requestInteg(false);
    setContext.requestConf(false);
    byte[] inputBuf = new byte[0];
    byte[] tkt = setContext.initSecContext(inputBuf, 0, 0);
    }catch(GSSException gsse){
    gsse.printStackTrace();
    }

    In Kerberos when requesting services, the client sends the following two messages to the TGS: A composed message of the Ticket-Granting Ticket and the ID of the requested serviceand authenticator (which is composed of the client ID and the timestamp), all encrypted using the client/TGS session key.
    Then upon receiving these messages the TGS sends the followings to the client:
    A: Client-to-server ticket (which includes the client ID, client network address, validity period and Client/server session key) encrypted using the service's secret key.
    B: Client/server session key encrypted with the client/TGS session key.
    Now I'm wondering how to obtain A and B throught the kerberos login in GSS-API . I have the following code that I use to request a kerberized service but it returns only a KerberosTicket in PrivateCredentialsSet for the Subject. A sessionKey can also be obtained form this KerberosTicket ! Which session key is this ? the session key B described above? and Where to get the Client-to-server ticket (A) described above ?
    Thanks for any help !
    Alex
    lc = new LoginContext("login-client", new TextCallbackHandler());
    lc.login();
    mysubject = lc.getSubject();
    java.util.Set principals = lc.getSubject().getPrincipals();
    java.util.Iterator iterador = principals.iterator();
    if (iterador.hasNext()){
    KerberosPrincipal principal = (KerberosPrincipal) iterador.next();
    clientName =principal.getName();
    PrivilegedAction generateServiceTicket = new ClientAction(clientName,"[email protected]");
    Subject.doAs(mysubject, generateServiceTicket);
    Set prvCredentials = lc.getSubject().getPrivateCredentials();
    for (Iterator i = prvCredentials.iterator(); i.hasNext(); j++) {
    KerberosTicket ticket = (KerberosTicket) i.next();
    prvKrbCrds = (KerberosTicket[]) mysubject.getPrivateCredentials().toArray(new KerberosTicket[0]);
    public Object run() {
    try{
    GSSManager manager = GSSManager.getInstance();
    Oid krb5Mechanism = new Oid("1.2.840.113554.1.2.2");
    Oid krb5PrincipalNameType = new Oid("1.2.840.113554.1.2.2.1");
    GSSName userName = manager.createName(pn,GSSName.NT_USER_NAME);
    GSSCredential cred = manager.createCredential(usr,
    GSSCredential.DEFAULT_LIFETIME,
    krb5Mechanism,
    GSSCredential.INITIATE_ONLY);
    GSSName peerName = manager.createName(servicename,
    GSSName.NT_HOSTBASED_SERVICE, krb5Mechanism);
    GSSContext setContext = manager.createContext(peerName, krb5Mechanism, cred,
    GSSContext.DEFAULT_LIFETIME);
    setContext.requestInteg(false);
    setContext.requestConf(false);
    byte[] inputBuf = new byte[0];
    byte[] tkt = setContext.initSecContext(inputBuf, 0, 0);
    }catch(GSSException gsse){
    gsse.printStackTrace();
    }

  • How to get the client date and time ?

    Dear Sirs...
    Using jdeveloper 10.1.2.0
    How can i get the client date and time using the HttpServletRequest ?
    thanks for any help in advance
    best regards

    If your code is running on the client pc you can just create a new instance of the java.util.Date class. That class automatically defaults to the current time of the client machine. Otherwise if you're running the code on the server, you could insert/post the client date/time by adding its string representation as a parameter to the HTTP request object.
    Ronald

  • How to get the client identity from the certificate at server side

    hi, this is ravi kiran,
    I am working on a project which requires, receiving a signed file from the client side and verify whether the file is signed by a valid certificate that is there in the servers keystore.
    How can i get the client certificate at server side and check with the certificates already present in the servers keystore.
    i have no idea how to do this
    can any one help me
    thanx in advance

    Hi Ravi, did you get any answer to your question ?
    I'm also after a similar problem, please share your solution, if you have any.

  • How to get the CLIENT OS USER NAME using Apex

    Dear All,
    I know there are many other posts (some of them are very old) discuss about this issue. But unfortunately most of the posts endup with NO PROPER ANSWER. But still I believe that tehre has to be some way to do this. So this is my requirement.
    I am using custom authentication module and I want to get the CLIENT MACHINE OS USER NAME for that. But I do not want to do any authentication against the client user domain.
    How can I get this?
    * There are some other way to get this using VB Scripts. But thats not a real solution for this due to followings
    01. User has to manually allow to run VB scripts. So if user dissable that then we canot get the required info
    02. Its working only with specific browsers(Mainly in IE and also we can get that thing work after installing plugins to Firefox.). So this is also depends with the bvrowser and plugings.
    What I want to do is to get this info using a common way which is not depends with the browser or any thirdparty plugins.
    Thanks,
    Alex

    Its good that you did some searching in the forums before you posted the question.
    Most modern browsers would consider what you require as a security/privacy issue and prevents such information from being transmitted available(easily). IE might let you pull out this using a VB script or activex control. Browser specific addons/extension could work but they need some kind of installation to start with. Java could be a way to do it with all browsers, but the end user still has to grant access before it can do any such thing.
    Lets say you were able to pull out such information from an end user, what would be next, get his mail id from outlook ? , access his browsing history, steal credit card information or read cookies?
    Add to that , what if the end user accesses it using any other OS(linux,macintosh or even a smartphone) ? what about windows vista and windows 7 OS's , are you going to write code to handle all those cases too ?
    Here's a blog posting which explains using NTLM authentication with Apex(it still needs configuration from the end user)
    What I want to do is to get this info using a common way which is not depends with the browser or any thirdparty plugins.I guess if this is the question, then the answer would have to be no. I don't think you will be able to find a method that passes this information from the client side without any modification/configuration at their side

  • How to get the List of IP Address, of Computers accessible from a Computer

    I just want to get the list og IP Address of systems in the network whic uses a server.
    OR How do I connect to a computer in a network using username and password.

    try asking this question on the networking forum:
    http://forum.java.sun.com/forum.jspa?forumID=536

  • How to get the Dynamic UI component value from JSFF page to any managedbean

    HI ,
    We have list of bean objects in jSF page we are iterating the list of bean using the forEach loop and displaying the value into Input type text (UI component) value filed .
    If we try to get the UI component value in Managed bean we are not getting the dynamic values .
    The below piece of code used to retrieve the dynamic values from the JSF page doesn't have any form :
    UIComponent component = null;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext != null) {
    UIComponent root = facesContext.getViewRoot();
    component = findComponent(root, componentId);
    then component type casting to the based on UI component which we trying to access and getting the value as " NULL " ..Please let me know how to get the dynamic values form the JSF ?
    Please let me know if any other approach or any changes required on above ?
    Thanks

    Hi,
    the root problem is this
    <h:inputText id="it3" value="#{familyList.ctn}" />
    <tr:commandButton text="Save" id="cb3"Note how each row writes to the same managed bean property, thus showing the same data. Instead your managed bean should expose a HashMap property that you then apply values to using a key/value pair. The key could be the ID of the field, which then you also should dynamically define e.g. cb<rowIndx>. The command button could then have a f:attribute assigned that has the row HahMap key as a value. This way you truly create value instances for the object
    Frank

  • How to get the number of community members from outside the community

    Hi everyone.
    I need to know if there is any way to get the number of community members from outside the community, I mean, not using the "What's happening" webpart. I want to build up a page with a Webpart that summarize my three most visited communities indicating
    number of members, three last messages in the newsfeed, and number of posts in blog, wikis, document libraries, etc.
    Do I need statistics to get this kind of information? Should I use Sharepoint Object model instead?
    Here is an example of what I need:
    - Community name
    - Number of members
    - Community activity (messages, docs uploaded to library, etc)
    - Number of posts in calendar, blog, wiki that belongs to community
    Thank you all!

    Hi Thuan.
    Thanks for your answer but it does not help me because these communities are Sharepoint Communities not external sites so I need to get that information using SP object model and BCS in this case is useless.
    EDIT
    I found the solution using the search objects but I was only able to get members, discussions and replies
    using (ClientContext clientContext = new ClientContext("URL_OF_ENTERPRISE_SEARCH_CENTER"))
    KeywordQuery keywordQuery = new KeywordQuery(clientContext);
    keywordQuery.QueryText = "The_Name_of_the_Community WebTemplate:COMMUNITY";
    SearchExecutor searchExecutor = new SearchExecutor(clientContext);
    ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery(keywordQuery);
    clientContext.ExecuteQuery();
    System.Collections.Generic.IDictionary<string, object> ret = null;
    foreach (System.Collections.Generic.Dictionary<string, object> resultRow in results.Value[0].ResultRows)
    Console.WriteLine("{0}: {1} ({2})", resultRow["CommunityMembersCount"], resultRow["CommunityTopicsCount"], resultRow["CommunitiyRepliesCount"]);
    This is a Console Application.
    I hope someone helps

  • How to get the numeric value of DocTotal from UI API

    When I hit the ADD button I need to get the DocTotal from the UI API !
    All I have is the EditText which gives it in string and the problem is to double.Parse it
    it's a pain to do it while there is CultureInfo related issue with it.
    So It would be wise to get the numeric value directly from the UI API instead of getting the DocTotal by string and trying to convert it.  So is there any way to get the numrci value of DocTotal from UI API ?

    Hello Marc,
    Here is a function which considering the Culture Info and always working. You can speed it up by using extending admininfo to global vairables, and loading the values at startup of the addon.
    Use the oEditText.value.ToString() to convert into into the doulbe number:
    Public Function _string2double(ByVal s As String) As Double
            Dim d As Double
    ' This part is fast, when regional settings equal to sap B1 settings:
            Try
                d = Convert.ToDouble(s)
                d = Math.Round(d, 6)
                Return d
            Catch
            End Try
    ' Speed up performance: extend CompaneService variables to global variables and query them at addon startup.
            Try
                Dim nfi As System.Globalization.NumberFormatInfo = System.Globalization.CultureInfo.CurrentCulture.NumberFormat
                Dim oCompanyService As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()
                Dim oAdminInfo As SAPbobsCOM.AdminInfo = oCompanyService.GetAdminInfo()
                Dim sbodsep As String = oAdminInfo.DecimalSeparator
                Dim sbotsep As String = oAdminInfo.ThousandsSeparator
                If s.IndexOf(Space(1)) > 0 Then
                    If oAdminInfo.DisplayCurrencyontheRight = BoYesNoEnum.tYES Then
                        s = s.Substring(0, s.IndexOf(Space(1)))
                    Else
                        s = s.Substring(s.IndexOf(Space(1)), s.Length - s.IndexOf(Space(1)))
                    End If
                End If
                Dim s1 As String = s.Replace(sbotsep, nfi.NumberGroupSeparator)
                s1 = s1.Replace(sbodsep, nfi.NumberDecimalSeparator)
                d = Convert.ToDouble(s)
                d = Math.Round(d, 6)
                Return d
            Catch
                Return 0
            End Try
        End Function
    Regards,
    J.
    Edited by: János Nagy on Oct 7, 2009 8:55 AM

  • Pls help : How to get the client ip address in EJB

    Hi experts,
    I need to find the ip addr of the client which makes the remote call.
    I tried using
    java.rmi.server.RemoteServer.getClientHost()
    But it throws ServerNotActiveException .
    When I tried this in RMI it works fine perfectly.
    If i am right EJB is just similar to RME and it should work in it too..
    Can you please help me in finding out the ip address of the client which makes the ejb call.
    Thanks & Regards,
    Mukunt

    Hi Mukunt,
    There is no portable way to do this in the Remote EJB programming model. The bean class
    is written in a way that is agnostic to those kind of plumbing-related details of the caller.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • F4 help for the Date field in Module-Pool program

    Hi, I have a requirement wherein the user shud be allowed to choose a date on the calendar using F4 help and after choosing, it shud get displayed as dd.mm.yyyy format in the field. Is there any functional module to implement this. Thanks in Advance,

  • Applet comunicate with JSP

    how can an applet send variables to a JSP??

  • SSD Drive in Macbook Pro for Live PA

    Hi all Just wondered if there are any people on here who have experience with a SSD Drive in their Macbook Pro using it in Live PA situations? I'm trying to make it shock/vibration resistant (well as far as possible) and reduce heat. There are some r

  • Are .mp4 files not supported when trying to merge 2 videos into 1 video?

    Are .mp4 files not supported when trying to merge 2 videos into 1 video? The steps in the manual seem simple enough.  But the paste function won't work on the 1st video after selecting all and then copy on the 2nd video.

  • ATTN Java Gurus: udf.policy - Unable to Grant Read,Write to Specific File

    NOTE: A correct answer to this question will receive the rarely used OTN 25pt <font color="silver" size="3" face="script">Platinum Star</font><font color="silver" size="4" face="script"> ★</font> * Essbase 9.3.1 Using a Java CDF that reads and writes