You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by james agada <ok...@gmail.com> on 2013/10/15 18:00:22 UTC

Automatically capture client details into an entity

I will like to automatically capture the client details - IP address,
Browser Agent of a client accessing my isis web app into an entity. Any
ideas?

Re: Automatically capture client details into an entity

Posted by james agada <ok...@gmail.com>.
Hmm. I will think about it and see what else I can do.


On Tue, Oct 15, 2013 at 5:54 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

> No... Wicket is only used in the wicket viewer :-)
>
> You could have the same API in the dom, but you'd need a different
> implementation.
>
> I think the easiest thing might be to write a servlet filter to grab the
> httpservletrequest in all cases, and attach to a threadlocal for the
> duration of the call.  Then, your service implementation can just read from
> that threadlocal.
>
> This SO answer [1] might give you some clues.
>
> Dan
>
> [1]
>
> http://stackoverflow.com/questions/6217173/static-threadlocal-variable-in-a-webapp-are-there-any-security-performance-iss
>
>
> On 15 October 2013 17:36, james agada <ok...@gmail.com> wrote:
>
> > Will this also work for the RO viewer? I want to apply this to both
> wicket
> > viewer and the RO viewer
> >
> >
> > On Tue, Oct 15, 2013 at 5:07 PM, Dan Haywood
> > <da...@haywood-associates.co.uk>wrote:
> >
> > > The raw information you want is available via Wicket APIs, eg [1]
> > >
> > > So, define an interface to this in your dom project, eg:
> > >
> > > public interface IWebUserService {
> > >     String currentIpAddress();
> > >     String currentBrowserAgent();
> > > }
> > >
> > > and write an implementation in the webapp project, leveraging said
> Wicket
> > > APIs.
> > >
> > > In your webapp project, register this new service.
> > >
> > > In your dom project, inject the service (via its interface type) into
> > your
> > > domain objects.
> > >
> > > HTH
> > > Dan
> > >
> > >
> > > [1]
> > >
> > >
> >
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/request/cycle/RequestCycle.html#get()
> > >
> > >
> > > On 15 October 2013 17:00, james agada <ok...@gmail.com> wrote:
> > >
> > > > I will like to automatically capture the client details - IP address,
> > > > Browser Agent of a client accessing my isis web app into an entity.
> Any
> > > > ideas?
> > > >
> > >
> >
>

Re: Automatically capture client details into an entity

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
No... Wicket is only used in the wicket viewer :-)

You could have the same API in the dom, but you'd need a different
implementation.

I think the easiest thing might be to write a servlet filter to grab the
httpservletrequest in all cases, and attach to a threadlocal for the
duration of the call.  Then, your service implementation can just read from
that threadlocal.

This SO answer [1] might give you some clues.

Dan

[1]
http://stackoverflow.com/questions/6217173/static-threadlocal-variable-in-a-webapp-are-there-any-security-performance-iss


On 15 October 2013 17:36, james agada <ok...@gmail.com> wrote:

> Will this also work for the RO viewer? I want to apply this to both wicket
> viewer and the RO viewer
>
>
> On Tue, Oct 15, 2013 at 5:07 PM, Dan Haywood
> <da...@haywood-associates.co.uk>wrote:
>
> > The raw information you want is available via Wicket APIs, eg [1]
> >
> > So, define an interface to this in your dom project, eg:
> >
> > public interface IWebUserService {
> >     String currentIpAddress();
> >     String currentBrowserAgent();
> > }
> >
> > and write an implementation in the webapp project, leveraging said Wicket
> > APIs.
> >
> > In your webapp project, register this new service.
> >
> > In your dom project, inject the service (via its interface type) into
> your
> > domain objects.
> >
> > HTH
> > Dan
> >
> >
> > [1]
> >
> >
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/request/cycle/RequestCycle.html#get()
> >
> >
> > On 15 October 2013 17:00, james agada <ok...@gmail.com> wrote:
> >
> > > I will like to automatically capture the client details - IP address,
> > > Browser Agent of a client accessing my isis web app into an entity. Any
> > > ideas?
> > >
> >
>

Re: Automatically capture client details into an entity

Posted by james agada <ok...@gmail.com>.
Will this also work for the RO viewer? I want to apply this to both wicket
viewer and the RO viewer


On Tue, Oct 15, 2013 at 5:07 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

> The raw information you want is available via Wicket APIs, eg [1]
>
> So, define an interface to this in your dom project, eg:
>
> public interface IWebUserService {
>     String currentIpAddress();
>     String currentBrowserAgent();
> }
>
> and write an implementation in the webapp project, leveraging said Wicket
> APIs.
>
> In your webapp project, register this new service.
>
> In your dom project, inject the service (via its interface type) into your
> domain objects.
>
> HTH
> Dan
>
>
> [1]
>
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/request/cycle/RequestCycle.html#get()
>
>
> On 15 October 2013 17:00, james agada <ok...@gmail.com> wrote:
>
> > I will like to automatically capture the client details - IP address,
> > Browser Agent of a client accessing my isis web app into an entity. Any
> > ideas?
> >
>

Re: Automatically capture client details into an entity

Posted by james agada <ok...@gmail.com>.
Thanks. Will try.


On Tue, Oct 15, 2013 at 5:07 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

> The raw information you want is available via Wicket APIs, eg [1]
>
> So, define an interface to this in your dom project, eg:
>
> public interface IWebUserService {
>     String currentIpAddress();
>     String currentBrowserAgent();
> }
>
> and write an implementation in the webapp project, leveraging said Wicket
> APIs.
>
> In your webapp project, register this new service.
>
> In your dom project, inject the service (via its interface type) into your
> domain objects.
>
> HTH
> Dan
>
>
> [1]
>
> http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/request/cycle/RequestCycle.html#get()
>
>
> On 15 October 2013 17:00, james agada <ok...@gmail.com> wrote:
>
> > I will like to automatically capture the client details - IP address,
> > Browser Agent of a client accessing my isis web app into an entity. Any
> > ideas?
> >
>

Re: Automatically capture client details into an entity

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
The raw information you want is available via Wicket APIs, eg [1]

So, define an interface to this in your dom project, eg:

public interface IWebUserService {
    String currentIpAddress();
    String currentBrowserAgent();
}

and write an implementation in the webapp project, leveraging said Wicket
APIs.

In your webapp project, register this new service.

In your dom project, inject the service (via its interface type) into your
domain objects.

HTH
Dan


[1]
http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/request/cycle/RequestCycle.html#get()


On 15 October 2013 17:00, james agada <ok...@gmail.com> wrote:

> I will like to automatically capture the client details - IP address,
> Browser Agent of a client accessing my isis web app into an entity. Any
> ideas?
>