Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Alfresco 5.0.2

手順  procedures

  1. /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/libにcors-filter-1.9.3.jar,java-property-utils-1.9.1.jarが配置されていることを確認します。

    Confirm the directory, '/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib' which cors-filter-1.9.3.jar and java-property-utils-1.9.1.jar are deployed.

  2. /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/web.xmlを編集します。start editing /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/web.xml
  3. Edit 'web.xml' in /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/.
  4. Uncomment the element of filter which descriptions are from '<!-- CORS Filter Begin -->' to '<!-- CORS Filter End →' in 'web.xml' as below.
  5. <!-- CORS Filter Begin -->から<!-- CORS Filter End -->のコメント化されているfilter要素をコメント解除する。Delete the comment at filter element
    from <!-- CORS Filter Begin --> to <!-- CORS Filter End -->

       <!-- CORS Filter Begin -->
       <filter>
          <filter-name>CORS</filter-name>
          <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
          <init-param>
             <param-name>cors.allowGenericHttpRequests</param-name>
             <param-value>true</param-value>
          </init-param>
          <init-param>
             <param-name>cors.allowOrigin</param-name>
             <param-value>http://localhost:8081</param-value>
          </init-param>
          <init-param>
             <param-name>cors.allowSubdomains</param-name>
             <param-value>true</param-value>
          </init-param>
          <init-param>
             <param-name>cors.supportedMethods</param-name>
             <param-value>GET, HEAD, POST, PUT, DELETE, OPTIONS</param-value>
          </init-param>
          <init-param>
             <param-name>cors.supportedHeaders</param-name>
          </init-param>
          <init-param>
             <param-name>cors.supportsCredentials</param-name>
             <param-value>true</param-value>
          </init-param>
          <init-param>
             <param-name>cors.maxAge</param-name>
             <param-value>3600</param-value>
          </init-param>
       </filter>
       <!-- CORS Filter End -->
    Please specify the promition to access the URL at cross domain 
  6. init-param要素のcors.allowOriginパラメーターで指定されているURLにクロスドメインでのアクセスを許可するURLを指定する。
  7. Specify permitting URL in cross domain environment to 'cors.allowOrigin' parameter of 'init-param' element.  
    (ここではすべてのURLからのアクセスを許可する場合はアスタリスクとしていますが環境に応じて適切なURLを指定してください)

    Following example descriptions specify '*' as permitting all URL, set it according to your own environment.

     
          <init-param>
             <param-name>cors.allowOrigin</param-name>
             <!--param-value>http://localhost:8081</param-value-->
             <param-value>*</param-value>
          </init-param>
  8. <!-- CORS Filter Mappings Begin -->から<!-- CORS Filter Mappings End -->のコメント化されているfilter-mapping要素をコメント解除する。

    Uncomment 'filter-mapping' element which descriptions are from <!-- CORS Filter Mappings Begin --> to <!-- CORS Filter Mappings End --> as below.

       <!-- CORS Filter Mappings Begin -->
       <filter-mapping>
          <filter-name>CORS</filter-name>
          <url-pattern>/api/*</url-pattern>
          <url-pattern>/service/*</url-pattern>
          <url-pattern>/s/*</url-pattern>
          <url-pattern>/cmisbrowser/*</url-pattern>
       </filter-mapping>
       <!-- CORS Filter Mappings End -->
  9. Alfrescoを再起動します。Reboot the Alfresco. 

Alfresco 5.0.1

手順

  1. cors-filter-2.4.jarjava-property-utils-1.9.1.jarを/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/libに配置します。layout the  and  to .

    Deploy 'cors-filter-2.4.jar' and 'java-property-utils-1.9.1.jar' to '/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib'.

  2. /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/web.xmlを下記のように編集します。 Edit 'web.xml' in '/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/' as below. 

    <filter>要素のCORSはどこに設定しても問題は無し。
    Set <filter>element, 'CORS' anywhere.
    While, set <filter-mapping> between 'Global Localization Filter' and 'CMIS security context cleaning filter'.
    ただし、<filter-mapping>はGlobal Localization Filterの後、CMIS security context cleaning filterの前にする必要があるそうです。
       <filter>
          <filter-name>JSF Session Synchronized Filter</filter-name>
          <filter-class>org.alfresco.repo.web.filter.beans.SessionSynchronizedFilter</filter-class>
       </filter>
     
       <!-- ここから追加 Add descriptions start -->
       <filter>
          <filter-name>CORS</filter-name>
          <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
          <init-param>
             <param-name>cors.allowOrigin</param-name>
             <param-value>*</param-value>
          </init-param>
          <init-param>
             <param-name>cors.allowSubdomains</param-name>
             <param-value>true</param-value>
          </init-param>
          <init-param>
             <param-name>cors.supportedMethods</param-name>
             <param-value>GET, POST, HEAD, PUT, DELETE, OPTIONS</param-value>
          </init-param>
          <init-param>
             <param-name>cors.supportedHeaders</param-name>
             <param-value>Content-Type, Accept, Authorization</param-value>
          </init-param>
       </filter>
       <!-- ここまで追加 Add descriptions end -->
       <filter-mapping>
          <filter-name>Global Localization Filter</filter-name>
          <url-pattern>/*</url-pattern>
          <dispatcher>REQUEST</dispatcher>
       </filter-mapping>
     
       <!-- ここから追加 Add descriptions start -->
       <filter-mapping>
          <filter-name>CORS</filter-name>
          <url-pattern>/api/*</url-pattern>
          <url-pattern>/service/*</url-pattern>
          <url-pattern>/s/*</url-pattern>
          <url-pattern>/cmisbrowser/*</url-pattern>
       </filter-mapping>
       <!-- ここまで追加 Add descriptions end -->
     
       <filter-mapping>
          <filter-name>CMIS security context cleaning filter</filter-name>
          <url-pattern>/cmisws/*</url-pattern>
       </filter-mapping>
  1. Alfrescoを再起動します。 Reboot the Alfresco.


Reference

About 'CORS'

Cross-origin resource sharing
W3C Cross-Origin Resource Sharing
Using CORS

AlfrescoのCORSモジュールに関する情報は下記となります。 Information about 'CORS' module in 'Alfresco'.

CORS - Enable Alfresco for CORS

CORS Filter installation

http://software.dzhuvinov.com/cors-filter-configuration.html

  • No labels