RE: Create custom UrlCodingStrategy
Maybe I should wait. I have solved it change the host file so that there will be different host to the same url. This way there is a new session every request to the host and I can read the header. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20935613.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Create custom UrlCodingStrategy
Assuming I understand what you're asking for... There is a solution, but that's about all I can say. I can say this because I managed somehow to pull it off. However, it took a lot of hacks to the wicket code, which I don't recommend to anybody. [Just to make sure I understand, let me explain what I did. I essentially have one Wicket instance that is able to manage several different applications (that would normally each have their own Wicket instance). Each app gets mounted on its own contextual path, so like you say below http://localhost/myapp1, http://localhost/myapp2, and so on.] I was told that v1.5 will have more customizable support, so I would suggest that you try to wait until then, unless you want to suffer mental trauma the way I have trying to live through this experience. ;-) Cheers, Dave > -Original Message- > From: Mathias P.W Nilsson [mailto:[EMAIL PROTECTED] > Sent: 3 December 2008 22:20 > To: users@wicket.apache.org > Subject: Re: Create custom UrlCodingStrategy > > > > Is there no solution to this? > > this is my app ( http://localhost/myapp ). All I want is to be > able to have > a customer name after myapp that follows in the application. > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p2 > 0812776.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
maybe this would be the time to apply my patch? :-) https://issues.apache.org/jira/browse/WICKET-1666 Am 03.12.2008 um 16:18 schrieb Mathias P.W Nilsson: Yes, thanks! This is what I have been trying to do but with no luck. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20814900.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Yes, thanks! This is what I have been trying to do but with no luck. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20814900.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Yes, then you have two ways to do that * implement your own RequestCycleProcessor * implement IRequestCodingStrategy and IRequestTargetMountsInfo or subclass WebRequestCodingStrategy (you can look on UrlCompressingWebCodingStrategy for a sample) Thats the way... Martin Mathias P.W Nilsson wrote: > > Problem is this > > setResponsePage(new LoginPage(moreParam); > > will not generate an url like http://localhost/myapp/customer1/login. > -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20814841.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Problem is this setResponsePage(new LoginPage(moreParam); will not generate an url like http://localhost/myapp/customer1/login. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20814520.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
ok simple DispatchingPage with Pageparameter DispatchingPage(Pageparameter params){ customerId = params.getIndexedParam(0); // not real syntax action = params.getIndexedParam(1); // not real syntax if(action.equals("login")){ PageParameter moreParam = new PageParameter(); moreParam.add("customerId", customerId); setResponsePage(new LoginPage(moreParam); }else if () } (not compiled code) Simple Dispatcher without overrides of Wicket-Core Components (URLCodingStrategy, RequestCycleProcessor)! If you want it more complex and transparent use your own implementation of AbstractRequestCycleProcessor (look at UrlCompressingWebRequestProcessor, or from http://code.google.com/p/brix-cms/ Brix BrixRequestCycleProcessor With Wicket you can easy customize all to your needs! I mean "easy" because you just implement some interface and replace the default wicket beheaviour by your own. No special feature of wicket, its just Java, or ? Martin Mathias P.W Nilsson wrote: > > Also you must handle the second parameter /login maybe by switching > different panels or redirect to another page ! > > How should this be done? I must keep the customer/customerId in every > page. What happens when redirecting? > -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20814227.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Also you must handle the second parameter /login maybe by switching different panels or redirect to another page ! How should this be done? I must keep the customer/customerId in every page. What happens when redirecting? -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20813923.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
hi, i have only a simple idea. implement a UrlcodingStrategy like IndexedParamUrlCodingStrategy, where the words after first / are parameter. if you use this e.g. mount(new CustomerParamUrlCodingStrategie("/customers",...)); you would able to get the customerID as PageParameter like from the IndexedParamUrlCodingStrategy. result should be that url: /customers// e.g. /customers/mycustomer1/login Also you must handle the second parameter /login maybe by switching different panels or redirect to another page ! is that what you want ? Martin Mathias P.W Nilsson wrote: > > Is there no solution to this? > > this is my app ( http://localhost/myapp ). All I want is to be able to > have a customer name after myapp that follows in the application. > -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20813165.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Is there no solution to this? this is my app ( http://localhost/myapp ). All I want is to be able to have a customer name after myapp that follows in the application. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20812776.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
To clarify things. It's something like in this post that I'm after. Get the customer from db See Dmitry Kandalov post http://www.nabble.com/mounting-large-number-of-url-td13972929.html#a14010271 http://www.nabble.com/mounting-large-number-of-url-td13972929.html#a14010271 -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20804484.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Thank you very much but I'm afraid I can't use apache as a front end due to the server setup. I need a way to do this in wicket. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20801209.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
[I'm sending again slightly modified because the first response got spam-blocked - dunno why - hopefully you're not getting this twice] I did something similar to this a while back and came up with the following solution. It may not be the best way, but what I do is extend WicketFilter and catch the path there, checking it for style, and then stripping the style part and passing it to Wicket. The problem with this solution is that you must then front-end the app with something like Apache, and do ProxyPass /app http://{your localhost : your port }/app/yourstyleforthisdomain - and do that for each domain. This wasn't a problem for me because I was already using Apache on the frontend. But it makes testing at regular old localhost port 8081 (or whatever port) practically impossible - you have to set up Apache on your test machines, too. Again, this was something I already do anyway, but I want to mention the drawbacks of this. Also notice that my ProxyPass passes from one folder depth to two - because in the filter I'm going to strip one folder depth off - this will become important with your cookie handling - so that they end up being set on the same path as you're really displaying the app. public class SiteDifferentiatingFilter extends WicketFilter { private static final Logger LOGGER = Logger.getLogger(SiteDifferentiatingFilter.class); @Override public String getRelativePath(HttpServletRequest request) { String path = super.getRelativePath(request); // Site is an enum of all sites for (Site site : Site.values()) { if (path.startsWith(site.getKey())) { if (RequestCycle.get() != null && Session.get() != null) { Session.get().setStyle(site.getStyleName()); // this is a variation of what I did... I actually created //my own site-aware session and set the Site on it so //that I could see what site they were on in their session //and I also used this to switch which application context //I was using so that I could have different service settings //per site. Here's the code I used if you're interested: /* ((SiteDifferentiatingWebSession) Session.get()).setSite(site); ApplicationContextFactory.getFactory().setSite(site); */ } path = path.substring(site.getKey().length()); if (path.startsWith("/")) { path = path.substring(1); } return path; } } return path; } } Hope this helps - it works, but it is probably not the cleanest solution out there. I've had it in production on this group of sites for quite a while and have not had a bug appear because of it. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Dec 2, 2008 at 7:09 AM, Mathias P.W Nilsson <[EMAIL PROTECTED]> wrote: > > Can url rewrite be used for this. I guess there are alot of people that want > custom made css and so on based on a url > > http://localhost/test/hello > http://localhost/test2/hello > > Can this be done with wicket? > > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20791796.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Oh sorry, I thought you want use it with mount. In this case you have to deal with IRequestCodingStrategy, not with IRequestTargetUrlCodingStrategy. Seems you can make your implementation which proxies given rcu (usually it will be WebRequestCodingStrategy or crypted), it passes encode/decode to it adding/cutting "variance" part of url. Then you have to override WebApplication.newRequestCycleProcessor WebRequestCycleProcessor.newRequestCodingStrategy and which will return your strategy. Maybe it's not best way to do it, but I don't see any better. 2008/12/2 Mathias P.W Nilsson <[EMAIL PROTECTED]>: > > Thanks! > > I will look at this and maybe come back on the subject. One problem that I > saw was that the request didn't get printed in the UrlCodingStrategy because > it was not mounted in init. Maybe I'm wrong about this and need to look it > over again. > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20794183.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- WBR, kan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Nope! I'm lost here. How can I create my own IRequestTargetUrlCodingStrategy when I need to add a mount path. The mount path is not the same as the page requested. Let me explain this more in detail. I wan't to mount Base.class to /login. But I need to access the /login thru /Customer1/login and /Customer2/login. I can't mount every possible customer reference in init(). -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20794194.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Thanks! I will look at this and maybe come back on the subject. One problem that I saw was that the request didn't get printed in the UrlCodingStrategy because it was not mounted in init. Maybe I'm wrong about this and need to look it over again. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20794183.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
RTFS :) If you look at any implementation, say BookmarkablePageRequestTargetUrlCodingStrategy.decode, you'll see how RequestParameters are turning in IRequestTarget, and encode does opposite - IRequestTarget is turning in url. You can set page a parameter (say "variation") from desired part of url and override in your page class the method: @Override public String getVariation() { return getPageParameters().getAsString("variation"); } It's just thoughts, I never tried it myself. :) 2008/12/2 Mathias P.W Nilsson <[EMAIL PROTECTED]>: > > Ok > > Is there any topic on UrlRewriteFilter and Wicket. I still need to set > variation and locale even when I use UrlRewriteFilter. > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20793471.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- WBR, kan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Ok Is there any topic on UrlRewriteFilter and Wicket. I still need to set variation and locale even when I use UrlRewriteFilter. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20793471.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
I only afraid, you cannot mount to "root". So, it will be "http://localhost/company/edgesoft/something";, "http://localhost/company/another/something"; Maybe easier and much more flexible for you will be UrlRewriteFilter. 2008/12/2 kan <[EMAIL PROTECTED]>: > Basically, just implement IRequestTargetUrlCodingStrategy. :) > What is precise question? > > 2008/11/24 Mathias P.W Nilsson <[EMAIL PROTECTED]>: >> >> Hi, >> >> I need some info in how to create my own UrlCodingStrategy >> >> This is the preconditions. >> I have a database with 20 - 100 customers that needs to access this >> application. Every customer has it's own properties files and css variation. >> >> What I want is that let's say Edgesoft wants to use the application. Then >> the user will access >> http://localhost/app/edgesoft >> >> If I want to mount Base.class I do not want to do /edgesoft/base only base >> and the UrlCodingStrategy will handle the rest for me. Check if the customer >> exists, set variation and then continue with the request. >> >> An example. >> http://localhost/edgesoft/order/order/13 >> http://localhost/another/order/order/14 >> mount( MyStrategy( "/order/" , ); >> >> This should go to the exact same page but with different variation and >> properties. How can this be achieved. What classes do I need to subclass to >> make this happen? >> -- >> View this message in context: >> http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20660813.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > > -- > WBR, kan. > -- WBR, kan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Basically, just implement IRequestTargetUrlCodingStrategy. :) What is precise question? 2008/11/24 Mathias P.W Nilsson <[EMAIL PROTECTED]>: > > Hi, > > I need some info in how to create my own UrlCodingStrategy > > This is the preconditions. > I have a database with 20 - 100 customers that needs to access this > application. Every customer has it's own properties files and css variation. > > What I want is that let's say Edgesoft wants to use the application. Then > the user will access > http://localhost/app/edgesoft > > If I want to mount Base.class I do not want to do /edgesoft/base only base > and the UrlCodingStrategy will handle the rest for me. Check if the customer > exists, set variation and then continue with the request. > > An example. > http://localhost/edgesoft/order/order/13 > http://localhost/another/order/order/14 > mount( MyStrategy( "/order/" , ); > > This should go to the exact same page but with different variation and > properties. How can this be achieved. What classes do I need to subclass to > make this happen? > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20660813.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- WBR, kan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
sorry for the misunderstanding, I never made a url coding strategy so I won't be able to help you, anybody else? On Tue, Dec 2, 2008 at 2:31 PM, Mathias P.W Nilsson <[EMAIL PROTECTED]> wrote: > > Nope this is not what I mean! > > What if I want to mount "/events" to Event.class and 100 customers needs to > use the same page with different variation? > > when the user attempts http://localhost/myapp/test/events/ ( test is the > customer name ) then it should invoke /events. > http://localhost/myapp/test2/events should invoke the same page but with the > test2 customers variation. I do not want to mount test2/events , test/events > since there could be 100 customers that uses this. ( imaging doing this for > all classes and all customers ) I need a way to check the customer name set > variation in the session. > > > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20792180.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- http://www.somatik.be Microsoft gives you windows, Linux gives you the whole house. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Nope this is not what I mean! What if I want to mount "/events" to Event.class and 100 customers needs to use the same page with different variation? when the user attempts http://localhost/myapp/test/events/ ( test is the customer name ) then it should invoke /events. http://localhost/myapp/test2/events should invoke the same page but with the test2 customers variation. I do not want to mount test2/events , test/events since there could be 100 customers that uses this. ( imaging doing this for all classes and all customers ) I need a way to check the customer name set variation in the session. -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20792180.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
> http://localhost/test/hello > http://localhost/test2/hello > > Can this be done with wicket? Yes, this is called mounting pages or resources see here: http://cwiki.apache.org/WICKET/url-coding-strategies.html http://www.javalobby.org/java/forums/t68753.html > > -- > View this message in context: > http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20791796.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- http://www.somatik.be Microsoft gives you windows, Linux gives you the whole house. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create custom UrlCodingStrategy
Can url rewrite be used for this. I guess there are alot of people that want custom made css and so on based on a url http://localhost/test/hello http://localhost/test2/hello Can this be done with wicket? -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20791796.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Create custom UrlCodingStrategy
Hi, I need some info in how to create my own UrlCodingStrategy This is the preconditions. I have a database with 20 - 100 customers that needs to access this application. Every customer has it's own properties files and css variation. What I want is that let's say Edgesoft wants to use the application. Then the user will access http://localhost/app/edgesoft If I want to mount Base.class I do not want to do /edgesoft/base only base and the UrlCodingStrategy will handle the rest for me. Check if the customer exists, set variation and then continue with the request. An example. http://localhost/edgesoft/order/order/13 http://localhost/another/order/order/14 mount( MyStrategy( "/order/" , ); This should go to the exact same page but with different variation and properties. How can this be achieved. What classes do I need to subclass to make this happen? -- View this message in context: http://www.nabble.com/Create-custom-UrlCodingStrategy-tp20660813p20660813.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]