我对角度js很新,并希望学习角度js以应用于我们的项目。早些时候我们正在使用gwt-rpc和谷歌应用引擎。现在我们想要使用角度js而不是gwt。我从git hub下载了gae angularjs留言簿项目但是我无法在我的eclipse中设置它,因为它在注释中显示错误(@ Path,@ Get),如下所示。我已经安装了maven,但它仍然显示出一些错误。
以下链接包含留言簿项目。 https://github.com/GoogleCloudPlatform/appengine-angular-guestbook-java
@Path("/guestbook")
public class GuestbookResource {
private final Logger logger = Logger.getLogger(GuestbookResource.class.getName());
private List<Greeting> getGreetings(String guestbookName) {
List<Greeting> greetings = new ArrayList<Greeting>();
DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();
Key guestbookKey = KeyFactory.createKey("Guestbook", guestbookName);
Query query =
new Query("Greeting", guestbookKey).addSort("date", Query.SortDirection.DESCENDING);
List<Entity> greetingEntities = datastoreService.prepare(query).asList(FetchOptions.Builder
.withLimit(10));
for (Entity greeting : greetingEntities) {
greetings.add(Greeting.fromEntity(greeting));
}
return greetings;
}
@GET
@Path("/{guestbookName}")
@Produces(MediaType.APPLICATION_JSON)
public GuestbookResponse getGuestbookData(
@DefaultValue("default") @PathParam("guestbookName") final String guestbookName) throws
Exception {
return new GuestbookResponse(guestbookName, getGreetings(guestbookName),
UserServiceInfo.get("/"));
}
@POST
@Path("/{guestbookName}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public GuestbookResponse signGuestbook(
@DefaultValue("default") @PathParam("guestbookName") final String guestbookName,
final Map<String, String> postData) {
UserService userService = UserServiceFactory.getUserService();
DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();
Key guestbookKey = KeyFactory.createKey("Guestbook", guestbookName);
// We set the above parent key on each Greeting entity in order to make the queries strong
// consistent. Please Note that as a trade off, we can not write to a single guestbook at a
// rate more than 1 write/second.
String content = postData.get("content");
if (content != null && content.length() > 0) {
Date date = new Date();
Entity greeting = new Entity("Greeting", guestbookKey);
greeting.setProperty("user", userService.getCurrentUser());
greeting.setProperty("date", date);
greeting.setProperty("content", content);
datastoreService.put(greeting);
}
return new GuestbookResponse(guestbookName, getGreetings(guestbookName), null);
}
}
答案 0 :(得分:0)
对于AngularJS,最好使用带有插件的WebStorm进行自动完成和远程调试
答案 1 :(得分:0)
请考虑使用以下列出的其中一个插件: http://maven.apache.org/eclipse-plugin.html
IntelliJ IDEA也对maven有很好的支持。使用IntelliJ可能是另一种选择,但这取决于您的口味。