私はSpringベースのWeb開発の初心者です。Spring 3.xでhttpsサイトを開発するには?
私たちのサイトは春に基づいており、現在はhttpベース(非常に安全ではない)です。 サイトはまだライブではないので、サーバーに通常のJSONリクエストでもログイン/パスワードを送信しており、主にJSP、UIデザイン、SQLクエリなどに焦点を当てています。
ここでは、最初のステップとしてhttpsに移行します。
私は、ウェブページやいくつかの春の本のどれも、Springがhttpsのセキュリティを提供するためにどのように使用できるかについて明確な答えはないようです。 上記を達成するのに手伝ってもらえますか?
私の質問が明確でない場合は教えてください。私はできるだけ早く詳細を追加しようとします。
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan
base-package="console.controllerpkg" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
事前のおかげで多くのことを次のように春-servlet.xmlがあり、今そのための唯一のコントローラがある
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
"
id="WebApp_ID" version="2.5">
<display-name>Spring3MVC</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<!--> Mapping for serving static web-content <-->
<!--> The resources folder must be in parallel to WEB-INF <-->
<!--> The mvc:resources gives "not bound" exception unless bound to a namespace as above for xmlns:mvc <-->
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:resources mapping="/scripts/**" location="/scripts/" />
</web-app>
次のように
私たちのweb.xmlがあります!
P.S.あなたが私に春の良い例のサイト/本を勧めてもらえれば、大いに感謝しています。私が見たサイトや本のほとんどは理論に重点を置いていますが、ほとんど例はありません。それは私を少し混乱させてしまった。
リンクありがとうございました。私は深夜から私のために明日彼らを通り過ぎます。今までに何が答えられたのかを再確認するだけで、わかりました: 1)春はSSLとは関係がありません。 2)TomcatでSSLを有効にする必要があります。 これらの2点をご確認ください。 回答ありがとうございました。 もしあなたが私を助けなかったら私は春を掘り続けるでしょう。 –
正しいですが、springはHTTPまたはHTTPSを直接処理しません。それはtomcatやjbossのようなコンテナにデプロイされ、そのコンテナはSSLや通常のHTTPを扱うものです。これらのリクエストはSpringに渡され、処理されます。したがって、SSLを有効にする場合は、あなたのTomcatで行う必要があります。ご協力いただきありがとうございました。これは、人々がここで質問に答えてくれる大きな理由です! – nont
答えのリンクはTomcat 5.5のためのリンクです。これはTomcat 7のリンクです:http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html – maxivis