You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Taag <sa...@hotmail.com> on 2012/04/17 15:22:13 UTC

remove /wicket in front of url Wicket 1.5

Hey, I'm haveing a problem one url. Is there a way to remove the /wicket that
is added to the url when this is run. The page opens up in a new window,
from the popup settings added to the link:

setResponsePage( new OwnWindowPage( object ) );

The url i get is ...wicket/page?5
I only want it like /page?5

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4564704.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Sam Zilverberg <sa...@gmail.com>.
I put the breakpoints in the right class this time and debugged.
I added a breakpoint on CompoundRequestMapper to see what handler each
mapper returns:
for (MapperWithScore mapperWithScore : list)
        {
            IRequestMapper mapper = mapperWithScore.getMapper();
            IRequestHandler handler = mapper.mapRequest(request);
            if (handler != null)
            {
                return handler;
            }
        }

When I don't mount my TestMapper everything works fine.
I see the MountedMapper for "/login" returning a handler and it's being
used.
When i Mount my TestMapper the MountedMapper returns a handler but it
doesn't seem to be used.
The handler from TestMapper is always used, it doesn't matter what score it
returns...
So I don't see anyway I can remove the "wicket" before "wicket/page?x" :(

Attached a quickstart...

On Thu, Jul 12, 2012 at 10:30 AM, Martin Grigorov <mg...@apache.org>wrote:

> On Wed, Jul 11, 2012 at 8:51 PM, samzilverberg <sa...@gmail.com>
> wrote:
> > I tried all kind of different values in my TestMapper : 1, 1000,
> > Integer.MAX_VALUE, -1000.
> > But none of them made any change.
> > I even put a break point in the MountMapper getCompatibilityScore method
> to
>
> I know the names are close and confusing ... Set the breakpoint in
> MountedMapper, not in MountMapper.
>
> > see what values it returns and ran in debug mode, but the app never
> breaks
> > there...
> >
> > Am I missing something obvious?
> >
> > This is how I'm adding the mapper
> > getRootRequestMapperAsCompound().add(new TestMapper());
>
> this is the same as: mount(new TestMapper())
>
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4650444.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: remove /wicket in front of url Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Jul 11, 2012 at 8:51 PM, samzilverberg <sa...@gmail.com> wrote:
> I tried all kind of different values in my TestMapper : 1, 1000,
> Integer.MAX_VALUE, -1000.
> But none of them made any change.
> I even put a break point in the MountMapper getCompatibilityScore method to

I know the names are close and confusing ... Set the breakpoint in
MountedMapper, not in MountMapper.

> see what values it returns and ran in debug mode, but the app never breaks
> there...
>
> Am I missing something obvious?
>
> This is how I'm adding the mapper
> getRootRequestMapperAsCompound().add(new TestMapper());

this is the same as: mount(new TestMapper())

>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4650444.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: remove /wicket in front of url Wicket 1.5

Posted by samzilverberg <sa...@gmail.com>.
I tried all kind of different values in my TestMapper : 1, 1000,
Integer.MAX_VALUE, -1000.
But none of them made any change.
I even put a break point in the MountMapper getCompatibilityScore method to
see what values it returns and ran in debug mode, but the app never breaks
there...

Am I missing something obvious?

This is how I'm adding the mapper
getRootRequestMapperAsCompound().add(new TestMapper());

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4650444.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You need to return a proper value for its #getCompatibilityScore().
The returned value should be smaller than the ones returned by
MountedMapper (mounted pages) and bigger than PageInstanceMapper's
one.

On Wed, Jul 11, 2012 at 3:28 PM, samzilverberg <sa...@gmail.com> wrote:
> I'm interested in the complex options you mentioned:
>
> Martin Grigorov-4 wrote
>>
>> More complex: see PageInstanceMapper and create your own that does the
>> same job but uses less segments for the url.
>>
> I created a mapper which does not add the extra namespace segment in:
>  public Url mapHandler(IRequestHandler requestHandler)
> and doesn't check the namespace in the method:
> private boolean matches(final Url url)
>
> But I'm having a hard time replacing the original PageInstanceMapper with
> this one.
> In WicketApplicatin - I tried
> getRootRequestMapperAsCompound().add(new TestMapper());
> and then every page was encoded with the given mapper, even mounted
> bookmarkable pages that should use their mount path.
> I tried
> setRootRequestMapper(new TestMapper());
> And just got an lots of 404 exception.
>
> How can I replace the original PageInstanceMapper with my own?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4650439.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: remove /wicket in front of url Wicket 1.5

Posted by samzilverberg <sa...@gmail.com>.
I'm interested in the complex options you mentioned:

Martin Grigorov-4 wrote
> 
> More complex: see PageInstanceMapper and create your own that does the
> same job but uses less segments for the url. 
> 
I created a mapper which does not add the extra namespace segment in:
 public Url mapHandler(IRequestHandler requestHandler)
and doesn't check the namespace in the method:
private boolean matches(final Url url)

But I'm having a hard time replacing the original PageInstanceMapper with
this one.
In WicketApplicatin - I tried 
getRootRequestMapperAsCompound().add(new TestMapper());
and then every page was encoded with the given mapper, even mounted
bookmarkable pages that should use their mount path.
I tried
setRootRequestMapper(new TestMapper());
And just got an lots of 404 exception.

How can I replace the original PageInstanceMapper with my own?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4650439.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
In YourApp class:

public IMapperContext newMapperContext() {
   return new MyMapperContext();
}

MyMapperContext.java:
class MyMapperContext extends DefaultMapperContext {
   @Override
   public String getNamespace() { return "mine"; }
}

On Tue, Apr 17, 2012 at 4:50 PM, Taag <sa...@hotmail.com> wrote:
> The easy one. I only need this for a popupwindow that I want to change the
> path on. from /wicket/.. to /..
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4564787.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Taag <sa...@hotmail.com>.
The easy one. I only need this for a popupwindow that I want to change the
path on. from /wicket/.. to /..

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4564787.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Apr 17, 2012 at 4:40 PM, Taag <sa...@hotmail.com> wrote:
> Maby a dumb question, but i can't seem to find the right place to do this.
> And do i need a prefix? Is there a code example with this? =)

To do which option ?

>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4564757.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Taag <sa...@hotmail.com>.
Maby a dumb question, but i can't seem to find the right place to do this.
And do i need a prefix? Is there a code example with this? =)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4564757.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: remove /wicket in front of url Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Easy solution: replace 'wicket' with 'myOwnPrefix' by registering
custom IMapperContext by overriding Application#newMapperContext()
method

More complex: see PageInstanceMapper and create your own that does the
same job but uses less segments for the url.

On Tue, Apr 17, 2012 at 4:22 PM, Taag <sa...@hotmail.com> wrote:
> Hey, I'm haveing a problem one url. Is there a way to remove the /wicket that
> is added to the url when this is run. The page opens up in a new window,
> from the popup settings added to the link:
>
> setResponsePage( new OwnWindowPage( object ) );
>
> The url i get is ...wicket/page?5
> I only want it like /page?5
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/remove-wicket-in-front-of-url-Wicket-1-5-tp4564704p4564704.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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