Re: how to get HttpServletRequest in wicket 1.5

2011-09-21 Thread nhsoft.yhw
Q5:my code for wicket1.5 as follow:

final Link lnkExport = new Link("export") {

public void onClick() {
Shop shop = shopService.read(shopId);
// temporarily switch off paging of results
final JxlExportShop jxlExportShop = new 
JxlExportShop(shop);

getRequestCycle().scheduleRequestHandlerAfterCurrent(new
IRequestHandler() {

@Override
public void detach(IRequestCycle 
requestCycle) {
}

@Override
public void respond(IRequestCycle 
requestCycle) {
try {
Shop shop = 
shopService.read(shopId);
String fileName = 
shop.getShopCity() + "_" + shop.getShopName() +
"_version_" + shop.getShopVersion() + ".xls";
fileName = new 
String(fileName.getBytes("gb2312"), "iso8859-1");

HttpServletResponse 
httpResponse =
(HttpServletResponse)requestCycle.getResponse().getContainerResponse();

httpResponse.setContentType( "application/vnd.ms-excel" );

httpResponse.setHeader("Content-disposition", "attachment; filename="
+ fileName );

jxlExportShop.exportToExcel(httpResponse.getOutputStream());
} catch (Exception e) {
throw new 
RuntimeException(e);
}
}
});
}
};  

-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3832287.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 wicket 1.5

2011-09-14 Thread Igor Vaynberg
and by complain he means a compile error...

-igor


On Wed, Sep 14, 2011 at 4:37 AM, Martin Grigorov  wrote:
> Ah, yes.
> A child class which overrides the method and is "protected" will
> complain that visibility is reduced ...
> Have to wait for Wicket.next.
>
> On Wed, Sep 14, 2011 at 2:30 PM, Peter Ertl  wrote:
>> @Martin:
>>
>> yeah, switching from protected to public should at most yield a warning in 
>> an overloaded class. Igor didn't like it. Maybe my English confused him and 
>> he thought about going from public to protected?!
>>
>> Would be great if we could change this in 1.5.
>>
>> What you think?
>>
>>
>>
>> Am 14.09.2011 um 13:17 schrieb Martin Grigorov:
>>
>>> On Wed, Sep 14, 2011 at 2:07 PM, Peter Ertl  wrote:

 Am 14.09.2011 um 09:32 schrieb nhsoft.yhw:

> inputStream = 
> packageResource.getCacheableResourceStream().getInputStream();

 I think this needs some clarification...

 PackageResource has these methods for getting a stream:

  (1)  protected IResourceStream getResourceStream()

 and

  (2) public IResourceStream getCacheableResourceStream()

 the intention is:

 -  (1) locates the default resource without taking any client preferences 
 into account.

 -  (2) is there to get a client-specific resoure stream that is supposed 
 to be immutable for the lifetime of the application and should be cached.

 the sooner (1) locates the resource stream based on

 - anchor class
 - name
 - locale
 - style
 - variation

 as specified in the constructor(!) of PackageResource. So for example when 
 using CssResourceReference (which is a descendant of 
 PackageResourceReference) like that in your page:

  private static final PackageResourceReference CSS = new 
 CssResourceReference(MyPage.class, "mycss", Locale.ENGLISH, "style1", 
 "variation1");

 these parameters will be applied to PackageResource when resolving the 
 reference and yield:

 - anchor class = MyPage.class
 - name = "mycss"
 - locale = Locale.ENGLISH
 - style = "style1"
 - variation = "variation1"

 and getResourceStream (1) will locate the resource based on the above 
 criteria.

 In contrary getCacheableResourceStream (2) will override the values for 
 locale and style with the values of the current session.

 - anchor class = MyPage.class
 - name = "mycss"
 - Session.getLocale() if not empty, otherwise Locale.ENGLISH
 - Session.getStyle() if not empty, otherwise "style1"
 - variation = "variation1"

 So (1) returns the default stream and (2) returns the stream fitting the 
 client's preferences.

 Unfortunately I realized it too late that (1) which was 'public' in 1.4 is 
 now 'protected' in 1.5. It's too late to change this without breaking the 
 API. This can change in 1.6 to 'public' again unless things change 
 completely (don't think so :-)
>>> I think 'protected' -> 'public' is not a problem.
>>> The opposite ('public' -> 'protected') is not allowed in 1.5.x.

 So In case you need to access (1) but miss the 'public' I can suggest the 
 following workaround / kludge.

 public class MyPackageResource extends PackageResource
 {
        public MyPackageResource(Class scope, String name, Locale 
 locale, String style,
                String variation)
        {
                super(scope, name, locale, style, variation);
        }

        // change access to public here
        public IResourceStream getResourceStream()
        {
                return super.getResourceStream();
        }
 }

 If you only need to open a stream of a package located file use this 
 instead - no need for PackageResource in that case at all:

  InputStream is = MyPage.class.getResourceAsStream("mycss.css")


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


>>>
>>>
>>>
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.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
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> -
> To unsubscribe, e-mail: user

Re: how to get HttpServletRequest in wicket 1.5

2011-09-14 Thread Martin Grigorov
Ah, yes.
A child class which overrides the method and is "protected" will
complain that visibility is reduced ...
Have to wait for Wicket.next.

On Wed, Sep 14, 2011 at 2:30 PM, Peter Ertl  wrote:
> @Martin:
>
> yeah, switching from protected to public should at most yield a warning in an 
> overloaded class. Igor didn't like it. Maybe my English confused him and he 
> thought about going from public to protected?!
>
> Would be great if we could change this in 1.5.
>
> What you think?
>
>
>
> Am 14.09.2011 um 13:17 schrieb Martin Grigorov:
>
>> On Wed, Sep 14, 2011 at 2:07 PM, Peter Ertl  wrote:
>>>
>>> Am 14.09.2011 um 09:32 schrieb nhsoft.yhw:
>>>
 inputStream = 
 packageResource.getCacheableResourceStream().getInputStream();
>>>
>>> I think this needs some clarification...
>>>
>>> PackageResource has these methods for getting a stream:
>>>
>>>  (1)  protected IResourceStream getResourceStream()
>>>
>>> and
>>>
>>>  (2) public IResourceStream getCacheableResourceStream()
>>>
>>> the intention is:
>>>
>>> -  (1) locates the default resource without taking any client preferences 
>>> into account.
>>>
>>> -  (2) is there to get a client-specific resoure stream that is supposed to 
>>> be immutable for the lifetime of the application and should be cached.
>>>
>>> the sooner (1) locates the resource stream based on
>>>
>>> - anchor class
>>> - name
>>> - locale
>>> - style
>>> - variation
>>>
>>> as specified in the constructor(!) of PackageResource. So for example when 
>>> using CssResourceReference (which is a descendant of 
>>> PackageResourceReference) like that in your page:
>>>
>>>  private static final PackageResourceReference CSS = new 
>>> CssResourceReference(MyPage.class, "mycss", Locale.ENGLISH, "style1", 
>>> "variation1");
>>>
>>> these parameters will be applied to PackageResource when resolving the 
>>> reference and yield:
>>>
>>> - anchor class = MyPage.class
>>> - name = "mycss"
>>> - locale = Locale.ENGLISH
>>> - style = "style1"
>>> - variation = "variation1"
>>>
>>> and getResourceStream (1) will locate the resource based on the above 
>>> criteria.
>>>
>>> In contrary getCacheableResourceStream (2) will override the values for 
>>> locale and style with the values of the current session.
>>>
>>> - anchor class = MyPage.class
>>> - name = "mycss"
>>> - Session.getLocale() if not empty, otherwise Locale.ENGLISH
>>> - Session.getStyle() if not empty, otherwise "style1"
>>> - variation = "variation1"
>>>
>>> So (1) returns the default stream and (2) returns the stream fitting the 
>>> client's preferences.
>>>
>>> Unfortunately I realized it too late that (1) which was 'public' in 1.4 is 
>>> now 'protected' in 1.5. It's too late to change this without breaking the 
>>> API. This can change in 1.6 to 'public' again unless things change 
>>> completely (don't think so :-)
>> I think 'protected' -> 'public' is not a problem.
>> The opposite ('public' -> 'protected') is not allowed in 1.5.x.
>>>
>>> So In case you need to access (1) but miss the 'public' I can suggest the 
>>> following workaround / kludge.
>>>
>>> public class MyPackageResource extends PackageResource
>>> {
>>>        public MyPackageResource(Class scope, String name, Locale locale, 
>>> String style,
>>>                String variation)
>>>        {
>>>                super(scope, name, locale, style, variation);
>>>        }
>>>
>>>        // change access to public here
>>>        public IResourceStream getResourceStream()
>>>        {
>>>                return super.getResourceStream();
>>>        }
>>> }
>>>
>>> If you only need to open a stream of a package located file use this 
>>> instead - no need for PackageResource in that case at all:
>>>
>>>  InputStream is = MyPage.class.getResourceAsStream("mycss.css")
>>>
>>>
>>> Cheers
>>> Peter
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-14 Thread Peter Ertl
@Martin:

yeah, switching from protected to public should at most yield a warning in an 
overloaded class. Igor didn't like it. Maybe my English confused him and he 
thought about going from public to protected?!

Would be great if we could change this in 1.5.

What you think?



Am 14.09.2011 um 13:17 schrieb Martin Grigorov:

> On Wed, Sep 14, 2011 at 2:07 PM, Peter Ertl  wrote:
>> 
>> Am 14.09.2011 um 09:32 schrieb nhsoft.yhw:
>> 
>>> inputStream = packageResource.getCacheableResourceStream().getInputStream();
>> 
>> I think this needs some clarification...
>> 
>> PackageResource has these methods for getting a stream:
>> 
>>  (1)  protected IResourceStream getResourceStream()
>> 
>> and
>> 
>>  (2) public IResourceStream getCacheableResourceStream()
>> 
>> the intention is:
>> 
>> -  (1) locates the default resource without taking any client preferences 
>> into account.
>> 
>> -  (2) is there to get a client-specific resoure stream that is supposed to 
>> be immutable for the lifetime of the application and should be cached.
>> 
>> the sooner (1) locates the resource stream based on
>> 
>> - anchor class
>> - name
>> - locale
>> - style
>> - variation
>> 
>> as specified in the constructor(!) of PackageResource. So for example when 
>> using CssResourceReference (which is a descendant of 
>> PackageResourceReference) like that in your page:
>> 
>>  private static final PackageResourceReference CSS = new 
>> CssResourceReference(MyPage.class, "mycss", Locale.ENGLISH, "style1", 
>> "variation1");
>> 
>> these parameters will be applied to PackageResource when resolving the 
>> reference and yield:
>> 
>> - anchor class = MyPage.class
>> - name = "mycss"
>> - locale = Locale.ENGLISH
>> - style = "style1"
>> - variation = "variation1"
>> 
>> and getResourceStream (1) will locate the resource based on the above 
>> criteria.
>> 
>> In contrary getCacheableResourceStream (2) will override the values for 
>> locale and style with the values of the current session.
>> 
>> - anchor class = MyPage.class
>> - name = "mycss"
>> - Session.getLocale() if not empty, otherwise Locale.ENGLISH
>> - Session.getStyle() if not empty, otherwise "style1"
>> - variation = "variation1"
>> 
>> So (1) returns the default stream and (2) returns the stream fitting the 
>> client's preferences.
>> 
>> Unfortunately I realized it too late that (1) which was 'public' in 1.4 is 
>> now 'protected' in 1.5. It's too late to change this without breaking the 
>> API. This can change in 1.6 to 'public' again unless things change 
>> completely (don't think so :-)
> I think 'protected' -> 'public' is not a problem.
> The opposite ('public' -> 'protected') is not allowed in 1.5.x.
>> 
>> So In case you need to access (1) but miss the 'public' I can suggest the 
>> following workaround / kludge.
>> 
>> public class MyPackageResource extends PackageResource
>> {
>>public MyPackageResource(Class scope, String name, Locale locale, 
>> String style,
>>String variation)
>>{
>>super(scope, name, locale, style, variation);
>>}
>> 
>>// change access to public here
>>public IResourceStream getResourceStream()
>>{
>>return super.getResourceStream();
>>}
>> }
>> 
>> If you only need to open a stream of a package located file use this instead 
>> - no need for PackageResource in that case at all:
>> 
>>  InputStream is = MyPage.class.getResourceAsStream("mycss.css")
>> 
>> 
>> Cheers
>> Peter
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.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 wicket 1.5

2011-09-14 Thread Martin Grigorov
On Wed, Sep 14, 2011 at 2:07 PM, Peter Ertl  wrote:
>
> Am 14.09.2011 um 09:32 schrieb nhsoft.yhw:
>
>> inputStream = packageResource.getCacheableResourceStream().getInputStream();
>
> I think this needs some clarification...
>
> PackageResource has these methods for getting a stream:
>
>  (1)  protected IResourceStream getResourceStream()
>
> and
>
>  (2) public IResourceStream getCacheableResourceStream()
>
> the intention is:
>
> -  (1) locates the default resource without taking any client preferences 
> into account.
>
> -  (2) is there to get a client-specific resoure stream that is supposed to 
> be immutable for the lifetime of the application and should be cached.
>
> the sooner (1) locates the resource stream based on
>
> - anchor class
> - name
> - locale
> - style
> - variation
>
> as specified in the constructor(!) of PackageResource. So for example when 
> using CssResourceReference (which is a descendant of 
> PackageResourceReference) like that in your page:
>
>  private static final PackageResourceReference CSS = new 
> CssResourceReference(MyPage.class, "mycss", Locale.ENGLISH, "style1", 
> "variation1");
>
> these parameters will be applied to PackageResource when resolving the 
> reference and yield:
>
> - anchor class = MyPage.class
> - name = "mycss"
> - locale = Locale.ENGLISH
> - style = "style1"
> - variation = "variation1"
>
> and getResourceStream (1) will locate the resource based on the above 
> criteria.
>
> In contrary getCacheableResourceStream (2) will override the values for 
> locale and style with the values of the current session.
>
> - anchor class = MyPage.class
> - name = "mycss"
> - Session.getLocale() if not empty, otherwise Locale.ENGLISH
> - Session.getStyle() if not empty, otherwise "style1"
> - variation = "variation1"
>
> So (1) returns the default stream and (2) returns the stream fitting the 
> client's preferences.
>
> Unfortunately I realized it too late that (1) which was 'public' in 1.4 is 
> now 'protected' in 1.5. It's too late to change this without breaking the 
> API. This can change in 1.6 to 'public' again unless things change completely 
> (don't think so :-)
I think 'protected' -> 'public' is not a problem.
The opposite ('public' -> 'protected') is not allowed in 1.5.x.
>
> So In case you need to access (1) but miss the 'public' I can suggest the 
> following workaround / kludge.
>
> public class MyPackageResource extends PackageResource
> {
>        public MyPackageResource(Class scope, String name, Locale locale, 
> String style,
>                String variation)
>        {
>                super(scope, name, locale, style, variation);
>        }
>
>        // change access to public here
>        public IResourceStream getResourceStream()
>        {
>                return super.getResourceStream();
>        }
> }
>
> If you only need to open a stream of a package located file use this instead 
> - no need for PackageResource in that case at all:
>
>  InputStream is = MyPage.class.getResourceAsStream("mycss.css")
>
>
> Cheers
> Peter
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-14 Thread Peter Ertl

Am 14.09.2011 um 09:32 schrieb nhsoft.yhw:

> inputStream = packageResource.getCacheableResourceStream().getInputStream();

I think this needs some clarification...

PackageResource has these methods for getting a stream:

 (1)  protected IResourceStream getResourceStream()

and 

 (2) public IResourceStream getCacheableResourceStream()

the intention is:

-  (1) locates the default resource without taking any client preferences into 
account.

-  (2) is there to get a client-specific resoure stream that is supposed to be 
immutable for the lifetime of the application and should be cached.

the sooner (1) locates the resource stream based on

- anchor class
- name
- locale
- style
- variation

as specified in the constructor(!) of PackageResource. So for example when 
using CssResourceReference (which is a descendant of PackageResourceReference) 
like that in your page:

  private static final PackageResourceReference CSS = new 
CssResourceReference(MyPage.class, "mycss", Locale.ENGLISH, "style1", 
"variation1");

these parameters will be applied to PackageResource when resolving the 
reference and yield:

- anchor class = MyPage.class
- name = "mycss"
- locale = Locale.ENGLISH
- style = "style1"
- variation = "variation1"

and getResourceStream (1) will locate the resource based on the above criteria.

In contrary getCacheableResourceStream (2) will override the values for locale 
and style with the values of the current session.

- anchor class = MyPage.class
- name = "mycss"
- Session.getLocale() if not empty, otherwise Locale.ENGLISH
- Session.getStyle() if not empty, otherwise "style1"
- variation = "variation1"

So (1) returns the default stream and (2) returns the stream fitting the 
client's preferences.

Unfortunately I realized it too late that (1) which was 'public' in 1.4 is now 
'protected' in 1.5. It's too late to change this without breaking the API. This 
can change in 1.6 to 'public' again unless things change completely (don't 
think so :-)

So In case you need to access (1) but miss the 'public' I can suggest the 
following workaround / kludge.

public class MyPackageResource extends PackageResource
{
public MyPackageResource(Class scope, String name, Locale locale, 
String style,
String variation)
{
super(scope, name, locale, style, variation);
}

// change access to public here
public IResourceStream getResourceStream()
{
return super.getResourceStream();
}
}

If you only need to open a stream of a package located file use this instead - 
no need for PackageResource in that case at all:

  InputStream is = MyPage.class.getResourceAsStream("mycss.css")


Cheers
Peter
-
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 wicket 1.5

2011-09-14 Thread Hielke Hoeve
Roger, thanks for the clarification.

Hielke

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: woensdag 14 september 2011 9:54
To: users@wicket.apache.org
Subject: Re: how to get HttpServletRequest in wicket 1.5

java.lang.Object org.apache.wicket.request.Response.getContainerResponse()
javax.servlet.http.HttpServletResponse
org.apache.wicket.protocol.http.servlet.ServletWebResponse.getContainerResponse()

JDK1.5+ covariant return type

On Wed, Sep 14, 2011 at 10:24 AM, Hielke Hoeve  wrote:
> Why was the return type of getContainerRequest() altered to Object? 
> Everyone is now casting the result to HttpServletRequest anyway. So 
> changing the api kind of defeats the purpose :)
>
> Hielke
>
> -Original Message-
> From: Martin Grigorov [mailto:mgrigo...@apache.org]
> Sent: donderdag 8 september 2011 11:36
> To: users@wicket.apache.org
> Subject: Re: how to get HttpServletRequest in wicket 1.5
>
> HttpServletRequest servletReq = (HttpServletRequest) 
> getRequest().getContainerRequest();
>
> On Thu, Sep 8, 2011 at 12:26 PM, nhsoft.yhw  wrote:
>> in wicket 1.4.x, the code like :
>>
>> HttpServletRequest request =
>> getWebRequestCycle().getWebRequest().getHttpServletRequest();
>>
>> but i don't know how to get HttpServletRequest  in wicket 1.5
>>
>>
>> -
>> http://www.517wm.com
>> 外卖订餐分享工具
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequ
>> e st-in-wicket-1-5-tp3798272p3798272.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
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-14 Thread Martin Grigorov
java.lang.Object org.apache.wicket.request.Response.getContainerResponse()
javax.servlet.http.HttpServletResponse
org.apache.wicket.protocol.http.servlet.ServletWebResponse.getContainerResponse()

JDK1.5+ covariant return type

On Wed, Sep 14, 2011 at 10:24 AM, Hielke Hoeve  wrote:
> Why was the return type of getContainerRequest() altered to Object? Everyone 
> is now casting the result to HttpServletRequest anyway. So changing the api 
> kind of defeats the purpose :)
>
> Hielke
>
> -Original Message-
> From: Martin Grigorov [mailto:mgrigo...@apache.org]
> Sent: donderdag 8 september 2011 11:36
> To: users@wicket.apache.org
> Subject: Re: how to get HttpServletRequest in wicket 1.5
>
> HttpServletRequest servletReq = (HttpServletRequest) 
> getRequest().getContainerRequest();
>
> On Thu, Sep 8, 2011 at 12:26 PM, nhsoft.yhw  wrote:
>> in wicket 1.4.x, the code like :
>>
>> HttpServletRequest request =
>> getWebRequestCycle().getWebRequest().getHttpServletRequest();
>>
>> but i don't know how to get HttpServletRequest  in wicket 1.5
>>
>>
>> -
>> http://www.517wm.com
>> 外卖订餐分享工具
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletReque
>> st-in-wicket-1-5-tp3798272p3798272.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
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-14 Thread nhsoft.yhw

nhsoft.yhw wrote:
> 
> Q7. 
> 
> how to get inputstream from ResourceReference object, here is code for
> wicket 1.4.x 
> inputStream =
> reference.getResource().getResourceStream().getInputStream(); 
> 
> but IResource interface has no getResourceStream() method in wicket 1.5.0 
> 

My solution :

PackageResource packageResource = (PackageResource)reference.getResource(); 
inputStream = packageResource.getCacheableResourceStream().getInputStream();

The above method is mainly to the PackageResource resources saved to the
database, so next time read from the database and display


-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3812014.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 wicket 1.5

2011-09-14 Thread Hielke Hoeve
Why was the return type of getContainerRequest() altered to Object? Everyone is 
now casting the result to HttpServletRequest anyway. So changing the api kind 
of defeats the purpose :)

Hielke

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: donderdag 8 september 2011 11:36
To: users@wicket.apache.org
Subject: Re: how to get HttpServletRequest in wicket 1.5

HttpServletRequest servletReq = (HttpServletRequest) 
getRequest().getContainerRequest();

On Thu, Sep 8, 2011 at 12:26 PM, nhsoft.yhw  wrote:
> in wicket 1.4.x, the code like :
>
> HttpServletRequest request =
> getWebRequestCycle().getWebRequest().getHttpServletRequest();
>
> but i don't know how to get HttpServletRequest  in wicket 1.5
>
>
> -
> http://www.517wm.com
> 外卖订餐分享工具
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletReque
> st-in-wicket-1-5-tp3798272p3798272.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
>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-09 Thread nhsoft.yhw
Q9.

i found that modalwindow has some problem for firefox browse after upgrading
to wicket 1.5.

firefox version 6.0.1, modalwindow can not display when click open
modalwindow link, but when i switch firefox's private browsing mode, it
works .


Chrome, IE8, Safari is ok.


-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3800998.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 wicket 1.5

2011-09-08 Thread nhsoft.yhw
Q7.

how to get inputstream from ResourceReference object, here is code for
wicket 1.4.x
inputStream = reference.getResource().getResourceStream().getInputStream();

but IResource interface has no getResourceStream() method in wicket 1.5.0

-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3800619.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 wicket 1.5

2011-09-08 Thread Martin Grigorov
On Thu, Sep 8, 2011 at 3:24 PM, nhsoft.yhw  wrote:
> Migrate Question
>
> Q1:
> PackageResourceReference resRef = new
> PackageResourceReference(parent.getClass(), src);
> return (urlFor(resRef).toString());
>
> PageParameters is required for urlFor method, if why PageParameters is
> required.
just pass "new PageParameters()" or "null"
>
> Q2:
> Image imgThumbnail = new Image("thumbnailImage");
> imgThumbnail.add(new SimpleAttributeModifier("src",
> shopImageService.getThumbnailAbsoluteUrl(itemPhoto)));
>
> Image model object is required, how to code in wicket 1.5 if model is emtpy.
You don't need Image component. You can use WebComponent for that
>
> Q3:
> where LoopItem.getIteration() method
getIndex()
>
> Q4:
> how to redirect as follow code :
> getRequestCycle().setRequestTarget(new
> RedirectRequestTarget("/connect/qq/login"));
getRequestCycle().scheduleRequestHandlerAfterCurrent(new
RedirectRequestHandler())
>
> Q5:
> // EXCEL REPORT EXPORT
> final Link lnkExport = new Link("export") {
>
>        public void onClick() {
>                // temporarily switch off paging of results
>                final JxlExportOrder jxlExportOrder = new 
> JxlExportOrder(coOrder);
>                getRequestCycle().setRequestTarget(new IRequestTarget() {
>
>                        public void detach(RequestCycle requestCycle) {
>                                ...
>                        }
>
>                        public void respond(RequestCycle requestCycle) {
>                                
>                        }
>                });
>        }
> };
>
> IRequestTarget removed, which object replace?
IRequestHandler. See A4

Also take a look at the last 3 articles at http://wicketinaction.com.
They explain the new request handling.
>
>
> -
> http://www.517wm.com
> 外卖订餐分享工具
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798640.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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-08 Thread nhsoft.yhw
Migrate Question

Q1:
PackageResourceReference resRef = new
PackageResourceReference(parent.getClass(), src);
return (urlFor(resRef).toString()); 

PageParameters is required for urlFor method, if why PageParameters is
required.

Q2: 
Image imgThumbnail = new Image("thumbnailImage");
imgThumbnail.add(new SimpleAttributeModifier("src",
shopImageService.getThumbnailAbsoluteUrl(itemPhoto)));

Image model object is required, how to code in wicket 1.5 if model is emtpy.

Q3:
where LoopItem.getIteration() method

Q4:
how to redirect as follow code :
getRequestCycle().setRequestTarget(new
RedirectRequestTarget("/connect/qq/login")); 

Q5:
// EXCEL REPORT EXPORT
final Link lnkExport = new Link("export") {

public void onClick() {
// temporarily switch off paging of results 

final JxlExportOrder jxlExportOrder = new 
JxlExportOrder(coOrder);
getRequestCycle().setRequestTarget(new IRequestTarget() {

public void detach(RequestCycle requestCycle) {
...
}

public void respond(RequestCycle requestCycle) {

}
});
}
};

IRequestTarget removed, which object replace?


-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798640.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 wicket 1.5

2011-09-08 Thread Mike Mander

Sorry for posting the wrong one.
YOurs is
org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContainerRequest() 



Mike

in wicket 1.4.x, the code like :

HttpServletRequest request =
getWebRequestCycle().getWebRequest().getHttpServletRequest();   

but i don't know how to get HttpServletRequest  in wicket 1.5


-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798272.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 wicket 1.5

2011-09-08 Thread Mike Mander

Am 08.09.2011 11:26, schrieb nhsoft.yhw:

in wicket 1.4.x, the code like :

HttpServletRequest request =
getWebRequestCycle().getWebRequest().getHttpServletRequest();   

but i don't know how to get HttpServletRequest  in wicket 1.5


-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798272.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


Check migration guide 
(https://cwiki.apache.org/WICKET/migration-to-wicket-15.html).

All changed method / class names are provided

Yours is
((HttpServletRequest) getRequest().getContainerRequest())

Mike

-
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 wicket 1.5

2011-09-08 Thread Martin Grigorov
HttpServletRequest servletReq = (HttpServletRequest)
getRequest().getContainerRequest();

On Thu, Sep 8, 2011 at 12:26 PM, nhsoft.yhw  wrote:
> in wicket 1.4.x, the code like :
>
> HttpServletRequest request =
> getWebRequestCycle().getWebRequest().getHttpServletRequest();
>
> but i don't know how to get HttpServletRequest  in wicket 1.5
>
>
> -
> http://www.517wm.com
> 外卖订餐分享工具
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798272.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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.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 wicket 1.5

2011-09-08 Thread nhsoft.yhw
in wicket 1.4.x

getRequestCycle().setRequestTarget(new
RedirectRequestTarget("/connect/qq/login"));

how to code for wicket 1.5.0

-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798291.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 wicket 1.5

2011-09-08 Thread nhsoft.yhw
in wicket 1.4.x, the code like :

HttpServletRequest request =
getWebRequestCycle().getWebRequest().getHttpServletRequest();   

but i don't know how to get HttpServletRequest  in wicket 1.5


-
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-HttpServletRequest-in-wicket-1-5-tp3798272p3798272.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