Are there any good tutorials around which explain how to configure Hibernate with MySQL which can then be used to run a web-service? ideally so an android application can connect to it via http:// and bring back results.
I am preferably looking for a REST web service using the JavaEE framework.
Tutorials for either Eclipse or Netbeans are fine. I can't really find any good tutorials that explain this combination. Do I have to use my own initiative when looking at hibernate and web service tutorials separately? which is fine as long as I know i'm not missing something here..
Yes, you should look at hibernate and web service tutorials separately.
Hibernate is a framework that focus on the data access layer, official page.
And eclipse comes with a wizard, that allows you to create web services from a class easily (just a few clicks)
I would start first researching on hibernate (first find out if that is what you wanna use...)
Then the web service.
https://netbeans.org/kb/docs/web/hibernate-webapp.html uses hibernate and mysql, not sure if it exposes it as web service. Note you can register MySQL, create a web app, then use the REST Services from Database file template to generate everything. I think you can choose Hibernate as your persistence provider there.
Related
I'm trying to learn a lot about Eclipse Java.
I have done a lot of searching for how to display API data in Elipse
I am very happy if there is information that can make it easier for me to know this method
Assuming you are newbie to rest web services creation/consumption. Here is a tutorial link to understand the basics.
https://www.journaldev.com/9170/restful-web-services-tutorial-java.
you can develop rest web service using annotations like #path ,#consumes to specify the web service features.
Also, there are some tools like postman available to access webservices via providing the web service resource URL eg: http://localhost:8080/person/getinfo .
I hope this helps :)
I'm going to start developing a new simple "X management" kind app, like contact management or events management. What I want to know is which tools would be the best to achieve it in the way I want.
My app needs to be a web app running on a server that has a mysql database to save and retrieve some simple information. This app must have a web client but I want it to be able to be extended to work with an Android app client.
Things I've thought:
I've worked on Java with facelets and JPA travels management app running on a GlassFish server on localhost with a JSF web view, so maybe my web client and the full app could be done with this.
I've worked with web services such as SOAP and REST with Jaxb and xml schemes to retrieve information parsing some webs into xml or json to show on a client .net app. So I've thought I can add to my app, like last topic we talked about, a REST web service layer to easily work as I want, or at least I think it would be easy. If I do this the Android app could share the same app core code but using the REST service.
My question is what could be the best way to do an app with 2 client side in different platforms that could share some code to be easy to extend it moreover to a desktop app. I've talked about these 2 options because I'm a students of computers at university and those are the tools I know, but I can easy learn more. I've also think about just a REST service and create a web and an Android client to work on same service or something like that.
This post is getting long, so here is the summary: What technologies and tools do you think are the best choice to create an java web app that needs to have web and Android client? Also what server, like tomcat, GlassFish or another, should I use? And what about persistence layer? JPA with mysql is the best I know to work with.
Thanks a lot.
P.D: I work with eclipse
From my point of view:
You can use java jersey and java spring both ( java spring as Dependency injection) for creating RESTful Web service. So, In server side you will create endpoint and you can access data from any platform through those endpoint.
Server can be anyone. It's up to you. I always try to use tomcat but tomcat is not a full JavaEE container it's only a servlet container. So if you want to use full JavaEE version then you should use Glassfish.
And yes JPA .It can be easily used in any environment supporting JPA including Java SE applications, Java EE application servers, Enterprise OSGi containers etc.
On the other hand, still choice is yours.
I want to utilise the Facebook JavaScript API in the client, but manage app logic and configuration on the server through REST web services. I've tried a lot of tutorials out there, but so far I haven't seen one that actually works.
What do you recommend as a server / web framework?
What technology should I use for my REST endpoints?
How can I host this application in a place where facebook will "see" it as a valid app?
I'm looking for a comprehensive tutorial or set of recommended practices to get started.
Thanks
I just so happened to create a blog series that takes you through EVERYTHING you will need. The articles:
Setup Eclipse (IDE) and JBoss AS7 (server)
Setup other JBoss Tools including Forge
Setup JAX-RS Web Service in Java using Forge (very easy!)
Setup account to Host the site for FREE with OpenShift
Setup an entire sample Facebook App
This blog series should be EXACTLY what you're looking for. You can find the first of three articles here:
http://ocpsoft.org/opensource/creating-a-facebook-app-setup-and-tool-installation/
I would recommend going with Spring Social module with has a good abstraction of the Facebook API.
You could then expose these services via REST with Spring Web Services or Jersey.
I am not sure about the hosting. Facebook should see it as a valid application no matter the host. Even your development computer/localhost cando it.
Was just wondering at the current point in time, what is a good combination of tools/frameworks/libraries for implementing a REST API on top of J2EE that integrates to a backend RDB and using OpenID for authentication.
What I am looking to implement is a server component that provides a set of services, all of which will utilise OpenID authentication, and the services will retrieve or update information to/from a backend relational database environment.
What I'm interested in are:
* application server options available (e.g. Tomcat, Glassfish etc.)
* IDE's (e.g. Eclipse, Netbeans, IntelliJ etc.)
* additional components useful for implementing REST (and JSON payloads)
* what is best practice/good technique/options available for database integration from the services (hibernate via spring, hibernate directly, raw jdbc connections ... )
* for integrating authentication via OpenID - what is an appropriate integration point for any custom authentication mechanism within the J2EE environment - are there any commonly used solutions/plug-ins available for OpenId etc.
Also any pointers to good, current tutorials, books etc.
Edit:
Unfortunately I haven't had as much time to research the results to this question as I'd have liked.
At this stage I've found that installing/setting up REST with Jersey was very quick and I believe I can use a ContainerRequestFilter to provide the OpenID support as per the article here: http://plaincode.blogspot.com/2011/07/openid-authentication-example-in-jersey.html
I intend on using OpenId4Java for the OpenId support, with the PAPE extensions to get users email address returned. I don't need OAuth as I don't need to access any of the users other OpenID details or info on their OpenID site from my server app.
I've had a look at the latest Spring, it looks very good and if I were needing to build a web client with my solution, or had more time to look at both, I could easily have ended up leaning that way.
Thanks for the good answers and replies, hard to pick a single correct answer. I've accepted yves answer because it is correct and the way I'm going at the moment with minimal time to research properly, but awarded the bounty to cfontes answer, as it is also correct, and he's replied with additional information and justification.
Make it simple and modern (Spring is neither one nor the other for RESTful web-services):
Jersey – the JAX-RS reference – defines resources and supports OAuth; its code is compact, easy to use & to plug to libraries (backends, etc...).
Take a look at this project on GitHub, it produces JSON from static data. Its web.xml and ProductResource are good places to start.
Every server will do the job, Jetty is my favorite, Tomcat, the standard
The choice of an IDE is up to you, the 3 you're giving are great, well integrated with Maven and source control tools. I use Eclipse from habit
I would go for
Spring 3: this can be useful to wire things up with Dependency
injection and other things.
Spring MVC: Restful support and Request mapping, a request based
framework that integrates very well with Spring
Apache Tiles: to make the HTML templates easier to make.
Spring Security: it's a JAAS implementation and for me it's better and
easier than Standard JAAS.( doesn't need a full web server, tomcat will do fine)
This can help you decide which Persistence provider you want : Persistence Provider comparison I would go for Hibernate, because it have a lot of great features like Criteria API, hibernate Search and it's widely used.
Of course your app should be using JPA 2 for the sake of interchangeability instead of using a Persistence provider directly ( it's not easy to chance from one to another but with JPA2 it's possible, also should be giving you a lot of trouble but it's possible)
I would go with NetBeans 7.0.1 and GlassFish as explained here
From the linked tutorial:
The IDE supports rapid development of RESTful web services using JSR 311 - Java API for RESTful Web Services (JAX-RS) and Jersey, the reference implementation for JAX-RS.
For authentication, I would use the GlassFish JDBC Realm (have a look at this tutorial) but I have never worked with OpenID, so I don't know if this approach can be used together with OpenID.
Hi guys is there a way to self-host a web service in Java just like WCF?
Jersey using Grizzly embedded within it would seem like a good fit for your needs. It wouldn't require and outside application server and would be fairly lightweight to get setup. You can just read the Jersey getting started documents to get going with that exact path:
Jersey User Guide
If by self-hosting you mean generating a web service endpoint for invocation, there are a number of ways to go on this, depending on your potential deployment environment.
I'd start off looking at Oracle's JAX-WS implementation, which includes RESTful capabilities. If you want to run a relatively simple stack, you could use Apache Axis2. And then JBoss has JBossWS, which can run standalone or in the JBoss Application Server. I'm pretty sure most of the major application server engines have a Web Services component as well.