How to get the Clinet IP address in PAR files

Hi Frndzz...
My requirement is  to get the log on details of portal users, here i need the User ID n client IP address .
Am trying to  get these details from masthead iview PAR file, and this details am passing to a java(custom) class which can create a log_Test.txt file with these details.
User ID am gettiing using UME API like this in masthead PAR file
public void GetWelcomeID(IPortalComponentRequest request, String welcomeClause)
IUserContext userContext = request.getUser();
String usr =userContext.getLogonUid();
But am unable to get the Client IP
In normal JSP will get the client IP like this   request.getRemoteAddress()
So in par file i used the IPORTALCOMPONET request to get the client IP,  i thought IPORTALCOMPONET request  is equalent to HTTPSERVLETRequest request interface.
Any one suggest me that how we can get the Client IP in PAR files .
Thanks in Advance
Regards
Rajesh

Hi,
This is a very interesting question, i searched many time before to get an answer for this on sdn. I havn't found solution. As i know, It is very diffcult to find the ip address from request object.
The main reason is, before reaching the servlet class the request is by pass through other node like dispatcher/central node. If you try to fetch request objects ip from server class i think it will only return you the dispatcher server ip only.
There is a solution for this problem.. if you are able to fetch the ip using some client side scripting and pass it to the servelet as parameter, i hopes you can acheive this.
I will try this and let u know the result.
Others please share your thoughts on this topic.
Regards
Baby

Similar Messages

  • How to get the attribute value of an XML file??

    How to get the attribute value of an XML file??
    For example, how to get name and age attributes?
    <student name="Joe" age="20" />

    What are you using to read the XML file??
    On the assumption of JDOM - www.jdom.org. Something along the lines of:SAXBuilder builder = new SAXBuilder(true);
    Document doc = builder.build(filename);
    Element root = doc.getRootElement();
    List children = root.getChildren();
    Element thisElement = (Element)children.get(n);
    String name = thisElement.getAttributeValue("name")
    try
         int age = Integer.parseInt(thisElement.getAttributeValue("age"));
    catch (Exception ex)
         throw new InvalidElementException("Expected an int.....");
    }Ben

  • Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?

    Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?
    I'm developing an application where a file is need to be saved as pdf. But, if there is already a pdf file with same name in the specified directory, I wish to overwrite it. And in the overwrite case, read-only files should not be overwritten. If the duplicate(old) file is opened in windows (Win7) explorer preview, it is write protected. So, it should not be overwritten. I tried to get the '
    FILE_ATTRIBUTE_READONLY' using MS API 'GetFileAttributes', but it didn't succeed. How Adobe marks the file as read-only for preview? Do I need to check some other attribute of the file?
    Thanks!

    Divya - I have done it in the past following these documents. Please read it and try it it will work.
    Please read it in the following order since both are a continuation documents for the same purpose (it also contains how to change colors of row dynamically but I didnt do that part I just did the read_only part as your requirement) 
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b?quicklink=index&overridelayout=true
    thanks!
    Jason PV

  • WebGUI: How to get the users IP-address

    Hello.
    I have to develop a simple web-application, that will enable users to reset their forgotten passwords or to unlock themselves, if they are locked because of too many failed login-attempts.
    As you can imagine, this application must not require a login. For security reasons any action has to be logged.
    The username can not be used for logging-purposes, as the application is executed using a default-user defined in transaction SICF. That's why the IP-address of the user's pc has to be written into the log-table.
    My problem is, that i do not know how to get it. I have read many articles on help.sap.com, searched in the sap notes, used Google and tried to find usefull functions in our SAP-system, but after two days it still does not work and i do'nt know, what else to try.
    At the moment i am able to read the name of the client-pc with my test-coding.
      DATA:    lv_webgui TYPE xfeld.
      STATICS: lv_computer_name TYPE string,
               lv_username TYPE string.
      CLASS: cl_gui_frontend_services DEFINITION LOAD.
      lv_webgui = cl_gui_frontend_services=>www_active.
      IF lv_webgui EQ gc_true.
        " Begin of experimental coding #1
        CALL METHOD cl_gui_frontend_services=>get_computer_name
          CHANGING
            computer_name = lv_computer_name.
        " End of experimental coding #1
        " Begin of experimental coding #2
        CALL FUNCTION 'ITS_ENV_GET_VARIABLE'
          EXPORTING
            variable = 'COMPUTERNAME'
          CHANGING
            value = lv_computer_name.
        " End of experimental coding #2
        MESSAGE s000(38) WITH lv_computer_name.
      ENDIF.
    The problem is, that the Internet Explorer 7 (version: 7.0.5730.13CO) shows a warning before the scripts, generated by the ITS, are executed on the client. If the user clicks "abort", the scripts are not executed and the name of the client-pc will not be returned to the server (experimental coding #1 returns the value 'localhost', experimental coding #2 returns an empty string).
    That's why the experimental coding is quite useless, because the user is able to avoid it's execution.
    In theory i could use experimental coding #2 and stop the execution of the program if an empty string is returned but some users in our company have administrator-privileges and so they can change environment-variables at will. So i am afraid, that this procedure is not an option.
    I am quite sure, that there must be a way to read the IP-address directly from the ITS without using the functions in my experimental coding, but i have no clue how this could be done.
    Any suggestions would be highly appreciated.
    As i do'nt know how to determine the version of our ITS, i have to leave this information out for the moment. If anyone needs this information it would be very kind, if he or she could tell me how to get the required information.
    EDIT: As we are using SAP ECC 6.0 and Services are maintained via transaction SICF, it should be ITS 6.40.
    Regards
    Jörg Neumann
    Edited by: Jörg Neumann on Oct 16, 2009 1:27 PM

    Hello Wolfgang.
    Thanks for your reply.
    I can imagine, that the application as described above seems to be very insecure, but the description is not complete - i left some parts out, as they were not relevant for my problem.
    1.) The application can only be reached from our intranet.
    2.) Unlocking / Resetting password can be done three times per day, which limits the number of attemps for cracking a password to a total of 20 per day.
    3.) The owner of the account will receive an email if the acount was changed by the application. So if somebody tries to crack the password, the owner of the account will get a total
    20 3 mails per day - which should make him/her at least a litte suspicious. 
    I know, that the logged data is quite worthless, as computername and username are read using clientside-scripting and there could be a proxy between the client and the server, but this is exaclty, what i have to develop.
    I will keep the logging-problem in mind and talk about it in the next meeting, though i am quite sure, that it wo'nt change anything.
    Regards Jörg Neumann
    Edited by: Jörg Neumann on Oct 19, 2009 4:57 PM

  • How to get the vm ip address in scvmm 2012

    Hi,
    I want to get the vm ip address in scvmm 2012, who can help me?

    I have seen lots of people ask this because they can see IP addresses in other Virtualization Consoles, Unfortunately SCVMM doesn't show IP address of the VMs on the console but you can use below script to populate Custom1 property of VMs with IP address
    and make Custom1 Column visible (manually) in SCVMM Console... HTH
    param ( $VMMServer = 'localhost')
    $CustomProp = Get-SCCustomProperty -Name Custom1
    $VMs = get-SCVirtualMachine -VMMServer $VMMServer
    foreach ($VM in $VMs)
     $NetAdp = get-SCVirtualNetworkAdapter -VM $VM.name
     if ($NetAdp.IPv4Addresses)
     [String[]]$str = $NetAdp.IPv4Addresses
     Set-SCCustomPropertyValue -CustomProperty $CustomProp -InputObject $VM -Value "$str"
    Disclaimer: The sample script is provided AS IS without warranty of any kind.

  • How to get the pull path name from a file upload window

    Hello everyone!
    I have encountered the following problem with the following JSP code:
    <form method="post" action="filename.jsp">
    Upload JAVA program:
    <input type=file size=20 name="fname" accept="java">
    <input type=submit value="go">
    </form>
    <%
    String s = "";
    if (request.getParameter("fname") != null)
    s = request.getParameter("fname")
    %>
    The value of s is alway the filename. However I want to get the full path in addition to the filename, so that I can read the file. Does anyone know how to get the pull name of the file?
    thanks a lot in advance,

    Dear Sir,
    thanks a lot for your reply. Please let me explain what I intended to do: I want to upload a file from the local machine and then read the content of the file. Therefore I need to the fullpath of the filename like /var/local/file.java instead of file.java. The latter is what I got.
    The problem I have with your code is that the function like "request.getServerScheme()" is not recognized. Maybe is it because I didn't install servelet package? I only installed javax package btw. Also my application runns on Tomcat server if this could give you some information. The error message I had is as follows:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:133: cannot resolve symbol
    symbol : method getServerScheme ()
    location: interface javax.servlet.http.HttpServletRequest
    url = request.getServerScheme()
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:136: cannot resolve symbol
    symbol : method getServerScheme ()
    location: interface javax.servlet.http.HttpServletRequest
    + ((("http".equals(request.getServerScheme()) && request.getServerPort() != 80)
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:137: cannot resolve symbol
    symbol : method getServerScheme ()
    location: interface javax.servlet.http.HttpServletRequest
    ||("https".equals(request.getServerScheme()) && request.getServerPort() != 443))
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:139: cannot resolve symbol
    symbol : method getServletConfig ()
    location: interface javax.servlet.http.HttpServletRequest
    + "/" + request.getServletConfig().getServletName()
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:140: cannot resolve symbol
    symbol : variable path
    location: class org.apache.jsp.addExercise_jsp
    + "/" + path
    ^
    5 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:413)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

  • How to get the link report of a swf file to the set of clases

    He  But How to get the link Report of the SwF File

    Here are some links with additional information:
    http://stackoverflow.com/questions/185252/optimizing-flex-when-multiple-modules-are-used
    http://livedocs.adobe.com/flex/3/html/help.html?content=modular_4.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html
    If this post answers your question or helps, please mark it as such.

  • How to get the own IP-Address

    Dear All
    How can I read out the own IP-Address from my MIDP1.0 after I have opened a TCP socket.
    I haven't found any method/way in J2ME so far to get the own address that the GSM-provider has assigned to my mobile.
    Any hints or ideas would be appreciated
    Regards
    Sektionschef

    Hello,
    that is not possible because your mobile phone does not have an actual ip address, at least as far as I understand it. The gprs or hsdc gateway does and then it converts all traffic to some low level protocol which it uses to route the right stuff to your phone.
    A simple test would safice, write a simple servlet which logs all connections and then connect to it from your phone. Then disconnect your gprs/hsdc connection and connect again. Try to access the servlet and it will show the same IP address, the one of the gateway facilitating the communication.
    Hope this helps.
    Regs jP

  • How to get the international version address in Payment Medium

    Hi,
    I am trying to output the payment medium for auto-payment, and I need to get the company name information from the vendor master data. As we are in China, we maintained the Chinese name description in the international version, and English name in the normal name field. My question is how i can get the Chinese name when I set up the payment format via DMEE? thx very much~!

    Kerry, Were you able to find a solution? If so, can you share your knowledge?

  • How to get the local IP address?

    Hi,
    I try to obtain the users local IP address similar to:
    InetAddress localHost= InetAddress.getLocalHost();
    String localIP = localHost.getHostAddress();
    InetAddress[] inetAddress = InetAddress.getAllByName(localHost.getHostName());
    for (int k = 0; k < inetAddress.length; k++)
       if(!inetAddress [k].getHostAddress().equals(localIP))
          return inetAddress [k].getHostAddress();
    }This code works fine in a stand alone application. When I try to use it in conjunction with Web Start it only returns 127.0.0.1.
    I think there's no Service from Web Start that gives me the users IP address. Or am I wrong?
    Does anyone know a solution for this?
    Thanks in advance!

    Hello,
    I use java.net.InetAddress.getLocalHost().getHostName();
    in my javaws and I get the real hostname.
    Probably your DNS is not correct,
    or other possible problem: sign your jars, so you get full access to the System resources.
    regards.

  • How to get the cFP IP Address?

    Hi, I have a VI running standalone at a cFP 2020, and I can access the front panel using webserver. But to access these VI, I need to know the cFP 2020 IP address. This way, I'm leaving a fixed IP Adress. Now I want to put this cFP inside the company net, and, to do this, I'll select the "Obtain IP address from DHCP server" from the IP settings. But, doing it, if I know the cFP controller name, there's a way to discover the IP address?

    Try using String to IP followed by IP to String (and select dot notation). I believe the name should be resolved correctly.
    Try to take over the world!

  • How to get the real IP address

    Due to server changes, the method we used to obtain the ip
    address of the user (remote_addr) no longer works since it obtains
    a specific IP address that is not the user. For our web logs we
    were able to make changes to our web server to use this
    "headers.x-client-ip" to obtain the correct IP address. Is there
    anything in Coldfusion or in the administrator that can do this as
    well?

    Have a look at : GetHttpRequestData
    cheers,
    fober

  • How to get the entries in a jar/zip file contained within a jar/zip file?

    If I want to list the jar/zip entries in a jar/zip file contained within a jar/zip file how can I do that?
    In order to get to the entry enumeration I need a Zip/JarFile:
    ZipFile zip = new ZipFile("C:/java_dev/Java_dl/java_jdk_commander_v36d.zip");
    // Process the zip file. Close it when the block is exited.
    try {
    // Loop through the zip entries and print the name of each one.
    for (Enumeration list =zip.entries(); list.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) list.nextElement();
    System.out.println(entry.getName());
    finally {
    zip.close();
    Zip file "java_jdk_commander_v36d.zip" contains two zip entries:
    1) UsersGuide.zip
    2) JDKcommander.exe
    How to list the entries in "jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip!/UsersGuide.zip"?
    The following code:
    URL url = new URL("jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip!/UsersGuide.zip");
    JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
    zipFile = (ZipFile)jarConnection.getJarFile();
    would point to "jar:file:/C:/java_dev/Java_dl/java_jdk_commander_v36d.zip", which is no help at all and Class JarURLConnection does not have an enumeration method.
    How can I do this?
    Thanks.
    Andre

    I'm not sure I understand the problem. The difference between a zip and jar file is the manifest file; JarFile is extended from ZipFile and is able to read the manifest, other than that they are the same. Your code
    for (Enumeration list =zip.entries(); list.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) list.nextElement();
    System.out.println(entry.getName());
    }is close to what I've use for a jar, below. Why not use the same approach? I don't understand what you're trying to do by using JarURLConnection - it's usually used to read the jar contents.
    String jarName = "";
    JarFile jar = null;
    try
        jar = new JarFile(jarName);
    catch (IOException ex)
        System.out.println("Unable to open jarfile" + jarName);
        ex.printStackTrace();
    for ( Enumeration en = jar.entries() ;  en.hasMoreElements() ;)
        System.out.println(en.nextElement());
    }

  • How To Get The CLOSE Event In a JSP File?

    Hello everybody,
    Right now I am working in a JSP project which is about access log, when the users start , oprate, or close the system, the access log system works. I am in trouble in that when the users close the system, how can I get the close event?
    The JSP file contains the following fields :
    Close Window
    How to add code to get the CLOSE Event and submit to the service?
    And If I hit the "Close Button"(on the right-top of the window), how can I get the CLOSE event, too?
    Can anyone tell me?

    1. Add a hidden field:
    <input type="hidden" id="status" value="">2. modify <a href="index.jsp" onclick ="parent.window.close( );">Close Window</a> with <a href="index.jsp" onclick ="closefn();">Close Window</a>3. Add a javascript
    <script language="javascript">function closefn(){
    document.getElementById('status').value="close";
    document.form.action="";
    document.form.method="post";
    document.form.submit();
    parent.window.close( );
    }4. Now on the action page get the value of status by request.getParameter("status"); and log it.

  • How to get the exact case of a local file

    Hi,
    I am using form 10g with webutil and have a local file called "Abc.sql".
    In my form, there is a input text and a button to let users to input the local file name and the press the button to upload it to
    the app server.
    What I want is : I can upload the file in the server with the exacl local file name. That means "Abc.sql" no matter users input
    "abc.sql" or "Abc.sql" in the input text.
    How to achieve this ? Is there any function provided to get the exact local file name ?
    For example, if I input "abc.sql" , it can return "Abc.sql".
    Thanks in advance
    Ivan
    Ivan

    Hello,
    How about simply let the user choose the file through a File selection dialog rather than take risk of end-user input typo ?
    Francois

Maybe you are looking for

  • Reschedule strategy plan based on last actual order completion date

    Dear all, Hope you can help me with this one. We use strategybased maintenance plans. We want to achieve that the next scheduled call date is calculated taking into account the actual completion date of the last (previous) call. For example : strateg

  • How to set a date variable to "top of the next hour"?

    hi i have a idler script that i want to continually run. at the moment it idles for an hour, then runs the "on idle" handler. what i would prefer is to set this to the "top of the next hour", for any hour. e.g. if its 4:35, it would set it to 5:00. i

  • How can I open safari with multiple home pages

    Hi All On my iPhone 4 I always follow the same four websites (2x e-mail, 1x news and 1x sport page).  Is there a way that I can set Safari on the iPhone to open these four pages on startup.  i.e. open up with 4 home pages. Thanks in advance Sathers

  • How do we find out the file path which the IDOC is stored.

    Hi, If we use T-code: AL11, we can see the file path of the Unix server.  And some IDOC outbound file is also stored in some file path after generated. If i generated an outbound IDOC, how do i know in which file path it stored?? Thanks

  • Safari on Mac vs. Windows

    I'm building a website & want to learn more about Safari. I'm asking if there are any performance/usability issues if Safari is run on a Windows PC vs. a Mac? If there are any issues, can you please let me know what some common differences are betwee