You can use a single servlet filter instead of a servlet per destination jsp page. Keep in mind that if you choose to use a RequestDispatcher.forward the user's browser url remains the same which is what you probably want (no redirect is sent back to the browser, instead the request is internally routed to the jsp and that is returned to the user).
If you use the .forward approach, you can return agent specific results to the user that may be beyond just window.width dependent, HD for example. But if you use that approach, you'll need to be careful about urls because you might mangle your SEO. Deeply linked urls should remain the same to a client. style sheets and javascript could be condensed and pre-embedded in your pages ahead of time to remove those as links, but image links would require a little work. There are several ways to use a single url for the image links which tend to be thwarted by IE7 or IE8 browsers (scalable graphics using SVG, for example). You could avoid image links by using data URIs, but again, IE browsers don't support that earlier than v 9. Get clever w/ image using sprites? (disadvantage only for mobile devices as they will be downloading more than they need). If your image links do not need to be part of the SEO, then you could use dynamically loaded images in your pages w/ ajax w/ a failover plan and then your page will not have a conflicting image url in it's indexed links. And for media which you would definitely want to be findable as part of your SEO such as videos or music, the filter approach would work fine to return device dependent response/stream from a request to the same url. If instead you choose to use the two pseudo-site pattern as in the first posts above: /site/ /site/mobile/ and redirect the user to the site or mobile landing page upon their first visit, then you can include a <link rel="canonical" in your main site to keep the SEO in good shape. (you just can't use your landing page that includes a redirect for advertising destinations.) On Oct 7, 7:56 am, WillSpecht <willspe...@gmail.com> wrote: > I was looking for an easy way to do this once and make it work for the > whole site. Now I realize I'm going to have to go into every servlet > and have it choose which jsp to display. > > On Oct 6, 6:43 pm, WillSpecht <willspe...@gmail.com> wrote: > > > > > > > > > My real problem is that I can't figgure out how to show war/mobile/ > > home.jsp when a user types in m.mydomain.com/home. > > > On Oct 6, 5:55 pm, Nichole <nichole.k...@gmail.com> wrote: > > > > I should add that my simplified model above uses the given static > > > examples without a redirect to a /site/mobile. > > > By 'design for all viewports' I mean design to use floating right divs > > > when possible... > > > > On Oct 6, 2:50 pm, Nichole <nichole.k...@gmail.com> wrote: > > > > > I'm not using a pseudo-2-site model myself anymore as I recently > > > > simplified my structure. > > > > For SDK 1.5.2 I had errors upon submitting for deployment more than > > > > static 100 files, so keep that in mind. > > > > If SDK 1.5.5 increased the max of number of static files to be > > > > uploaded, or your files are within limit, > > > > next keep in mind that appengine implementation of > > > > javax.Servlet.Filters work upon dynamic > > > > content (filters are not applied to static content at this time). > > > > So if you need to sense the user agent on server-side using your > > > > library of preference, make sure that > > > > your welcome file is a jsp file in order for your browser agent filter > > > > to intercept > > > > up the request. > > > > If you are instead using a static html file that includes javascript > > > > to sense the > > > > viewport size (= document.width) and then redirect, you won't need to > > > > use a javax.servlet.Filter > > > > and can replace the welcome file with your index.html instead > > > > (caveat is that if you advertise, you won't be able to use that > > > > default url as it will now result in a redirect). > > > > > Here's how it could work w/ welcome file index.html: > > > > > If you had webapp directories: > > > > /site/ > > > > /site/mobile/ > > > > > in appengine-web.xml use: > > > > <public-root>/site</public-root> > > > > <static-files> > > > > <include path="/site/favicon.ico" /> > > > > <include path="/site/index.html" /> > > > > <include path="/site/about.jsp" /> > > > > <include path="/site/error.html" /> > > > > </static-files> > > > > > in web.xml use: > > > > <error-page> > > > > <error-code>404</error-code> > > > > <location>/error.html</location> > > > > </error-page> > > > > <welcome-file-list> > > > > <welcome-file>index.html</welcome-file> > > > > </welcome-file-list> > > > > > I'll leave the app version that uses an index.jsp welcome file and a > > > > browser agent filter up to you, but it should work similarly. > > > > > On Oct 6, 7:10 am, WillSpecht <willspe...@gmail.com> wrote: > > > > > > Things will be slightly different on the mobile site. I have checked > > > > > out jquery mobile and its how I want to write the mobile site. I > > > > > think the layout of the two sites will be too different to do on one > > > > > page. > > > > > > On Oct 5, 9:49 pm, Nichole <nichole.k...@gmail.com> wrote: > > > > > > > Have you thought of designing for all viewports from the start > > > > > > instead > > > > > > of a redirect? > > > > > > see the new jquery library > > > > > > > http://jquerymobile.com > > > > > > > On Oct 4, 11:57 am, WillSpecht <willspe...@gmail.com> wrote:> Can > > > > > > someone give me a basic rundown of how to set up a mobile site on > > > > > > > app engine. I already have a standard site set up but I want to > > > > > > > use > > > > > > > the same data store to run a mobile site. > > > > > > > > I would like to redirect mobile users to m.mydomain.com. Basically > > > > > > > both sites will be the same I just want to show them different jsp > > > > > > > pages. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.