SpringMVC (3.0.1) スタック上に構築された既存の GUI Web アプリケーションについて、RESTful API を公開したいと考えています。妥当な選択肢は何だと思いますか?
- Jersey のような別のフレームワークと統合しますか (ゼロからやり直すようです)?
- 組み込みの JAXB / Jackson の SpringMVC 統合を使用しますか?
- 同じに別のサーブレットマッピング
/api/*
を追加するだけDispatchServlet
ですか? - すべてのビューは jsp でコーディングされています。XML API に jsp テンプレートを使用する必要がありますか?
- 共通の依存関係を持つ別の新しい webapp を構築しますか?
- 他に何か?
以下は私のweb.xmlです:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<welcome-file-list>
<welcome-file>home.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/web/*</url-pattern>
</servlet-mapping>
</web-app>
そして私の春のコンテキスト記述子:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
>
<context:component-scan base-package="net.mycrub.poc.controllers" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/views/"
p:suffix=".jsp"
p:viewClass="org.springframework.web.servlet.view.JstlView" />
</beans>
前もって感謝します ; マッピングの例は大歓迎です:-)