Does Baratine log when binding paths?

13 views
Skip to first unread message

Rick Mann

unread,
Oct 12, 2016, 10:01:08 PM10/12/16
to Baratine
I see log messages for "Created service '/User'", but I don't see any messages corresponding to my @Path() annotations. In my app I don't seem to be able to hit any of my endpoints.

GETs result in 404, POSTs result in 405 (method not allowed).

--
Rick Mann
rm...@latencyzero.com


Alex Rojkov

unread,
Oct 12, 2016, 10:23:01 PM10/12/16
to Rick Mann, Baratine
We are logging the mapping at 'config' level for package com.caucho.v5.web

The log entry will appear according to the following:

log.config("@" + httpMethod + " " + path + " to " +
method.getDeclaringClass().getSimpleName() + "." + method.getName() +
"()");

Alex
> --
> You received this message because you are subscribed to the Google Groups "Baratine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to baratine-io...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Rick Mann

unread,
Oct 12, 2016, 10:31:56 PM10/12/16
to Baratine, Alex Rojkov
I'm sure I just overlooked something in my translation of the Auction code, but none of my expected paths are responding.

My logging is set to FINEST, but I'm not seeing the @Path binding message (I do see zillions of other messages).

Level level = Level.FINEST;
Logger.getLogger("com.caucho").setLevel(level);

My code is now up on github:

https://github.com/JetForMe/hoa

I've tried GET and POST at /user (in HOAUserSessionImpl.java), /register (in AbstractHOASession.java).

But to be honest, I'm very puzzled by how the Auction example decides where to put the various @Path annotations.

Thanks!
--
Rick Mann
rm...@latencyzero.com


Alex Rojkov

unread,
Oct 12, 2016, 10:38:54 PM10/12/16
to Rick Mann, Baratine
Method registerUser can be annotated as so:

@Post("/registerUser")
public void registerUser(@Body UserRegistrationForm inUser,
Result<UserPublic> inResult){}

that should make it accessible at /user/registerUser for post method.

Alex

Rick Mann

unread,
Oct 12, 2016, 10:46:17 PM10/12/16
to Alex Rojkov, Baratine
Well, I want the URL to be /register. Does it have to be "/registerUser"?

I currently have @Post("/register") in the AbstractHOASession, which is never explicitly included by main(), but only implicitly via HOAUserSessionImpl, which extends it. Does that put it at "/user/register"? When I try posting to that, I get 405 Method Not Allowed:

$ curl -vv -X POST "http://localhost:8080/user/register" -H "Content-Type: application/json" --data '{"first":"First","last":"Last","email":"m@m.c","password":"foo","login":"first"}'
* Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> POST /user/register HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 80
>
* upload completely sent off: 80 out of 80 bytes
< HTTP/1.1 405 Method Not Allowed
< server: Baratine/1.0.1
< content-length: 0
< date: Thu, 13 Oct 2016 02:45:21 GMT
<
* Connection #0 to host localhost left intact
--
Rick Mann
rm...@latencyzero.com


Rick Mann

unread,
Oct 12, 2016, 11:06:30 PM10/12/16
to Alex Rojkov, Baratine
Oh! I had an empty, un-annotated method definition in HOAUserSessionImpl. I guess that threw things off.
--
Rick Mann
rm...@latencyzero.com


Reply all
Reply to author
Forward
0 new messages