在OpenShift JBoss AS 7中更改URIEncoding [英] Change URIEncoding in OpenShift JBoss AS 7
问题描述
我正在使用OpenId模块使用Spring Security构建一个测试应用程序.我还使用 jQuery OpenId插件支持某些提供程序.
I am building an testing app with Spring Security using the OpenId module. I also use the jQuery OpenId plugin to support some providers.
我正在使用Tomcat(版本7)测试该应用程序,经过一番故障排除后,我发现我需要为服务器指定URI编码,以支持凭据已倾斜字母和元音的用户,例如Peñasco,Ángel等.
I am testing the app with Tomcat (version 7) and after a little bit of troubleshooting I found that I need to specify the URI encoding for the server in order to support users whose credentials have tilded letters and vowels e.g. Peñasco, Ángel, etc.
在Tomcat中,我只需要将其设置为tomcat-server.xml
文件:
In Tomcat I just have to set this to the tomcat-server.xml
file:
<Connector URIEncoding="UTF-8" SSLEnabled="true" .../>
但是该应用程序已部署在OpenShift PaaS的JBoss AS 7磁带中.
But the app is being deployed in a JBoss AS 7 cartridge on the OpenShift PaaS.
在这种情况下如何放置模拟配置?
How can I put the analog configuration in this case?
我添加了具有以下内容的文件.openshift / action_hooks / pre_start_jbossas-7
:
I added the file .openshift / action_hooks / pre_start_jbossas-7
with this contents:
#!/bin/bash
# Need to set URI encoding to UTF-8 because of Spring Security OpenID module needs it for tilded letters e.g. ñ, Á
export JAVA_OPTS=" -Dorg.apache.catalina.connector.URI_ENCODING=\"UTF-8\" -Dorg.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING=true"
但是它不能远程工作,我在本地服务器上使用了相同的选项,但是它不工作.
But it does not work remotely, I used the same options with the local server and it doesn't work.
推荐答案
在JBoss AS7中,您可以使用系统属性来配置此功能:
In JBoss AS7, you can configure this functionality using system properties:
-Dorg.apache.catalina.connector.URI_ENCODING="UTF-8"
-Dorg.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING="true"
有关参考,请参见: https://community.jboss.org/message/643825#643825
您也可以在standalone.xml
的<system-properties>
部分中进行设置,但是在OpenShift上,此文件不受您的应用程序控制.对于OpenShift应用程序,您需要通过在应用程序的启动前挂钩中设置JAVA_OPTS来使用这些选项启动JBoss.为此,请将以下内容添加到.openshift/action-hooks/pre_start_jbossas-7
文件:
You can also set these in the <system-properties>
section of standalone.xml
, but on OpenShift this file is not controlled by your application. For an OpenShift app you will need to start JBoss with these options by setting JAVA_OPTS in your application's pre-start hook. To do this, add the following to the .openshift/action-hooks/pre_start_jbossas-7
file:
export JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.connector.URI_ENCODING=\"UTF-8\" \
-Dorg.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING=\"true\""
希望这会有所帮助.如果遇到问题,请发表评论.
Hope this helps. Please leave a comment if you run into issues.
这篇关于在OpenShift JBoss AS 7中更改URIEncoding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!