For Jetty, create a jetty-env.xml inside your WEB-INF folder and add these lines: Once thats done, you will need to let your project know which database to connect to. Now let's say you have a database table called Event with an id, title, and created collumns and you want to pull that data from a REST HTTP GET call.įirst open the Services tab in Netbeans, right click on Databases, and hit New Connection.įollow the wizard step by step to setup your database with Netbeans. Run the Jetty server simply by hitting the green play button in Netbeans. Find the Actions tab and then the Run Project action. Now right click on your project and click properties. Src/test/resources/jetty-maven-plugin-webdefault.xml Open your pom.xml and add this between your plugins tags: I use Jetty as a server because its simple to use, it recompiles/restarts on save, and its also easy to set up. Now run this on your server and head to /api/hello/SpinSpire to see this: ServletContainerīe sure to change the param-value to match your Java class package. In order for this to work, you must make an addition to your web.xml to map the Java class to the RESTful path. Import class Hello Response String message) This simple class will output a simple greeting when you visit the /hello/yourname path.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |