Re: how to get HttpServletRequest in My Application class

2012-08-13 Thread Joachim Schrod
wicket user wrote:
> 
> I need to get the HttpServletRequest  object in My Application class. In the
> WebPage we can get from 
> 
> ((HttpServletRequest) ((ServletWebRequest)
> getRequest()).getContainerRequest())
> 
> but its not working in Application class.

I'm new to Wicket, but it seems obvious that this is impossible.

The application object exists outside of resp. independent of any
servlet requests. Only Web pages and their components are
concercened with HTTP requests, and thus only they have access.

If you want to store or access something from a request in your
application object -- which is a singleton that's independent from
any request and any session, then there's probably something wrong
with your design.

Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



RE: how to get HttpServletRequest in My Application class

2012-08-13 Thread Paul Bors
BTW, if you get a NPE on RequestCycle.get() then you most likely place this
code outside a Wicket Component like a Page.

Try moving it to a page first and see if you grab a reference to the request
object. If you do, then pass it as a parameter to your other method/class.

For older version of Wicket < 1.5.x see:
https://cwiki.apache.org/WICKET/request-cycle-and-request-cycle-processor.ht
ml

For newer version see:
https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html

~ Thank you,
  Paul Bors

-Original Message-
From: Paul Bors [mailto:p...@bors.ws] 
Sent: Monday, August 13, 2012 1:18 PM
To: users@wicket.apache.org
Subject: RE: how to get HttpServletRequest in My Application class

For your reference also see:
https://cwiki.apache.org/WICKET/getting-a-url-for-display.html

~ Thank you,
  Paul Bors

-Original Message-
From: wicket user [mailto:samd...@live.com] 
Sent: Monday, August 13, 2012 1:07 PM
To: users@wicket.apache.org
Subject: Re: how to get HttpServletRequest in My Application class

I am getting java.lang.NullPointerException
((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest() 
.  




--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-
My-Application-class-tp4651189p4651196.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



RE: how to get HttpServletRequest in My Application class

2012-08-13 Thread Paul Bors
For your reference also see:
https://cwiki.apache.org/WICKET/getting-a-url-for-display.html

~ Thank you,
  Paul Bors

-Original Message-
From: wicket user [mailto:samd...@live.com] 
Sent: Monday, August 13, 2012 1:07 PM
To: users@wicket.apache.org
Subject: Re: how to get HttpServletRequest in My Application class

I am getting java.lang.NullPointerException
((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest() 
.  




--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-
My-Application-class-tp4651189p4651196.html
Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: how to get HttpServletRequest in My Application class

2012-08-13 Thread wicket user
I am getting java.lang.NullPointerException
((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest() 
.  




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-My-Application-class-tp4651189p4651196.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: how to get HttpServletRequest in My Application class

2012-08-13 Thread Andrea Del Bene

Try this:

((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest()

Hi,

I need to get the HttpServletRequest  object in My Application class. In the
WebPage we can get from

((HttpServletRequest) ((ServletWebRequest)
getRequest()).getContainerRequest())

but its not working in Application class. Please suggest any ideas.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-My-Application-class-tp4651189.html
Sent from the Users forum mailing list archive at Nabble.com.

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





how to get HttpServletRequest in My Application class

2012-08-13 Thread wicket user
Hi,

I need to get the HttpServletRequest  object in My Application class. In the
WebPage we can get from 

((HttpServletRequest) ((ServletWebRequest)
getRequest()).getContainerRequest())

but its not working in Application class. Please suggest any ideas. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-My-Application-class-tp4651189.html
Sent from the Users forum mailing list archive at Nabble.com.

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