In the Run Configurations, set up a Tomcat server configuration. Add all
the jars to the /WEB_INF/lib directory (project structure -> artifacts ->
After selecting all jars right click and choose "Put into /WEB-INF/lib").
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-20 UTC."],[[["\u003cp\u003eThis guide helps you set up a Java-based REST server for the Booking API v3 using protocol buffers and Jersey.\u003c/p\u003e\n"],["\u003cp\u003eYou need to install Apache Maven, Protocol Compiler for Java, and Apache Tomcat before starting.\u003c/p\u003e\n"],["\u003cp\u003eThe setup involves generating code from proto files, configuring a web application, and deploying it on Tomcat.\u003c/p\u003e\n"],["\u003cp\u003eYou can find a skeleton REST server and sample code in the provided GitHub repository to aid in the implementation.\u003c/p\u003e\n"],["\u003cp\u003eThe final directory structure shows how the project should be organized, including source code, resources, and test files.\u003c/p\u003e\n"]]],["First, clone the skeleton REST server repository. Then, copy the Proto Interface into a proto file and create a web application project with Maven support. Place the proto file under `src/main/resources` and add Jersey and protocol buffer dependencies to `pom.xml`. Execute `protoc` commands to generate source files. Retrieve sample code from the skeleton repo, and place the files under `src/main/java`. Configure the servlet in `web.xml`, set up a Tomcat server configuration, and run Tomcat to start the server.\n"],null,["# Booking Server (REST) Skeleton for Java\n\nYou can download our\n[skeleton REST server](https://maps-booking.googlesource.com/java-maps-booking-rest-server-v3-skeleton/) by cloning the repo \n\n```java\ngit clone https://maps-booking.googlesource.com/java-maps-booking-rest-server-v3-skeleton\n```\n\nIntroduction\n------------\n\nThis is a reference implementation for API v3 Booking server based on:\n\n- [](/protocol-buffers/docs/overview)google-protobuf\n- [](https://jersey.github.io/)Jersey RESTful Web Services\n\n### Prerequisites\n\nRequire installations of\n\n- [Apache Maven](https://maven.apache.org/)\n- [Protocol compiler for java](https://github.com/google/protobuf)\n- [Apache Tomcat](http://tomcat.apache.org/)\n\n### Get Started\n\n1. Copy the [Proto Interface](/actions-center/verticals/reservations/waitlists/reference/booking-server-api-rest/e2e-definitions/proto-interface) into a proto file (api_v3.proto). Modify the package to match your project (com.partner.mapsbooking.v3.model).\n - If implementing waitlist functionality, repeat the same steps with the [Waitlist Proto Interface](/actions-center/verticals/reservations/waitlists/reference/booking-server-api-rest/e2e-definitions/proto-interface)\n2. Create a web application project in your IDE named booking_server_v3, add Maven support to this project.\n3. Place your proto file under the **src/main/resources,** add dependencies for Jersey and protocol buffers runtime to the Maven **pom.xml** file: \n\n ```java\n \u003cdependencyManagement\u003e\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003eorg.glassfish.jersey\u003c/groupId\u003e\n \u003cartifactId\u003ejersey-bom\u003c/artifactId\u003e\n \u003cversion\u003e${jersey.version}\u003c/version\u003e\n \u003ctype\u003epom\u003c/type\u003e\n \u003cscope\u003eimport\u003c/scope\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n \u003c/dependencyManagement\u003e\n\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003eorg.glassfish.jersey.containers\u003c/groupId\u003e\n \u003cartifactId\u003ejersey-container-servlet-core\u003c/artifactId\u003e\n \u003c/dependency\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003eorg.glassfish.jersey.media\u003c/groupId\u003e\n \u003cartifactId\u003ejersey-media-json-jackson\u003c/artifactId\u003e\n \u003cversion\u003e2.27\u003c/version\u003e\n \u003c/dependency\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.protobuf\u003c/groupId\u003e\n \u003cartifactId\u003eprotobuf-java\u003c/artifactId\u003e\n \u003cversion\u003e3.5.1\u003c/version\u003e\n \u003c/dependency\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003eio.grpc\u003c/groupId\u003e\n \u003cartifactId\u003egrpc-protobuf\u003c/artifactId\u003e\n \u003cversion\u003e1.11.0\u003c/version\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n\n \u003cproperties\u003e\n \u003cjava.version\u003e1.8\u003c/java.version\u003e\n \u003cjersey.version\u003e2.23.2\u003c/jersey.version\u003e\n \u003c/properties\u003e\n ```\n4. Execute the following command under **src/main** to auto-generate a\n source file for the classes defined in the proto file:\n\n ```java\n protoc --java_out=java resources/api_v3.proto\n ```\n - If implementing waitlist functionality, also execute the following: protoc --java_out=java resources/waitlist.proto\n5. Inside of the **src/main/java**, create a new package matching your\n groupId (com.partner.mapsbooking). Retrieve the sample code from the\n repo:\n\n ```java\n git clone https://maps-booking.googlesource.com/java-maps-booking-rest-server-v3-skeleton\n ```\n\n place the files under your package, follow the **TODOs** to complete\n your implementation.\n6. Configure your servlet by modifying the **web.xml** file: \n\n ```java\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n \u003cweb-app xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd\"\n version=\"4.0\"\u003e\n\n \u003cservlet\u003e\n \u003cservlet-name\u003eBooking Rest Server\u003c/servlet-name\u003e\n \u003cservlet-class\u003eorg.glassfish.jersey.servlet.ServletContainer\u003c/servlet-class\u003e\n \u003cinit-param\u003e\n \u003cparam-name\u003ejersey.config.server.provider.packages\u003c/param-name\u003e\n \u003cparam-value\u003ecom.partner.mapsbooking\u003c/param-value\u003e\n \u003c/init-param\u003e\n \u003cload-on-startup\u003e1\u003c/load-on-startup\u003e\n \u003c/servlet\u003e\n\n \u003cservlet-mapping\u003e\n \u003cservlet-name\u003eBooking Rest Server\u003c/servlet-name\u003e\n \u003curl-pattern\u003e/mapsbooking/*\u003c/url-pattern\u003e\n \u003c/servlet-mapping\u003e\n \u003c/web-app\u003e\n ```\n7. In the Run Configurations, set up a Tomcat server configuration. Add all the jars to the /WEB_INF/lib directory (project structure -\\\u003e artifacts -\\\u003e After selecting all jars right click and choose \"Put into /WEB-INF/lib\").\n8. Run Tomcat to start your server.\n\n### Final Directory Structure\n\n```java\n src\n |---main\n |---java\n |---com.partner.mapsbooking\n |---rest\n |---BookingService.java\n |---BookingExceptionMapper.java\n |---Error.java\n |---authentication\n |---AuthenticationService.java\n |---RestAuthenticationFilter.java\n |---v3.model\n |---ApiV3.java\n |---Waitlist.java\n |---resources\n |---api_v3.proto\n |---waitlist.proto\n |---test\n```"]]