Thank You very many  :)

I overide method newRequestCycleProcessor in my MockApplication and submit
works now for me:



    @Override
    protected IRequestCycleProcessor newRequestCycleProcessor() {
        IRequestCycleProcessor newRequestCycleProcessor =
super.newRequestCycleProcessor();

        return new UrlCompressingWebRequestProcessor() {

            @Override
            protected IRequestTarget resolveListenerInterfaceTarget(final
RequestCycle requestCycle,
                    final Page page, final String componentPath, String
interfaceName,
                    final RequestParameters requestParameters)
            {
                String pageRelativeComponentPath =
Strings.afterFirstPathComponent(componentPath,
                        Component.PATH_SEPARATOR);
                Component component = null;
                if (page instanceof WebPage &&
!"IResourceListener".equals(interfaceName))
                {
//                    ComponentAndInterface cai =
((WebPage)page).getUrlCompressor().getComponentAndInterfaceForUID(pageRelativeComponentPath);
                    UrlCompressor.ComponentAndInterface cai = null;
                    if (cai != null)
                    {
                        interfaceName = cai.getInterfaceName();
                        component = cai.getComponent();
                    }
                }

                requestParameters.setInterfaceName(interfaceName);

                if
(interfaceName.equals(IRedirectListener.INTERFACE.getName()))
                {
                    return new RedirectPageRequestTarget(page);
                }
                else if
(interfaceName.equals(INewBrowserWindowListener.INTERFACE.getName()))
                {
                    return
INewBrowserWindowListener.INTERFACE.newRequestTarget(page, page,
                            INewBrowserWindowListener.INTERFACE,
requestParameters);
                }
                else
                {
                    // Get the listener interface we need to call
                    final RequestListenerInterface listener =
RequestListenerInterface
                            .forName(interfaceName);
                    if (listener == null)
                    {
                        throw new WicketRuntimeException(
                                "Attempt to access unknown request listener
interface " + interfaceName);
                    }

                    // Get component
                    if (component == null)
                    {
                        if (Strings.isEmpty(pageRelativeComponentPath))
                        {
                            component = page;
                        }
                        else
                        {
                            component = page.get(pageRelativeComponentPath);
                        }
                    }

                    if (component == null)
                    {
                        // still null? that's not right
                        throw new WicketRuntimeException("cannot resolve
component with path '" +
                                pageRelativeComponentPath + "', listener " +
listener + " on page " + page);
                    }

                    if (!component.isEnableAllowed())
                    {
                        throw new UnauthorizedActionException(component,
Component.ENABLE);
                    }

                    // Ask the request listener interface object to create a
request
                    // target
                    return listener.newRequestTarget(page, component,
listener, requestParameters);
                }
            }
        };
    }

Reply via email to