Re: How to handle urls for a White Label site
On Tue, 03 Jan 2012 13:00:42 -0200, captain_rhino wrote: Currently I have a very messy way of passing a context (the context indicates which prtner site it is from) through so as the PageRenderLinkTransformer can then use this context to dynamically create the url displayed to the user? I'd implement this in the LinkTransformer implementation. I couldn't check yours doing to Snipt not responding at the moment. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to handle urls for a White Label site
I got some basic rewriting of differrent partners working. One for Lloyds and one for Amex. Simple requests such as http://localhost:8080/makeaclaim/lloyds/test or http://localhost:8080/makeaclaim/amex/test got url rewrote to makeaclaim.partner.test So good so far. I have a Test class where the onSuccess method is looking to create a link. Currently I have a very messy way of passing a context (the context indicates which prtner site it is from) through so as the PageRenderLinkTransformer can then use this context to dynamically create the url displayed to the user? Is there an wasier way to do this? Any examples/comments would be much appreciated? http://snipt.org/tvpo9 PageRenderLinkTransformer http://snipt.org/tvpj8 Test.java -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5117073.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to handle urls for a White Label site
The following seems to work but I'm not an experieinced tapestry developer so comments are more than welcome. Thx for the advice so far. public Link transformPageRenderLink( Link defaultLink, PageRenderRequestParameters parameters) { if (defaultLink.getBasePath().contains("/partner")) { return defaultLink.copyWithBasePath("/makeaclaim/amex/testdetails"); } return defaultLink; } -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5094862.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to handle urls for a White Label site
I think i can see how to rewrite the incoming urls but the outgoing ones I seem to be stuck in a loop? Any suggestions? Am i coding correctly for outgoing urls please? import com.axa.cao.pages.partner.Test; import com.axa.cao.pages.partner.TestDetails; public class UrlLinkTransformer implements PageRenderLinkTransformer{ public PageRenderRequestParameters decodePageRenderRequest( Request request) { String path = request.getPath(); Map urlQuestionSetMap = new HashMap(); urlQuestionSetMap.put("/LLOYDS",1); urlQuestionSetMap.put("/AMEX",2); PageRenderRequestParameters pageRenderRequestParameters = null; for (Map.Entry entry : urlQuestionSetMap.entrySet()) { String key = entry.getKey(); Integer value = entry.getValue(); if (path.toUpperCase().contains(key)) { int keyIndex = path.toUpperCase().indexOf(key); String requestPath = path.substring(keyIndex+key.length()); pageRenderRequestParameters = new PageRenderRequestParameters("partner"+requestPath, new IssuerEventContext(value), true); return pageRenderRequestParameters; } } return null; } @Inject private PageRenderLinkSource renderLinkSource; @Inject private PageRenderLinkSource pageRenderLinkSource; public Link transformPageRenderLink( Link defaultLink, PageRenderRequestParameters parameters) { if (defaultLink.getBasePath().contains("/partner")) { return this.pageRenderLinkSource .createPageRenderLink(TestDetails.class); } return defaultLink; } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5094605.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to handle urls for a White Label site
On Wed, 21 Dec 2011 15:02:30 -0200, Cezary Biernacki wrote: In Tapestry 5.1 you need to contribute 'URLRewriteRule'-s to URLRewriter service. URLRewriter works in T5.2 too, but it is deprecated, Correct. so in Tapestry 5.2 and 5.3 you need to decorate ComponentEventLinkEncoder. Not correct. The old URL rewriting rule was replaced by the LinkTransformer API, so there's absolutely no need to decorate ComponentEventLinkEncoder yourself. More details here: http://blog.tapestry5.de/index.php/2010/09/06/new-url-rewriting-api/. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to handle urls for a White Label site
Hi, I have built a quite large white-label web app using Tapestry 5, and I am aware of other white-label Tapestry-based sites. I recommend following approach: - Encode partner information in URL for (nearly) all your pages, not only 'gateway' ones. I use 'http://example.com/PARTNER/PAGE'. - If necessary, put some pages that are not partner-dependent in a separate package. - Write code that performs URL rewriting for both incoming and outgoing links. In Tapestry 5.1 you need to contribute 'URLRewriteRule'-s to URLRewriter service. URLRewriter works in T5.2 too, but it is deprecated, so in Tapestry 5.2 and 5.3 you need to decorate ComponentEventLinkEncoder. Remember to not-rewrite requests to '/assets/' and your special package (or packages). - Your code after rewriting URL, should store information about partner as 'Request' attribute. It is important to NOT store that in the session, otherwise you would invite problems like e.g. loosing partner branding when the session expires. - Write a service that provides a nice interface for getting information about the current partner from the request. - If you feel especially adventurous and not afraid of Tapestry internals, you can even write an InjectionProvider and/or ComponentClassTransformWorker to automagically inject necessary data about partner into your pages and class. However, it is not recommended for beginners, and please do not overuse such mechanism, as it could make your code hard to understand for less Tapestry-proficient developers. Best regards, Cezary On Wed, Dec 21, 2011 at 1:08 PM, captain_rhino < graeme.kitc...@axa-travel-insurance.com> wrote: > A little xmas cheer to all! > > I'm in the process of creating a white label site to handle insurance > claims > for different partners. > > I'm looking for a general steer on how to handle the urls. > > The web page flow is generic for all the different white label partners. > > Currently external sites use the following links to access my site > www.mydomain.com/makeaclaim/whitelabelpartner1 > www.mydomain.com/makeaclaim/whitelabelpartner2 > > for a white label partner entering our site I use a > PageRenderLinkTransformer to then look at the that url and move them onto > to > the start of the journey and store where they came from in the session. > i.e. move them from > www.mydomain.com/makeaclaim/whitelabelpartner1 > to > www.mydomain.com/makeaclaim/claimdetails > > > My problem is if they bookmark the claimsdetails or any future page links I > have no idea where they came from. I have thought of passing a request > parameter through the entire journey but that seems a bit clunky. > Ideally i'd like to be to do the following > > www.mydomain.com/makeaclaim/whitelabelpartner1/claimdetails > www.mydomain.com/makeaclaim/whitelabelpartner1/personaldetails > > www.mydomain.com/makeaclaim/whitelabelpartner2/claimdetails > www.mydomain.com/makeaclaim/whitelabelpartner2/personaldetails > > where claim details is one single tapestry page not placed in two separate > packages as this needs to be configurable as new partners can be added all > the time. > > Is some kind of url masking to page actions available in tapestry? > i.e. > www.mydomain.com/makeaclaim/*/claimdetails > > Any ideas/Suggestions welcome. > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5091687.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: How to handle urls for a White Label site
1. You would want to use tapestry's URL rewriting support to remove "whitelabelpartnerX" from the URL before passing it down the request processing pipeline. 2. As your URLRewriterRule removes the whitelabelpartner from the url, it should push it onto the Environment so that it can be accessed later. This can be done by @inject-ing the Environment and calling environment.push(new WhitelabelPartner(partnerValueFromUrl)); 3. Your layout component (and other pages / components) can then use the @Environmental annotation to get the WhitelabelPartner instance from the stack and style the page / provide priviledges accordingly Links http://tapestry.apache.org/url-rewriting.html http://tapestry.apache.org/request-processing.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/Environment.html http://tapestry.apache.org/environmental-services.html On Wednesday, 21 December 2011, captain_rhino < graeme.kitc...@axa-travel-insurance.com> wrote: > A little xmas cheer to all! > > I'm in the process of creating a white label site to handle insurance claims > for different partners. > > I'm looking for a general steer on how to handle the urls. > > The web page flow is generic for all the different white label partners. > > Currently external sites use the following links to access my site > www.mydomain.com/makeaclaim/whitelabelpartner1 > www.mydomain.com/makeaclaim/whitelabelpartner2 > > for a white label partner entering our site I use a > PageRenderLinkTransformer to then look at the that url and move them onto to > the start of the journey and store where they came from in the session. > i.e. move them from > www.mydomain.com/makeaclaim/whitelabelpartner1 > to > www.mydomain.com/makeaclaim/claimdetails > > > My problem is if they bookmark the claimsdetails or any future page links I > have no idea where they came from. I have thought of passing a request > parameter through the entire journey but that seems a bit clunky. > Ideally i'd like to be to do the following > > www.mydomain.com/makeaclaim/whitelabelpartner1/claimdetails > www.mydomain.com/makeaclaim/whitelabelpartner1/personaldetails > > www.mydomain.com/makeaclaim/whitelabelpartner2/claimdetails > www.mydomain.com/makeaclaim/whitelabelpartner2/personaldetails > > where claim details is one single tapestry page not placed in two separate > packages as this needs to be configurable as new partners can be added all > the time. > > Is some kind of url masking to page actions available in tapestry? > i.e. > www.mydomain.com/makeaclaim/*/claimdetails > > Any ideas/Suggestions welcome. > > -- > View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5091687.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: How to handle urls for a White Label site
I have not used this but I think it does what you want. http://tynamo.org/tapestry-routing+guide -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5092265.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
How to handle urls for a White Label site
A little xmas cheer to all! I'm in the process of creating a white label site to handle insurance claims for different partners. I'm looking for a general steer on how to handle the urls. The web page flow is generic for all the different white label partners. Currently external sites use the following links to access my site www.mydomain.com/makeaclaim/whitelabelpartner1 www.mydomain.com/makeaclaim/whitelabelpartner2 for a white label partner entering our site I use a PageRenderLinkTransformer to then look at the that url and move them onto to the start of the journey and store where they came from in the session. i.e. move them from www.mydomain.com/makeaclaim/whitelabelpartner1 to www.mydomain.com/makeaclaim/claimdetails My problem is if they bookmark the claimsdetails or any future page links I have no idea where they came from. I have thought of passing a request parameter through the entire journey but that seems a bit clunky. Ideally i'd like to be to do the following www.mydomain.com/makeaclaim/whitelabelpartner1/claimdetails www.mydomain.com/makeaclaim/whitelabelpartner1/personaldetails www.mydomain.com/makeaclaim/whitelabelpartner2/claimdetails www.mydomain.com/makeaclaim/whitelabelpartner2/personaldetails where claim details is one single tapestry page not placed in two separate packages as this needs to be configurable as new partners can be added all the time. Is some kind of url masking to page actions available in tapestry? i.e. www.mydomain.com/makeaclaim/*/claimdetails Any ideas/Suggestions welcome. -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-handle-urls-for-a-White-Label-site-tp5091687p5091687.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org