IP address

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

kbrouwer
Ebase User
Posts: 2
Joined: Wed Sep 26, 2007 7:15 am

IP address

#1

Postby kbrouwer » Wed Sep 26, 2007 8:29 am

Where can I find the ip-address of the user requesting a form?
0 x

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#2

Postby Joost » Wed Sep 26, 2007 8:50 am

First thing that comes to mind is using the environment variable "remote_addr".

To use env. vars look in the (3.4.x) online documentation for page: /doc/Environment_variables.htm

Perhaps someone has created a customfunction for this, so we don't have to amend the web.xml file. I would be interested in this :)
0 x

kbrouwer
Ebase User
Posts: 2
Joined: Wed Sep 26, 2007 7:15 am

#3

Postby kbrouwer » Wed Sep 26, 2007 10:52 am

The web.xml is the file where you can find descriptions of the servlets and components that make up the application, UFS in this case. So, though these are also environment variables, they are related to the environment of the servlet. I think that what I am looking for are environment variables that relate to the session that is created within the servlet. Is there a way to get to those?
0 x

Ben
Ebase Developer
Ebase Developer
Posts: 27
Joined: Tue Sep 18, 2007 3:21 pm

#4

Postby Ben » Wed Sep 26, 2007 2:42 pm

I'm sorry, but there is no easy way to do this at the moment.

A custom function is probably the best way to do this. The problem is you need access to the javax.servlet.ServletRequest object, but the only sensible way to do this is undocumented and secret. (We really should put it in UFSFormInterface).

In FPL, it would be something like:

SET USER_IP = getUserIPAddress();

If you are interested, I will make the function and post it here. It will also get added to the library of "Additional Supplied Functions".
0 x

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#5

Postby Joost » Wed Sep 26, 2007 3:05 pm

Ben wrote:If you are interested, I will make the function and post it here. It will also get added to the library of "Additional Supplied Functions".
Please do. I'm interested.


It would be very nice if I could just use a "getEnv(String)" method. As string I'd use "REMOTE_ADDR", "HTTP_REFERER" or "SERVER_PORT" to get to the various environment strings.
0 x

Ben
Ebase Developer
Ebase Developer
Posts: 27
Joined: Tue Sep 18, 2007 3:21 pm

#6

Postby Ben » Thu Sep 27, 2007 2:23 pm

I have put a jar containing the custom function in http://www.ebaseftp.com/forum/forumfile ... operty.zip. At the moment it is called requestproperty.jar, but it will become part of the standard distribution in the next release.

The requestProperty custom function provides access to various properties
in the HTTP request (including the calling ip address).

To register the custom function with Ebase, put requestproperty.jar in
your WEB-INF/lib directory (/UfsServer/tomcat/webapps/ufs/WEB-INF/lib) and restart your tomcat server. In Designer, go to the menu, 'tools/Maintain Functions...' and add the new function:

name: requestproperty
class: com.ebasetech.ufs.customfunctions.RequestProperty
return type: char
it has one char parameter. This represents the property name.

The available properties are all of the get methods in javax.servlet.http.HttpServletRequest that take no arguments.
http://java.sun.com/j2ee/1.4/docs/api/j ... quest.html

Some of the more useful ones are

serverName
serverPort
remoteHost
remoteAddr
requestURL
servletPath

To use it in FPL the command is something like:

SET IPADDRESS = requestproperty('remoteAddr');



'Referrer' is a request header property. I'll need to make a slightly different function to get at it. (requestHeaderProperty?)
0 x

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#7

Postby Vircos » Fri Sep 28, 2007 6:33 pm

This looks great.
Thank you Ben it sure is usefull :)
0 x
What's the meaning of Justice...

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#8

Postby Joost » Mon Oct 01, 2007 6:42 am

Ben wrote:I have put a jar containing the custom function
Splendid. Thanks!

'Referrer' is a request header property. I'll need to make a slightly different function to get at it. (requestHeaderProperty?)
Please do. That'd make it perfect.
0 x

sjethwa
Ebase User
Posts: 9
Joined: Mon Oct 08, 2007 10:18 am

#9

Postby sjethwa » Mon Nov 10, 2008 12:34 pm

Quote:
'Referrer' is a request header property. I'll need to make a slightly different function to get at it. (requestHeaderProperty?)


Please can you tell me if REFERER property is now available to reference in FPL ... it would be so useful.

Genral criticism of Ebase:- that a lot of standard functions like these should be out-of-the-box

Sanjay
0 x

User avatar
Sarah
Ebase User
Posts: 63
Joined: Fri Sep 07, 2007 2:42 pm
Location: Sandy, UK
Contact:

#10

Postby Sarah » Wed Nov 12, 2008 3:32 pm

sjethwa wrote:Quote:

Please can you tell me if REFERER property is now available to reference in FPL ... it would be so useful.

Genral criticism of Ebase:- that a lot of standard functions like these should be out-of-the-box

Sanjay
First item: No, it is not currently available in FPL.

Second item: Custom functions that are written to extend the functionality of Ebase are included in future service packs as and when possible. It is not always possible to include them in the Ebase application.
0 x

sid_nadgeri
Ebase User
Posts: 11
Joined: Thu Oct 16, 2008 11:33 am
Location: Mumbai, Currently in Croydon

about remoteHost property

#11

Postby sid_nadgeri » Tue Oct 13, 2009 10:09 am

Hi,

Whether "remoteHost" expected to return the remote host name or IP address as I am getting the IP address in remoteAddr and remoteHost

Please advise.

Regards,
Sid
0 x

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

Re: about remoteHost property

#12

Postby Joost » Mon Nov 02, 2009 6:59 am

sid_nadgeri wrote:I am getting the IP address in remoteAddr and remoteHost
It probably has something to do with your server not resolving the ipaddress to a hostname. Perhaps the following links may help you:

IIS
http://metasun.net/node/74
http://classicasp.aspfaq.com/general/wh ... dress.html

Java/Tomcat
http://old.nabble.com/enableLookups%3Dt ... 96774.html
http://objectmix.com/java/71883-client- ... -name.html
0 x


Who is online

Users browsing this forum: No registered users and 139 guests