Also, take note that if you proxy your app behind a proxy server like apache
or some other front-end server, you may have to resort to this, less
desirable method:

           String ip =
getRequest().getHttpServletRequest().getHeader("X-Forwarded-For");

The aforementioned way is better, if you're not proxied.

Jeremy Thomerson

On 5/7/07, howzat <[EMAIL PROTECTED]> wrote:


Thanks Mathias, that's exactly what I was after and it works.
Looking at the bigger picture, is it considered to be reasonable practice
in
Wicket to cut through all its high-level abstractions, right down to the
wire (or servlet api anyway)? I suppose an ip address is quite a low-level
bit of info (depending on your domain).


mathias axelsson wrote:
>
>         ((WebRequest) (WebRequestCycle.get().getRequest()))
>                 .getHttpServletRequest().getRemoteHost();
>
> should work I think.
>
> On 5/7/07, howzat <[EMAIL PROTECTED]> wrote:
>>
>>
>> Thanks for the suggestion but I'm not sure I understand you properly.
>> Have
>> you tried that?
>> ((WebRequestCycle)RequestCycle.get()).getHttpServletRequest()
>> doesn't exist (1.2.6) .
>>
>> and
>>
((WebRequestCycle)RequestCycle.get()).getRequest().getParameterMap().keySet()
>>
>> returns only:
>> [previewForm:hf:0, userAnswer, wicket:interface]
>>
>> All I need is to get the ip address of the client. Has any one else had
a
>> go
>> at this in Wicket 1.2.6 ?
>>
>>
>>
>>
>>
>> Johan Compagner wrote:
>> >
>> > see Timo's post about the ServletWebRequest.
>> >
>> > ((WebRequestCycle)RequestCycle.get()).getHttpServletRequest()
>> >
>> > johan
>> >
>> >
>> > On 5/7/07, howzat < [EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >> As stated in my initial post I am using 1.2.6 (as there is more
>> published
>> >> material to learn from for 1.x) and plan to eventually move straight
>> up
>>
>> >> to
>> >> 2.0 (mainly for java 5 enhancements).
>> >> Is there a concrete code snippet somewhere that demonstrates how to
>> get
>> >> the
>> >> user's ip address in 1.2.6 ?
>> >>
>> >>
>> >>
>> >> Johan Compagner wrote:
>> >> >
>> >> > which version do you use?
>> >> > i think that is rewritten in 1.3 and i do see remote address there
>> >> >
>> >> > johan
>> >> >
>> >> >
>> >> > On 5/7/07, howzat <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >>
>> >> >> Thanks Tino & John.
>> >> >> I was hoping to get it using ClientInfo/ClientProperties class
for
>> >> this
>> >> >> from
>> >> >> Session.getClientInfo() as my first guess too. But I can only see
>> the
>> >> >> following (ie no ip address) properties:
>> >> >>
>> >> >> ClientProperties: {quirkIETablePercentWidthScrollbarError=true,
>> >> >> proprietaryIEPngAlphaFilterRequired=true,
>> >> >> quirkCssPositioningOneSideOnly=true,
>> >> >> quirkIETextareaNewlineObliteration=true,
>> >> >> quirkCssBorderCollapseFor0Padding=true,
>> >> >> quirkCssBackgroundAttachmentUseFixed=true, quirkIERepaint=true,
>> >> >> quirkCssBorderCollapseInside=true, browserInternetExplorer=true,
>> >> >> browserVersionMajor=6, quirkIESelectListDomUpdate=true,
>> >> >> proprietaryIECssExpressionsSupported=true,
>> quirkIESelectZIndex=true,
>>
>> >> >> quirkIESelectPercentWidth=true}
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> Johan Compagner wrote:
>> >> >> >
>> >> >> > yes you can get it right from the httprequest
>> >> >> > But you can also use our ClientInfo/ClientProperties class for
>> this
>> >> >> > see Session.getClientInfo()
>> >> >> >
>> >> >> >
>> >> >> > On 5/7/07, Timo Rantalaiho < [EMAIL PROTECTED]> wrote:
>> >> >> >>
>> >> >> >> On Sun, 06 May 2007, howzat wrote:
>> >> >> >> > What is the right way in Wicket to get the ip address of the
>> >> client?
>> >> >> >>
>> >> >> >> We've done it by digging the HttpServletRequest from Wicket's
>> >> >> >> own request class
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>
http://wicketframework.org/apidocs/wicket/protocol/http/servlet/ServletWebRequest.html
>>
>> >> >> >>
>> >> >> >> but have no idea if this is the ideal way.
>> >> >> >>
>> >> >> >> --
>> >> >> >> Timo Rantalaiho
>> >> >> >> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>
-------------------------------------------------------------------------
>> >> >> >> This SF.net email is sponsored by DB2 Express
>> >> >> >> Download DB2 Express C - the FREE version of DB2 express and
>> take
>> >> >> >> control of your XML. No limits. Just data. Click to get it
now.
>> >> >> >> http://sourceforge.net/powerbar/db2/
>> >> >> >> _______________________________________________
>> >> >> >> Wicket-user mailing list
>> >> >> >> Wicket-user@lists.sourceforge.net
>> >> >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >>
>>
-------------------------------------------------------------------------
>> >> >> > This SF.net email is sponsored by DB2 Express
>> >> >> > Download DB2 Express C - the FREE version of DB2 express and
take
>> >> >> > control of your XML. No limits. Just data. Click to get it now.
>> >> >> > http://sourceforge.net/powerbar/db2/
>> >> >> > _______________________________________________
>> >> >> > Wicket-user mailing list
>> >> >> > Wicket-user@lists.sourceforge.net
>> >> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >> http://www.nabble.com/Remote-Address-tf3701431.html#a10355023
>> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> >>
>>
-------------------------------------------------------------------------
>> >> >> This SF.net email is sponsored by DB2 Express
>> >> >> Download DB2 Express C - the FREE version of DB2 express and take
>> >> >> control of your XML. No limits. Just data. Click to get it now.
>> >> >> http://sourceforge.net/powerbar/db2/
>> >> >> _______________________________________________
>> >> >> Wicket-user mailing list
>> >> >> Wicket-user@lists.sourceforge.net
>> >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >>
>> >> >
>> >> >
>> >>
>>
-------------------------------------------------------------------------
>> >> > This SF.net email is sponsored by DB2 Express
>> >> > Download DB2 Express C - the FREE version of DB2 express and take
>> >> > control of your XML. No limits. Just data. Click to get it now.
>> >> > http://sourceforge.net/powerbar/db2/
>> >> > _______________________________________________
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Remote-Address-tf3701431.html#a10355526
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>>
-------------------------------------------------------------------------
>> >> This SF.net email is sponsored by DB2 Express
>> >> Download DB2 Express C - the FREE version of DB2 express and take
>> >> control of your XML. No limits. Just data. Click to get it now.
>> >> http://sourceforge.net/powerbar/db2/
>> >> _______________________________________________
>> >> Wicket-user mailing list
>> >> Wicket-user@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >
>> >
>>
-------------------------------------------------------------------------
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Remote-Address-tf3701431.html#a10363561
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>
-------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

--
View this message in context:
http://www.nabble.com/Remote-Address-tf3701431.html#a10365837
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to