You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Just discovered this the other day and I have to say I'm very excited by the possibilities! I thought I'd play with it for a little project I'm working on that talks to some Google APIs, but found that its authentication stuff was not as convenient as some of the others. So, I thought I'd see if I could come up with something myself. I have a fairly complete implementation (lacking some validation, I think) in a branch on my fork, but am having some difficulties figuring out how to build the jars for use in my project.
I managed to get the APIs to build and the dev Eclipse environment works to generate the code, but if I could get help building (possibly we can put together a Wiki page on it) then I can include it in my API project and do some testing, and open a pull request.
Below are my added annotations and methods.
New Annotations:
@RequiresHeader
Accepts a string which is the name of a header, or a string[] which contains header names
@RequiresCookie
Convenience form of RequiresHeader which allows the specification of specific cookie names within the Cookie header, to avoid sending unnecessary cookies.
@RequiresCookieInUrl
Special annotation which pulls a set cookie from the internal store (either initialized by @SetsCookie or setCookie) and interpolates it into the method's URL. Google Play Music's API does this for some reason in some methods.
@RequiresAuthentication
Convenience form of RequiresHeader which requires some form of authentication, for the "Authorization" field. This can be set using either setAuthentication or setHttpBasicAuth convenience method. The mix of terminology is annoying, but the relevant Spring HttpHeaders class is HttpAuthentication, so setAuthentication makes more sense
@SetsCookie
Indicates that the response of this method sets some cookies that we want to use via setCookie. Accepts a string which is the name of such a cookie, or a String[] with cookie names
New Interface methods (ala setRootUrl):
setHeader(String name, String value)
Stores the header for use in methods with the appropriate RequiresHeader annotation
setAuthentication(HttpAuthentication value)
Allows setting whatever type of authentication you want
setCookie(String name, String value)
Stores the cookie for use in methods with the appropriate RequiresCookie annotation
I'm having trouble building AA into a jar I can use in my project to test
it in real usage. I've tried various incantations of mvn package and mvn
install but keep getting various errors--failed tests, or unable to find
the annotations package, some sort if VerifyError (if I recall correctly)
etc. It seems to compile if I ignore the tests when I build, but using it
in the project results in no classes generated.
Admittedly, I'm new to maven and am unfamiliar with this build process, but
I'm using the stable AA in another project, and got the code to generate
successfully in the test harness version of eclipse with the functional
test project. I just can't seem to get it to cooperate with my actual
project.
Should I just open a pull request? I merged some changes to develop into my
branch that were made after I wrote my I initial implementation, and I'm
not positive I resolved the conflicts correctly, since I've been having
these build issues.
Yes, I followed those steps to get it to work in the first place, but they
don't describe how to package it. I mentioned the pull request because I
thought someone with more experience with the code base might be able to
glance at it and see something obvious that I'm messing up in the build
process.
Right. I tried that and got a bunch of errors saying
package org.androidannotations.annotations does not exist
Thanks for your help so far. I may take some time to revisit this over the weekend, perhaps pull out my code and try reintegrating it into a clean branch in case I somehow messed up one of the configuration files.
It looks like DELETE, etc. were left out in the cold because they don't typically have an entity. I whipped up some code in my repo at home, but it's probably pretty out of date with the rest of the repo, so I'll need to take some time to pull the changes and submit a pull request. I've been pretty fried from work this past week so I haven't had a chance to get to that just yet....
If you're in a rush and can build from source, it's pretty straightforward to add in.
Activity
pyricau commentedon Feb 27, 2013
Hi @dhleong
This looks interesting. I'm not exactly sure about what you are asking here though. What do you need help with ?
dhleong commentedon Feb 27, 2013
I'm having trouble building AA into a jar I can use in my project to test
it in real usage. I've tried various incantations of mvn package and mvn
install but keep getting various errors--failed tests, or unable to find
the annotations package, some sort if VerifyError (if I recall correctly)
etc. It seems to compile if I ignore the tests when I build, but using it
in the project results in no classes generated.
Admittedly, I'm new to maven and am unfamiliar with this build process, but
I'm using the stable AA in another project, and got the code to generate
successfully in the test harness version of eclipse with the functional
test project. I just can't seem to get it to cooperate with my actual
project.
Should I just open a pull request? I merged some changes to develop into my
branch that were made after I wrote my I initial implementation, and I'm
not positive I resolved the conflicts correctly, since I've been having
these build issues.
Thanks!
On Feb 27, 2013 5:34 AM, "Pierre-Yves Ricau" notifications@github.com
wrote:
pyricau commentedon Feb 27, 2013
Well, you shouldn't create a pull request if you are not sure about what your code does and if you cannot build and test.
You should first focus on getting the thing to build and run, and know what your exact changes are.
Have you followed these steps ?
dhleong commentedon Feb 27, 2013
Yes, I followed those steps to get it to work in the first place, but they
don't describe how to package it. I mentioned the pull request because I
thought someone with more experience with the code base might be able to
glance at it and see something obvious that I'm messing up in the build
process.
On Wed, Feb 27, 2013 at 12:03 PM, Pierre-Yves Ricau <
notifications@github.com> wrote:
pyricau commentedon Feb 28, 2013
oh. Packaging is a simple as running
mvn clean packagein the root folder (here)dhleong commentedon Feb 28, 2013
Right. I tried that and got a bunch of errors saying
Thanks for your help so far. I may take some time to revisit this over the weekend, perhaps pull out my code and try reintegrating it into a clean branch in case I somehow messed up one of the configuration files.
pyricau commentedon Feb 28, 2013
Ok :) . If you find these errors again, please post the full stacktrace.
Merge pull request #579 from dhleong/475_Rest_Authentication
DayS commentedon Jul 12, 2013
Merged. I'm leave this issue open until we update the wiki
codebreaker commentedon Aug 28, 2013
I'm using 3.0-milestone build and it looks like using @RequiresHeader for a HTTP DELETE is not adding headers.
dhleong commentedon Aug 30, 2013
It looks like DELETE, etc. were left out in the cold because they don't typically have an entity. I whipped up some code in my repo at home, but it's probably pretty out of date with the rest of the repo, so I'll need to take some time to pull the changes and submit a pull request. I've been pretty fried from work this past week so I haven't had a chance to get to that just yet....
If you're in a rush and can build from source, it's pretty straightforward to add in.
DayS commentedon Oct 12, 2013
The two fixes have been merged. I also worked on this part of the wiki but I still have to adjust some things before updating it.
DayS commentedon Oct 13, 2013
Documentation has been updated. Please let me know if you see mistakes.