We don't have convenience urlfor methods on request cycle any more,
however there is a convenience urlFor(Class, PageParameters) on
Component, so look there to see how it's done.

Instead of setRequestTarget you can do this

RequestCycle#scheduleRequestHandlerAfterCurrent(handler)

-Matej

2010/8/12 Major Péter <majorpe...@sch.bme.hu>:
> What's the substitute for RequestCycle#urlFor(Class, PageParameters) ?
>
> In 1.4 I was using RequestCycle#setRequestTarget(IResourceStream) and
> ResourceStreamRequestTarget to make dynamically generated PDF/CSV/etc
> files downloadable for users. How is that possible in 1.5-M1?
>
> Thanks,
> Peter
>
> 2010-08-12 12:11 keltezéssel, Martin Grigorov írta:
>> Good catch!
>>
>> There is no WebRequestCycle anymore. You'll need to extend RequestCycle now.
>> Override org.apache.wicket.Application.createRequestCycle(Request, Response)
>> to return your class.
>> The current entry point
>> is org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach().
>> For now you'll have to wrap this method with try/finally to simulate
>> onBefore/onEnd.
>>
>> We will discuss it and probably these two methods will be added again there
>> for M2.
>>
>> 2010/8/12 dzb <zenberg.d...@gmail.com>
>>
>>> Hi,
>>>
>>> It seems RequestCycle has a big change in 1.5-M1.
>>>
>>> How can I do things like below codes on 1.5 ?
>>>
>>> public class MyRequestCycle extends WebRequestCycle {
>>>
>>> �...@override
>>>  protected void onBeginRequest() {
>>>   super.onBeginRequest();
>>>   ...
>>>  }
>>>
>>> �...@override
>>>  protected void onEndRequest() {
>>>    ...
>>>    super.onEndRequest();
>>>  }
>>> }
>>>
>>> Where is the request pipline's entry?
>>>
>>> dzb,zenberg.d...@gmail.com
>>> 2010-08-12
>>> ----- Original Message -----
>>> From: Major_P閠er
>>> To: users
>>> Sent: 2010-08-12, 06:53:39
>>> Subject: Wicket 1.5-M1 migration experiences
>>>
>>>
>>> Hi,
>>>
>>> I've just tried to move our application to Wicket 1.5-M1, and I've faced
>>> with the following problems:
>>> * new HeaderContributor(new IHeaderContributor() {...} isn't working
>>> anymore, the constructor is gone.
>>> After looking into JavaDoc I've find out that HeaderContributor.forCss
>>> and other methods are deprecated in 1.4.9, but not in 1.5-M1, so wtf?
>>>
>>> * PageParameters#getAsLong and other helper methods are missing, instead
>>> we have PageParameters#getNamedParameter()#toLong and etc.
>>>
>>> There are Indexed Parameters and Named Parameters, what's the difference?
>>> based on the JavaDoc I would thought indexed parameter is like
>>> '/show/id/1' and named is 'show?id=1'
>>> if this is true, why isn't there simply a
>>> getParameterIDon'tCareAboutTheTypeOfIt function, if I want to support
>>> both of them?
>>>
>>> The deprecated PageParameters constructors are lacking JavaDoc
>>> deprecation note, or it could be a bit enhanced at least.
>>>
>>> * AjaxButton now has onError function, which needs to be implemented
>>> * IBehavior#unbind
>>>
>>> * In MyApplication I've had a method like this:
>>> @Override
>>>    public RequestCycle newRequestCycle(Request request, Response
>>> response) {
>>>        if
>>> (!Configuration.getEnvironment().equals(Environment.PRODUCTION)) {
>>>            return super.newRequestCycle(request, response);
>>>        } else {
>>>            return new WebRequestCycle(this, (WebRequest) request,
>>> (WebResponse) response) {
>>>
>>>               �...@override
>>>                public Page onRuntimeException(Page page,
>>> RuntimeException ex) {
>>>                    if (ex instanceof PageExpiredException) {
>>>                        return new PageExpiredError();
>>>                    }
>>>                    return new InternalServerError(page, ex);
>>>                }
>>>            };
>>>        }
>>>    }
>>>
>>> now newRequestCycle is gone, we have createRequestCycle, which is final
>>> and it uses RequestCycleProvider. so changing this to
>>>
>>> setRequestCycleProvider(new IRequestCycleProvider() {
>>>
>>>           �...@override
>>>            public RequestCycle get(RequestCycleContext context) {
>>>                if
>>> (!Configuration.getEnvironment().equals(Environment.PRODUCTION)) {
>>>                    return new RequestCycle(context);
>>>                } else {
>>>                    return new RequestCycle(context) {
>>>
>>>                       �...@override
>>>                        protected IRequestHandler
>>> handleException(Exception e) {
>>>                            //etc
>>>                        }
>>>                    };
>>>                }
>>>            }
>>>        });
>>>
>>> should have the same behavior, or??
>>>
>>> Also I couldn't find a substitute for this:
>>>
>>> http://wicket.apache.org/apidocs/1.4/org/apache/wicket/protocol/http/WebApplication.html#mount(java.lang.String,%20org.apache.wicket.util.lang.PackageName)
>>> and also for HybridUrlCodingStrategy. Or is hybrid even needed anymore?
>>> Where can I find out more about these new requestmapper stuff? (Please
>>> don't say in wicket-examples, I'm looking for a doc, like
>>> https://cwiki.apache.org/confluence/display/WICKET/URL+Coding+Strategies )
>>>
>>> Thanks
>>>
>>> Regards,
>>> Peter
>
> ---------------------------------------------------------------------
> 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

Reply via email to