Here's what I propose to do: 1) Add methods to RequestContext for getting the request scheme, server, URL and port and modify code (in Gesture and in Shell) to use it (OOP side note: look how few places!) 2) Define an interface, IRequestDecoder, that given an HttpServletRequest, provides these values. 3) Define a DefaultRequestDecoder that simply pulls the values from the HttpServletRequest. 4) Create an AppacheRequestDecoder (possibly in the contrib library) that handles decoding when using Apache in this way. 5) Change RequestContext to look for an extension in the application specification with the name "net.sf.tapestry.request-decoder" and use it instead of the DefaultRequestDecoder if it exists.
This gives us our first good use for extensions. -- [EMAIL PROTECTED] http://tapestry.sf.net > Hi, > > the solution I sent you was not a good solution. The configuration of the > apache was ok, but the changes in Shell weren't good. This worked only with > Apache 1.3.20. Later we tried Apache 1.3.23 and Apache 2.0 and found out > that this solution does not work, because then the apache host is not in > the 'Referer'-field of the header anymore. Instead you find it in the > 'Via'-field', which you have to parse to find out the apache server url. > What I suggest now is to delegat the building of the base url from the > Shell to the SimpleEngine or it's subclass. In SimpleEngine it could be the > way you wrote it. In my subclass of the engine I have now implements > buildBaseURL like this: > > public String buildBaseURL(IRequestCycle cycle) { > String url; > RequestContext context = cycle.getRequestContext(); > String via = context.getRequest().getHeader("Via"); > if (via == null) > url = super.buildBaseURL(cycle); > else { > int startIndexOfHost = via.indexOf(" ") + 1; > int endIndexOfHost = via.indexOf(" ", startIndexOfHost); > url = > "https://" > + via.substring(startIndexOfHost, > endIndexOfHost) > + cycle.getEngine().getServletPath(); > } > DaedalosLibraryServlet.category.debug("URL: " + url); > return url; > } > > This is working, but I don't like it very much, it is quite ugly. Because I > could not found out whether the url of the apache server is https or http, > I hard coded it here. This code does not work without https. So it is just > a solution for my application and my environement. Maybe there is no > genereal solution. Therefore I'd like to have it in the engine class to be > able to adjust it to my requirements. Then it would be possible to read the > base url out of a configuration file for example. > > Best regards, > > Christian Noack > > > Daedalos Consulting GmbH > www.daedalos.com > [EMAIL PROTECTED] > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Tapestry-developer mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/tapestry-developer ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Tapestry-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/tapestry-developer
