Java API | Developing Restful APIs | Rest API In Java | Java Tutorial | Java Training | Edureka
HTML-код
- Опубликовано: 11 апр 2017
- 🔥 Java Training (Use Code "𝐘𝐎𝐔𝐓𝐔𝐁𝐄𝟐𝟎"): www.edureka.co/java-j2ee-trai...
This Edureka Java tutorial (Java Blog Series: goo.gl/12JH8n) will help you in understanding the concepts of API in Java. This video helps you to learn following topics:
1:20 What is an API?
3:44 API in Java
6:53 Rest API
9:16 Creating a Restful Web Service
You can download Jersey files from the following link : goo.gl/Qie7ZN
Check out our Java Playlist: goo.gl/ES3dI3
Subscribe to our channel to get video updates. Hit the subscribe button above.
#Java #Javatutorial #Javaonlinetraining #Javaforbeginners #Javacertification
How it Works?
1. This is a 7 Week Instructor led Online Course, 45 hours of assignment and 20 hours of project work
2. We have a 24x7 One-on-One LIVE Technical Support to help you with any problems you might face or any clarifications you may require during the course.
3. At the end of the training you will be working on a real time project for which we will provide you a Grade and a Verifiable Certificate!
- - - - - - - - - - - - - - - - -
About the Course
Edureka's Advanced Java/J2EE and SOA training and certification course is designed for students and professionals who want to be a Java Developer. This is a 42 hour course which will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XML Handling etc. We will also learn various Java frameworks like Hibernate and Spring. During our Java/ Certification training, our instructors will help you:
1. Develop the code with various Java data types, conditions and loops.
2. Implement arrays, functions and string handling techniques.
3. Understand object oriented programming through Java using Classes, Objects and various Java concepts like Abstract, Final etc.
4. Implement multi-threading and exception handling.
5. Use parse XML files using DOM and SAX in Java.
6. Write a code in JDBC to communicate with Database.
7. Develop web applications and JSP pages.
8. Interact with the database using hibernate framework.
9. Write code with spring framework components like Dependency Injection and Auto Wiring.
10. Implement SOA using web services.
- - - - - - - - - - - - - - - - - - -
Who should go for this course?
This course is designed for professionals aspiring to become Java Developers. Programmers, Web Developers, Web Designers, Programming Hobbyists, Database Administrators, Youngsters who want to kick start their career are the key beneficiaries of this course.
- - - - - - - - - - - - - - - -
Why learn Java?
Java is a general-purpose, class-based, object-oriented computer programming language that was designed by James Gosling at Sun Microsystems in 1995.
Key Highlights of Java:
Platform Independent: This allows programmers to develop applications that can run on any operating system.
Usability of Java: Java is most widely used programming language. It is present everywhere. It really doesn't matter which domain you are working in, you will surely come across Java sooner or later!
Open Source: The good news is that Java is available for free! All the development tools and the environment (JRE & JDK) that is used to develop Java applications are absolutely free of cost.
Android: Irrespective of the fact that you are tech savvy or not, most of us are badly bitten by the Android bug! Android is in great demand today and fortunately you need Java for Android development. Hence, the importance of Java has increased even more.
Hadoop: Hadoop is one of the most trending framework for processing Big Data. It has been designed and developed in Java.
In spite of having a tough competition on the server side from Microsoft and other companies, Java is doing extremely well on mobile platforms, thanks to Android! It has also been the primary language for Hadoop Developers.
For Java Training and Certification, please write back to us at sales@edureka.co or call us at IND: 9606058406 / US: 18338555775 (toll free).
Facebook: / edurekain
Twitter: / edurekain
LinkedIn: / edureka
Got a question on the topic? Please share it in the comment section below and our experts will answer it for you. For Java Training Curriculum, Visit our Website: bit.ly/32Ymvde
This is very nice and clear presentation.... thank you
Thank you. Very educational
Guys, if you follow same tutorial and copy web.xml same as said, you will most probably land up with error : Class not found exception.
To avoid this, in your web.xml file, mentioned below value for parameter.
Correct - org.glassfish.jersey.servlet.ServletContainer
Wrong - org.glassfish.jersey.servlet.ServletContainer.class
thank you ,,,you saved my time :)
thanks for the info, it helped!
Hi, I tried the both but still facing the same issue--------- java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
happened to me today while following this tutorial, I did find it myself at the end and came to comment about it and found your comment
thanks man
Very well explained..Great tutorial
Great tutorial and easy to understand.
Thanks a lot man! We were having a mental breakdown, but your video saved us! You are our hero!!
it is realy very helpful thanks
IT IS GOOD VIDEO TO LEARN API
Muy bueno, aunque estaría bueno un ejemplo de CRUD.
The best Indian tutorial RUclips channel ever . I can understand every single thing very clearly that you teach👍🏻
Very nice m8 thanks!
thank you for nice class
Thank you very much!
should we need this xml configurations when we use spring boot ? and create an maven prjct or anyother prjct .
u r great edureka thank u for all of ur tutorials
Hey Arsalan, thanks for the wonderful feedback! We're glad we could help.
Do subscribe to our channel to stay posted on upcoming tutorials.
You can also check out our complete training here: www.edureka.co/java-j2ee-soa-training. Cheers!
Very informative. Thank you very much ! The installation part is a bit too long and should be more concentrated on new and specific issues regarding ReST.
Hi, thank you for your valuable feedback, we have considered it . Do subscribe to our channel for more content, cheers :)
really eudreka you guys are very informative and useful videos...
Hey Vijay, thanks for the wonderful feedback! We're glad you found our tutorials useful.
Here's another video that we thought you might like: ruclips.net/video/aqHhpahguVY/видео.html.
Do subscribe to our channel to stay posted on upcoming tutorials. Cheers!
Dude you are awesome. I am in this IT industry for last 20 yrs. you are one of a good teacher I have seen.
Hey Siva, we are glad you feel this way. Do subscribe to the channel and hit the bell icon to never miss an update from us in the future. Cheers!
This video is a excellent tutorial
Thank you for watching our videos. Do subscribe to our youtube channel and stay updated with our content. Cheers :)
Nice video for beginners :) and very well explained .
Hey Kim, we are glad you loved the video. Do subscribe to the channel and hit the bell icon to never miss an update from us in the future. Cheers!
Hi, explanation is great Thanks But why you don't use example with JSON. I believe it is more common.
Hey Sabuhi, thanks for checking out our tutorial.
This is one of the implementation done through Rest API. There are several methods in Java to implement REST API and JSON is one of those. Since this is a beginner level tutorial, this is the simplest to start off with and that's why we have used it. Cheers!
Super very good explanation crystal clear
Thank you for watching our video. Do subscribe, like and share to stay connected with us. Cheers :)
While launching the application in the browser is it always necessary for the user to give the hard coded value of package name and class name in URL or there is some way we can configure them ?
Hey Abbas, yes you need to use the hardcoded value. Hope this helps!
Thanks Edureka! this video was so helpful hoping more amazing videos from you guys in future...all the best!
Hey Varun, glad you loved the video. Do subscribe and hit the bell icon to never miss an update from us in the future. Cheers!
thank you
Iol, i don't know what is the issue but after watching this video twice and follow exactly i am still getting 404 in the end.....video is good maybe version problem is the issue
Hey Manish, yes version compatibility can be an issue. Try using the same version as used in this tutorial, you will not face this issue. Cheers :)
i started learning from edureka from java tutorials.Thank you very much
Hey Arjun, thanks for checking out our tutorial!
We're glad you found it useful. Here's another video that we thought you might like: ruclips.net/video/aqHhpahguVY/видео.html.
Do subscribe to our channel to stay posted on upcoming tutorials. Cheers!
pace so nice
Hello i followed exact steps on latest version of jars and tomcat 9 server but i always get below error 404 with description as 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'
Hey Mihir, Did you try running it as admin? That usually solves any firewall block issue. Try it out and let us know.
i liked yours teaching style
Hey Gopal, thank you for appreciating oour work. Subscribe and stay tuned for updates in the future. :)
Thanks neel...you really explains thing very well with perfect example.
Thank you for watching our video. Do subscribe, like and share to stay connected with us. Cheers :)
Nice explanation with in 13 min
Hey Hari, we try to make out tutorials short and informative. We are glad that you liked our content. Subscribe to us and stay connected. Cheers :)
Very Informative Video.
Towards the end I am still getting 404 error even after following what was said to append /rest/hello at end of url..
Could you please assist
Hey Sridhar, thanks for the wonderful feedback! We're glad you liked our tutorial.
There could be two main reasons for this, first could be because of some mistake made in code written in the web.xml file. Second could be because the tomcat server isn't running or is being used by another application. You can also try to access your application from your web browser by going to the path localhost:8080/RestTest/hello
Hope this helps. Cheers!
Hey Amlan, thanks for checking out our tutorial!
There could be two reasons for this. First could be because of some mistake made in code written in the web.xml file. Second could be because the tomcat server isn't running or is being used by another application. You can also try to access your application from your web browser by going to the path localhost:8080/RestTest/hello
Hope this helps. Cheers!
Hi I did run on browser and did web.xml as per the tutorial but getting same error .
HTTP Status 404 - Not Found
Type Status Report
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/8.5.16
Had the same experience, try this:
Unable to run the application, had to change some config in the Web.xml on this servlet-class param:
>>> org.glassfish.jersey.servlet.ServletContainer
without the ".class" extension and now able to run.
Hope this helps.
Use org.glassfish.jersey.servlet.ServletContainer instead org.glassfish.jersey.servlet.ServletContainer.class
Hope this will fix your issue.
Thank you bro. Very nicely explained rest api
We are super happy that Edureka is helping you learn better. Your support means a lot to us and it motivated us to create even better learning content and courses experience for you . Do subscribe the channel for more updates : ) Hit the bell icon to never miss an update from our channel : )
Followed the tutorial fully, but getting the error java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer.class in console, and 404 in browser.
I could resolve this issue by adding "org.glassfish.jersey.servlet.ServletContainer" instead of "org.glassfish.jersey.servlet.ServletContainer.class" as sevlet-class in web.xml
Hey Santosh, Glad it worked out.
Do subscribe to our channel to stay posted on upcoming tutorials. Cheers!
This is the correct solution, thanks!
thanks bro
Thanks Santosh for sharing the solution. It might be useful to mention this at the top of the video description so everyone can easily fix the code before reporting the same issue repeatedly.
Super useful, Thanks !!!
You're welcome 😊 Glad it was helpful!!!
Hi ,
I have put jersey servlet jars in web-inf/lib and library also but still my tomcat not getting up and application is not running, pls help me
Hey Sandeep, For this, you just have to check whether your tomcat is being set properly, if not re configure all the servers again and make sure servlet.api is present.
Hope this helps!
So I'm following along with your tutorial, btw, you are a great teacher. So I downloaded jersey and extracted it, but when I open up eclipse, I don't see dynamic web. Since I'm fairly new to this, where else would I look?
Hey Tiya, For this you need to install eclipse for JavaEE Developers. Here is the link - www.eclipse.org/downloads/packages/release/indigo/sr2/eclipse-ide-java-ee-developers
Hope this helps!
hello sir. i try to download Jersey but unable to download it. whats an alternative
+Tha buli, thanks for checking out our tutorial!
You can download Jersey files from the following link: goo.gl/Qie7ZN. You will need to extract the file and copy it inside /WebContent/WEB-INF/lib folder of your dynamic web project. Hope this helps. Cheers!
Will we would be able to develop plugins for wordpress?
Hey Varun, WordPress has various built-in and freely available plugins, you can use any of them. If you wish to learn about how to exclusively create a plug-in for WordPress, we shall consider it.
Hope this helps!
hello sir,I have watched your tutorial and it was very helpful .I followed all the steps as shown in the tutorial but then also i m getting " java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer.class " error ,why so?
Hey Mayur, thanks for checking out our tutorial. We're glad you found it useful.
With regard to the error, Try to copy your jersey jar files into WebContent -> WEB-INF -> lib.
Hope this helps. Cheers!
Use "org.glassfish.jersey.servlet.ServletContainer" instead of "org.glassfish.jersey.servlet.ServletContainer.class" in web.xml
do not use a .class extension, just org.glassfish.jersey.servlet.ServletContainer
remove ".class" from "org.glassfish.jersey.servlet.ServletContainer.class" in web.xml for servlet class & check all libraries are copied to lib or not.
try setting org.glassfish.jersey.servlet.ServletContainer (without class) as ...
org.glassfish.jersey.servlet.ServletContainer
Thank you so much!!!
You're welcome!
many thanks !
You're welcome 😊 Glad you liked it!!
I am not getting a restart server option after finish , so getting 404 error even after adding rest/hello
What can I do to solve it?
Hey Sahil, Check if you have done proper configuration changes for Rest service in web.xml and if you are still getting the error post the exact code that you have used.
Remove ".class" from servletContainer.class in tag servlet-class in web.xml, if already done then check for errors in console while server startup
@@edurekaIN Thanks for the video. Even I am getting 404 error even after adding rest/hello, refer web.xml content
JavaAPI
Java API
org.glassfish.jersey.servlet.ServletContainer.class
jersey.config.server.provider.packages
test
1
Java API
/rest/*
how to consume the web services either soap or restful
Hey Sowbhagya, "searchmicroservices.techtarget.com/tip/REST-vs-SOAP-Choosing-the-best-web-service
Refer this blog. It might be of some help to you."
Getting Status 404
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists
After following all steps you have shown in video
How to communicate & fetch details from different applications using REST API with url ..Kindly share video asap.
Thanks for showing interest in edureka kindly visit the channel for more videos our content creators are eagerly waiting for your suggestion to make new videos on your interest :) DO subscribe for the video update
It is showing error as error is showing in console org.apache.concurrent.excecutionexception
Then the error coming in dialogue box as
starting tomcat v9.0 server at localhost has encountered a problem.
Server tomcat v9.0 server at localhost failed to start
I am not able to view xml response, it is always giving error as whitespace is not allowed at this location.
Hey Mukul, "Put the string in a block as below:
kinda useful
Had a port issue when trying to start the server, said 'Several ports (8005, 8080, 8009) required by Tomcat v8.5 Server at localhost are already in use.'
Double-clicked the server down below in bottom window on Eclipse, changed server Port numbers from 8005, 8080, 8009, to 8008 (respectively), and that seemed to fix the issue.
great explaination
Hey Dileep, we are glad you loved the video. Do subscribe and hit the bell icon to never miss an update from us in the future. Cheers!
I am facing an issue. Trying 2 many times still getting an error 404. I have done exactly the same thing which u are doing in ur video. Assist me asap
Hey Musicat, can you tell us the exact error that you faced along with screenshot. We will definitely try helping you out. Cheers :)
I could resolve this issue by adding "org.glassfish.jersey.servlet.ServletContainer" instead of "org.glassfish.jersey.servlet.ServletContainer.class" as sevlet-class in web.xml..credits goes to @santosh BT
I was having the same issue and removing the ".class" worked, thanks
Worked Great thanks Bro.
thaks @narayana srikar
it works by removing this .class
how to create api key
Hi Pranavi, Go to the API Console.
From the projects list, select a project or create a new one.
If the APIs & services page isn't already open, open the left side menu and select APIs & services.
On the left, choose Credentials.
Click Create credentials and then select API key.
404 error is coming->localhost:7080/JavaAPI/rest/hello please help me about this type issue
Hey Subelay, "You can try changing your port to 8080 instead of 7080. If the issue persists, you can reach back to us, we would be glad to help."
Hi Sir, its is really help full... could you please help me Usage of POST method use and how to insert with out useing queryParam ?
Usage of POST in webswervice: if server is responsible for creating the ID's of the new resources then use POST, for example
POST /users/
Now, POST will carry a key and value which client uses to send username=john and ID will be automatically generated by Server.
Withour @queryParams(): You can get the query parameters grammatically, via “@Context UriInfo“ for example: import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
@Path("/users")
public class UserService {
@GET
@Path("/query")
public Response getUsers(@Context UriInfo info) {
String from = info.getQueryParameters().getFirst("from");
String to = info.getQueryParameters().getFirst("to");
List orderBy = info.getQueryParameters().get("orderBy");
return Response
.status(200)
.entity("getUsers is called, from : " + from + ", to : " + to
+ ", orderBy" + orderBy.toString()).build();
}
}
Hope this helps :)
Strange issue: my code is identical to yours, but if I included the ApplicationPath and core.Application packages, it returns a blank page when running server. If I do include them, it returns the "Hello from HTML" line, even though it is the third method listed....why is this?
Hey Edward, Can you please elaborate? have you tried stopping and restarting the service? That usually solves this issue.
All the people who are getting 404 error, try to run the app in postman or in browser once the server is started. You will be good. Good luck.
Thank you very much!!!