On 18/04/2013 16:05, Dhanji R. Prasanna wrote:
> Not really because the method @At are all sub paths of the class @At
>
oh, I once played with @At on methods but didn't not find my way.
I now see why : the method path are added to the class path. The
trailing is quite misleading in that case.
> Or did you mean something else?
>
Well, i just meant that I manage "/" and "/blah" paths on 2 different
classes and sitebricks behaves correctly as I could expect : "/" takes
predecence on "/blah", and that's what I want.
> The compiler should reject any paths that appear to conflict. But of
> course it cannot detect everything:
>
> /blah/:any/id
>
> will subsume
>
> /blah/person/:any
>
> if :any is exactly "id", if it appeared earlier in the dispatch order.
>
> That's why any static paths always override dynamic paths.
>
I also thought to failfast with a ConfusingPathException on startup, but
this probably not to do because as you said, it is really not easy for
the compiler to identify any confusion. It is even not easy for a human
with the example you gave.
Until now for me, sitebricks handles the path correctly.
Anyway, the developer should correctly design his path space.
> Internally method @Ats are converted to longform:
>
> @At("/person") class Person {
> @Get ....
> @At("/id") @Get ...
> }
>
> Will actually get rewritten as follows:
>
> at("/person").show(Person.class);
> at("/person/id").show(Person.class);
>
Ok, this confirms the method path are added to the class path.
This sounds fine, but when I did the test I started from the assumption
that the @At was imposing the full path (cfr. the trailing slash).
But I like that addition, it's just a matter of documenting it for the
user (just like many other things with sitebricks which has hidden gems,
not visible to the end-user).
> (module-style rules)
>
>
> On Thu, Apr 18, 2013 at 6:40 PM, Eric Charles (GMail)
> <
eric.umg...@gmail.com <mailto:
eric.umg...@gmail.com>> wrote:
>
> Could there be such issues only with conflicting @At annotation in
> the same class (on class and method level)?
>
> I have an app with @At("/") and @At("/blah") on different classes,
> and it works fine.
>
> Thx, Eric
>
>
>
> On 17/04/2013 06:23, Dhanji R. Prasanna wrote:
>
> Hmm yea I think so far we have only needed to do this subpath
> mapping
> for specific URIs.
>
> I think if you had a subpath mapping for "/" then it becomes
> confusing
> when you have OTHER classes with "/blah" -- are they subpaths of "/"
> too? How about the data that exists in the parent "/" class? So
> I think
> it's better we don't support that use case.
>
> That said we should report a nicer error than just 404.
>
>
> On Wed, Apr 17, 2013 at 10:27 AM, mmonti <
monti...@gmail.com
> <mailto:
monti...@gmail.com>
> <mailto:
monti...@gmail.com <mailto:
monti...@gmail.com>>__>
> wrote:
>
> Hi dhanji,
>
> Thanks for your quick reply. That change did the trick.
> However I found something that I don't know if is a bug or
> is simply
> how it should work.
>
> Basically I had to define the @At in the class Router with
> the value
> "app" as in the following example:
>
> @At("/app") @Service
> public class Router {
> @Get
> public Reply<HomePage> index() {
> return Reply.with(new
> HomePage()).template(HomePage.__class).type("text/html");
> }
> @Get
> @At("/locations")
> public Reply<LocationPage> locations() {
> return Reply.with(new
>
> LocationPage()).template(__LocationPage.class).type("__text/html");
> }
> @Get
> @At("/rooms")
> public Reply<RoomPage> rooms() {
> return Reply.with(new
> RoomPage()).template(RoomPage.__class).type("text/html");
> }
> }
> So now, requesting the path "*localhost:8080/app*" I get my
> HomePage, requesting "*localhost:8080/app/__locations*", I
> get the
>
> correct LocationPage template.
>
> But when I define "/" as a value in the @At annotation in
> Router
> class, requesting "*localhost:8080/*" I get the correct
> HomePage,
> but trying to request "*localhost:8080/locations*" I get a 404.
>
>
> Just want to know if its the way that Sitebricks work.
> Thanks!
>
>
> On Tuesday, April 16, 2013 10:15:38 PM UTC-5, dhanji wrote:
>
> You try removing the @Show and replacing it with
> @Service. You
> cant mix template and headless web services (yet).
>
> The recommended way to render templates is with the
> Templates
> API anyway.
>
> return Reply.with(pageobject).____template(...);
>
https://groups.google.__com/__forum/?fromgroups=#!____searchin/google-sitebricks/____subpath/google-sitebricks/____t42ntDiufDg/JZV5ShMgG_0J
>
>
> <
https://groups.google.com/__forum/?fromgroups=#!searchin/__google-sitebricks/subpath/__google-sitebricks/t42ntDiufDg/__JZV5ShMgG_0J
> Reply.saying().ok().template(____LocationPage.class).type("____text/html");
>
> }
> @Get
> @At("/rooms")
> public Reply<?> rooms() {
> return
>
> Reply.saying().ok().template(____RoomPage.class).type("text/____html");
>
> }
> }
>
> LocationPage.java and RoomPage.java are annotated with
> @Show("<html-file>")
>
> Should this work? Am i missing something?
> I tried to move the @At annotations to a new
> classes (i.e:
> Locations.java and Rooms.java) and seems to work,
> but when I
> place the @At annotations in different methods I
> get a 404.
>
> Sorry if this is a very basic question. I am just
> starting
> with sitebricks and I couldnt find a way to make it
> work.
> Thanks!.
> Mauro.
>
> --
> You received this message because you are
> subscribed to the
> Google Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving
> emails
> from it, send an email to
> google-sitebri...@__
googlegrou__ps.com <
http://googlegroups.com>.
>
> For more options, visit
>
https://groups.google.com/____groups/opt_out
> <
https://groups.google.com/__groups/opt_out>
> google-sitebricks+unsubscribe@__
googlegroups.com
> <mailto:
google-sitebricks%2Bunsu...@googlegroups.com>
> <mailto:
google-sitebricks%__2Buns...@googlegroups.com
> <mailto:
google-sitebricks%252Buns...@googlegroups.com>__>.
>
> For more options, visit
> an email to google-sitebricks+unsubscribe@__
googlegroups.com
> send an email to google-sitebricks+unsubscribe@__
googlegroups.com
> <mailto:
google-sitebricks%2Bunsu...@googlegroups.com>.
> For more options, visit
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Sitebricks" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
google-sitebri...@googlegroups.com.