Hi,

I'm porting a Wicket application from 1.4 to 6.6, and there is one piece of
code I cannot find how to port.

In short, I have a Link descendant class that is supposed to navigate to a
manually constructed URL within the Web application -
something like "/context_path/view_path/view?viewId=21938423423"

In Wicket 1.4, I created an IRequestTarget instance with necessary
RequestParameters.
In Wicket 6.6, all these classes are not what they were in 1.4, and I don't
find an alternative.

The question is - how is it possible to do navigation to a plain URL within
the same application in Wicket 6?

Wicket 1.4 original code:

public class CustomViewLink extends Link<ViewConfiguration>{
    @Override
    public void onClick() {
        // View links do not have a click handler.
        // Instead they are dispatched by the request handling servlet.
    }
    @Override
    protected CharSequence getURL() {
        String viewBaseURI = view.getViewBaseURI();

        RequestParameters requestParameters = new RequestParameters();
        requestParameters.setPath(viewBaseURI);
        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put( IViewWebDescriptor.VIEW_ID_PARAM, Long.toString(
view.getId() ) );
        requestParameters.setParameters(parameters);

        IRequestTarget target =
RequestCycle.get().getProcessor().resolve(RequestCycle.get(),
requestParameters);
        if(target == null){
            throw new WicketRuntimeException("Can't find request target for
ViewConfiguration.viewBaseURI: " + viewBaseURI);
        }
        return RequestCycle.get().urlFor(target);
    }
}

Thank you in advance,

Andrew

-- 
--
Andrew Schetinin

Reply via email to