Skip to content

An example showing how to serve multiple content types in a single Spring MVC controller.

License

Notifications You must be signed in to change notification settings

Bernardo-MG/spring-mvc-serving-content-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serving Content with Spring MVC

Return several types of content from a single controller and a single URL inside a Spring MVC application.

Release docs Development docs

Release javadocs Development javadocs

Features

  • Single controller for several content types

Documentation

Documentation is always generated for the latest release, kept in the 'master' branch:

Documentation is also generated from the latest snapshot, taken from the 'develop' branch:

The documentation site is actually a Maven site, and its sources are included in the project. If required it can be generated by using the following Maven command:

mvn verify site -P jetty

The verify phase is required, otherwise some of the reports won't be generated.

Usage

The application is coded in Java, using Maven to manage the project.

Prerequisites

The project has been tested on the following Java versions:

  • JDK 8

All other dependencies are handled through Maven, and noted in the included POM file.

Profiles

Maven profiles are included for setting up an embedded server.

Profile Server
jetty Jetty embedded server
tomcat7 Tomcat 7 embedded server

Installing

The project can be installed by creating the war file and deploying it into a server.

Running

To run the project locally in an embedded server just use the following Maven command for deploying to Jetty:

mvn jetty:run-war -P jetty

An embedded Tomcat can be used through this other profile:

mvn tomcat7:run-war -P tomcat7

With this the project will be accessible at [http://localhost:8080/serving_content/].

This path is defined in the server.test.path property inside the pom, and can be changed by modifying its value.

Running the tests

The project requires a database and a server for being able to run the integration tests.

Just like running the project, an embedded server with an in-memory database can be used:

mvn verify -P jetty

Collaborate

Any kind of help with the project will be well received, and there are two main ways to give such help:

  • Reporting errors and asking for extensions through the issues management
  • or forking the repository and extending the project

Issues management

Issues are managed at the GitHub project issues tracker, where any Github user may report bugs or ask for new features.

Getting the code

If you wish to fork or modify the code, visit the GitHub project page, where the latest versions are always kept. Check the 'master' branch for the latest release, and the 'develop' for the current, and stable, development version.

License

The project has been released under the MIT License.

About

An example showing how to serve multiple content types in a single Spring MVC controller.

Topics

Resources

License

Stars

Watchers

Forks

Packages