You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Luca Provenzani <eu...@gmail.com> on 2009/01/21 11:35:25 UTC

Retrieve RemoteUser from HttpServletRequest

Hi All!

I'm in a webPage and i need to retrieve the RemoteUser and RemoteAddress
from the httpServletRequest.
I use this code:
*
**HttpServletRequest request =
getWebRequestCycle().getWebRequest().getHttpServletRequest();*
*
            String remUser = request.getRemoteUser();
**String remAddr = request.getRemoteAddr();
*

But the two strings are null. I'm sure that this values are not null because
if i try to retrieve them with a simple jsp the result is what i expect to
be.

what is wrong? What can i do?

Thank

Luca

Re: Retrieve RemoteUser from HttpServletRequest

Posted by Luca Provenzani <eu...@gmail.com>.
no! i haven't a right web.xml... that is the problem!
sorry! i'm a newbie in wicket..

Thank you all !!

Luca


2009/1/23 Serkan Camurcuoglu <Se...@telenity.com>

> is your wicket url also protected by security and login constraints in your
> web.xml?
>
>
>
> Luca Provenzani wrote:
>
>> nothing to do! i read again only two null strings...
>> it's really strange!
>> in the jsp is simple: i need only this:
>> *request.getRemoteUser(),request.getRemoteAddr()
>> *
>> and seem to be simple even in wicket... only one right of code... but...
>> why doesn't httpservletrequest give me the right values?
>>
>>
>> Luca
>>
>> 2009/1/22 James Carman <jc...@carmanconsulting.com>
>>
>>
>>
>>> Right, just use the servlet API for this one (and Igor's pointing out
>>> how to get to the API below)
>>>
>>> On Thu, Jan 22, 2009 at 11:42 AM, Igor Vaynberg <igor.vaynberg@gmail.com
>>> >
>>> wrote:
>>>
>>>
>>>> servlethttprequest
>>>> r=((webrequest)getrequestcycle().getrequest()).gethttpservletrequest();
>>>>
>>>> -igor
>>>>
>>>> On Thu, Jan 22, 2009 at 8:40 AM, Luca Provenzani <eu...@gmail.com>
>>>>
>>>>
>>> wrote:
>>>
>>>
>>>> my application works on an apache-tomcat server. And on this server my
>>>>> client has his authentication system that is similar to the Apache
>>>>> Basic
>>>>> Authentication. Than, i need to read remoteUser that contains the id of
>>>>>
>>>>>
>>>> the
>>>
>>>
>>>> user.
>>>>>
>>>>> thank you for your attention
>>>>>
>>>>> Luca
>>>>>
>>>>> 2009/1/22 Bert <ta...@gmail.com>
>>>>>
>>>>>
>>>>>
>>>>>> On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com>
>>>>>>
>>>>>>
>>>>> wrote:
>>>
>>>
>>>> Thank You for answer Bert
>>>>>>>
>>>>>>> I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm
>>>>>>>
>>>>>>>
>>>>>> for
>>>
>>>
>>>> Italy ;-), because now i'm working for an other project).
>>>>>>>
>>>>>>>
>>>>>> that would be the same timezone as me (germany)
>>>>>>
>>>>>>
>>>>>>
>>>>>>> but...
>>>>>>>  i need to retrieve the authenticated remoteUser, not the UserAgent,
>>>>>>>
>>>>>>>
>>>>>> how
>>>
>>>
>>>> can
>>>>>>
>>>>>>
>>>>>>> i do this?
>>>>>>>
>>>>>>>
>>>>>> what do you mean with remoteUser? the Authentification the user has on
>>>>>>
>>>>>>
>>>>> his
>>>
>>>
>>>> PC?
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Retrieve RemoteUser from HttpServletRequest

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
is your wicket url also protected by security and login constraints in 
your web.xml?


Luca Provenzani wrote:
> nothing to do! i read again only two null strings...
> it's really strange!
> in the jsp is simple: i need only this:
> *request.getRemoteUser(),request.getRemoteAddr()
> *
> and seem to be simple even in wicket... only one right of code... but...
> why doesn't httpservletrequest give me the right values?
>
>
> Luca
>
> 2009/1/22 James Carman <jc...@carmanconsulting.com>
>
>   
>> Right, just use the servlet API for this one (and Igor's pointing out
>> how to get to the API below)
>>
>> On Thu, Jan 22, 2009 at 11:42 AM, Igor Vaynberg <ig...@gmail.com>
>> wrote:
>>     
>>> servlethttprequest
>>> r=((webrequest)getrequestcycle().getrequest()).gethttpservletrequest();
>>>
>>> -igor
>>>
>>> On Thu, Jan 22, 2009 at 8:40 AM, Luca Provenzani <eu...@gmail.com>
>>>       
>> wrote:
>>     
>>>> my application works on an apache-tomcat server. And on this server my
>>>> client has his authentication system that is similar to the Apache Basic
>>>> Authentication. Than, i need to read remoteUser that contains the id of
>>>>         
>> the
>>     
>>>> user.
>>>>
>>>> thank you for your attention
>>>>
>>>> Luca
>>>>
>>>> 2009/1/22 Bert <ta...@gmail.com>
>>>>
>>>>         
>>>>> On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com>
>>>>>           
>> wrote:
>>     
>>>>>> Thank You for answer Bert
>>>>>>
>>>>>> I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm
>>>>>>             
>> for
>>     
>>>>>> Italy ;-), because now i'm working for an other project).
>>>>>>             
>>>>> that would be the same timezone as me (germany)
>>>>>
>>>>>           
>>>>>> but...
>>>>>>  i need to retrieve the authenticated remoteUser, not the UserAgent,
>>>>>>             
>> how
>>     
>>>>> can
>>>>>           
>>>>>> i do this?
>>>>>>             
>>>>> what do you mean with remoteUser? the Authentification the user has on
>>>>>           
>> his
>>     
>>>>> PC?
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>           
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Retrieve RemoteUser from HttpServletRequest

Posted by Luca Provenzani <eu...@gmail.com>.
nothing to do! i read again only two null strings...
it's really strange!
in the jsp is simple: i need only this:
*request.getRemoteUser(),request.getRemoteAddr()
*
and seem to be simple even in wicket... only one right of code... but...
why doesn't httpservletrequest give me the right values?


Luca

2009/1/22 James Carman <jc...@carmanconsulting.com>

> Right, just use the servlet API for this one (and Igor's pointing out
> how to get to the API below)
>
> On Thu, Jan 22, 2009 at 11:42 AM, Igor Vaynberg <ig...@gmail.com>
> wrote:
> > servlethttprequest
> > r=((webrequest)getrequestcycle().getrequest()).gethttpservletrequest();
> >
> > -igor
> >
> > On Thu, Jan 22, 2009 at 8:40 AM, Luca Provenzani <eu...@gmail.com>
> wrote:
> >> my application works on an apache-tomcat server. And on this server my
> >> client has his authentication system that is similar to the Apache Basic
> >> Authentication. Than, i need to read remoteUser that contains the id of
> the
> >> user.
> >>
> >> thank you for your attention
> >>
> >> Luca
> >>
> >> 2009/1/22 Bert <ta...@gmail.com>
> >>
> >>> On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com>
> wrote:
> >>> > Thank You for answer Bert
> >>> >
> >>> > I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm
> for
> >>> > Italy ;-), because now i'm working for an other project).
> >>> that would be the same timezone as me (germany)
> >>>
> >>> > but...
> >>> >  i need to retrieve the authenticated remoteUser, not the UserAgent,
> how
> >>> can
> >>> > i do this?
> >>>
> >>> what do you mean with remoteUser? the Authentification the user has on
> his
> >>> PC?
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Retrieve RemoteUser from HttpServletRequest

Posted by James Carman <jc...@carmanconsulting.com>.
Right, just use the servlet API for this one (and Igor's pointing out
how to get to the API below)

On Thu, Jan 22, 2009 at 11:42 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> servlethttprequest
> r=((webrequest)getrequestcycle().getrequest()).gethttpservletrequest();
>
> -igor
>
> On Thu, Jan 22, 2009 at 8:40 AM, Luca Provenzani <eu...@gmail.com> wrote:
>> my application works on an apache-tomcat server. And on this server my
>> client has his authentication system that is similar to the Apache Basic
>> Authentication. Than, i need to read remoteUser that contains the id of the
>> user.
>>
>> thank you for your attention
>>
>> Luca
>>
>> 2009/1/22 Bert <ta...@gmail.com>
>>
>>> On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com> wrote:
>>> > Thank You for answer Bert
>>> >
>>> > I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm for
>>> > Italy ;-), because now i'm working for an other project).
>>> that would be the same timezone as me (germany)
>>>
>>> > but...
>>> >  i need to retrieve the authenticated remoteUser, not the UserAgent, how
>>> can
>>> > i do this?
>>>
>>> what do you mean with remoteUser? the Authentification the user has on his
>>> PC?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Retrieve RemoteUser from HttpServletRequest

Posted by Igor Vaynberg <ig...@gmail.com>.
servlethttprequest
r=((webrequest)getrequestcycle().getrequest()).gethttpservletrequest();

-igor

On Thu, Jan 22, 2009 at 8:40 AM, Luca Provenzani <eu...@gmail.com> wrote:
> my application works on an apache-tomcat server. And on this server my
> client has his authentication system that is similar to the Apache Basic
> Authentication. Than, i need to read remoteUser that contains the id of the
> user.
>
> thank you for your attention
>
> Luca
>
> 2009/1/22 Bert <ta...@gmail.com>
>
>> On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com> wrote:
>> > Thank You for answer Bert
>> >
>> > I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm for
>> > Italy ;-), because now i'm working for an other project).
>> that would be the same timezone as me (germany)
>>
>> > but...
>> >  i need to retrieve the authenticated remoteUser, not the UserAgent, how
>> can
>> > i do this?
>>
>> what do you mean with remoteUser? the Authentification the user has on his
>> PC?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Retrieve RemoteUser from HttpServletRequest

Posted by Luca Provenzani <eu...@gmail.com>.
my application works on an apache-tomcat server. And on this server my
client has his authentication system that is similar to the Apache Basic
Authentication. Than, i need to read remoteUser that contains the id of the
user.

thank you for your attention

Luca

2009/1/22 Bert <ta...@gmail.com>

> On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com> wrote:
> > Thank You for answer Bert
> >
> > I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm for
> > Italy ;-), because now i'm working for an other project).
> that would be the same timezone as me (germany)
>
> > but...
> >  i need to retrieve the authenticated remoteUser, not the UserAgent, how
> can
> > i do this?
>
> what do you mean with remoteUser? the Authentification the user has on his
> PC?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Retrieve RemoteUser from HttpServletRequest

Posted by Bert <ta...@gmail.com>.
On Wed, Jan 21, 2009 at 14:37, Luca Provenzani <eu...@gmail.com> wrote:
> Thank You for answer Bert
>
> I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm for
> Italy ;-), because now i'm working for an other project).
that would be the same timezone as me (germany)

> but...
>  i need to retrieve the authenticated remoteUser, not the UserAgent, how can
> i do this?

what do you mean with remoteUser? the Authentification the user has on his PC?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Retrieve RemoteUser from HttpServletRequest

Posted by Luca Provenzani <eu...@gmail.com>.
Thank You for answer Bert

I'll try to retrieve remoteAddress in this way(tomorrow morning, ehm for
Italy ;-), because now i'm working for an other project).

but...
 i need to retrieve the authenticated remoteUser, not the UserAgent, how can
i do this?

Luca

2009/1/21 Bert <ta...@gmail.com>

> Hi,
>
> I use
> RequestCycle.get().getClientInfo().getProperties().getRemoteAddress();
> or
> RequestCycle.get().getClientInfo().getProperties().getUserAgent();
>
> for this.
>
> hth
> Bert
>
> On Wed, Jan 21, 2009 at 11:35, Luca Provenzani <eu...@gmail.com> wrote:
> > Hi All!
> >
> > I'm in a webPage and i need to retrieve the RemoteUser and RemoteAddress
> > from the httpServletRequest.
> > I use this code:
> > *
> > **HttpServletRequest request =
> > getWebRequestCycle().getWebRequest().getHttpServletRequest();*
> > *
> >            String remUser = request.getRemoteUser();
> > **String remAddr = request.getRemoteAddr();
> > *
> >
> > But the two strings are null. I'm sure that this values are not null
> because
> > if i try to retrieve them with a simple jsp the result is what i expect
> to
> > be.
> >
> > what is wrong? What can i do?
> >
> > Thank
> >
> > Luca
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Retrieve RemoteUser from HttpServletRequest

Posted by Bert <ta...@gmail.com>.
Hi,

I use
RequestCycle.get().getClientInfo().getProperties().getRemoteAddress();
or
RequestCycle.get().getClientInfo().getProperties().getUserAgent();

for this.

hth
Bert

On Wed, Jan 21, 2009 at 11:35, Luca Provenzani <eu...@gmail.com> wrote:
> Hi All!
>
> I'm in a webPage and i need to retrieve the RemoteUser and RemoteAddress
> from the httpServletRequest.
> I use this code:
> *
> **HttpServletRequest request =
> getWebRequestCycle().getWebRequest().getHttpServletRequest();*
> *
>            String remUser = request.getRemoteUser();
> **String remAddr = request.getRemoteAddr();
> *
>
> But the two strings are null. I'm sure that this values are not null because
> if i try to retrieve them with a simple jsp the result is what i expect to
> be.
>
> what is wrong? What can i do?
>
> Thank
>
> Luca
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org