FilmRestful is a RESTful web application developed using Java Servlets to manage a collection of films. It allows users to perform CRUD (Create, Read, Update, Delete) operations on the film database. It supports search functionality and enhances user experience with different response formats like JSON, XML, and plain text.
- Add, edit, delete, and list films
- Search films by various criteria
- Support for multiple data formats (JSON, XML, TEXT)
- CORS policy management for cross-origin requests
- Backend: Java, Servlets
- Database: MySQL
- Libraries: Gson for JSON conversion, Jakarta XML Bind for XML conversion
- Build Tool: Apache Maven
- IDE: Eclipse
- Java Development Kit (JDK) 8 or later
- Apache Maven
- MySQL Server
-
Clone the repository:
git clone https://github.com/suatkocar/FilmRestful.git
-
Navigate to the project directory:
cd FilmRestful
-
Set up the database:
- Create a MySQL database named filmrestfuldb.
- Execute the SQL script located at
src/main/resources/createfilms.sql
to create the necessary tables.
-
Create and configure the config.properties file:
-
Copy the example config file:
cp src/main/resources/config.properties.example src/main/resources/config.properties
-
Edit the config.properties file and set your database and API credentials:
jdbcUrl=jdbc:mysql://localhost:3306/filmrestfuldb jdbcUser=your-username jdbcPassword=your-password
-
-
Build the project:
mvn clean install
-
Deploy the
FilmRestful.war
file created in the target folder to your servlet container (e.g., Apache Tomcat).
Access the application at http://localhost:8080/FilmRestful
.
FilmRestful
├── build
├── src
│ ├── main
│ │ ├── java
│ │ │ ├── controllers
│ │ │ │ ├── filters
│ │ │ │ │ └── CorsFilter.java
│ │ │ │ └── rest
│ │ │ │ └── FilmController.java
│ │ │ ├── dao
│ │ │ │ └── FilmDAO.java
│ │ │ ├── listeners
│ │ │ │ └── AppContextListener.java
│ │ │ ├── models
│ │ │ │ ├── Film.java
│ │ │ │ └── Films.java
│ │ │ ├── services
│ │ │ │ └── FilmService.java
│ │ │ └── util
│ │ │ ├── JsonConverter.java
│ │ │ ├── RequestHelper.java
│ │ │ ├── RequestParser.java
│ │ │ ├── ResponseHandler.java
│ │ │ ├── TextConverter.java
│ │ │ ├── XmlConverter.java
│ │ │ └── YamlConverter.java
│ │ └── resources
│ │ ├── config.properties
│ │ ├── config.properties.example
│ │ └── createfilms.sql
│ └── webapp
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── WEB-INF
│ │ ├── lib
│ │ └── web.xml
│ └── redirect.jsp
└── README.md
This project is licensed under the MIT License - see the LICENSE.md file for details.
For any inquiries, please contact me at [email protected].