2017-11-10 16 views
0

존재하는 db 응용 프로그램에서 RESTXQ를 사용하려고합니다. "superapp"라고 부를 수 있습니다. 내가 /db/apps/superapp/collection.xconf에 restxq 트리거를 추가 : 나는 폴더/DB/응용 프로그램/superapp/모듈에 파일 "restxq-test.xql"을 추가 한 다음 eXist-db에 RESTXQ 모듈을 등록하는 방법은 무엇입니까?

<collection xmlns="http://exist-db.org/collection-config/1.0"> 
    <index xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
     <fulltext default="none" attributes="false"/> 
    </index> 
    <triggers> 
     <trigger class="org.exist.extensions.exquery.restxq.impl.RestXqTrigger"/> 
    </triggers> 
</collection> 

:

xquery version "3.0"; 

module namespace test="http://exist-db.org/apps/restxq/test"; 


declare namespace rest="http://exquery.org/ns/restxq"; 
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; 


declare 
    %rest:GET 
    %rest:path("/super") 
    %output:media-type("text/html") 
    %output:method("html5") 
    %rest:query-param("user", "{$user}", "Guest") 
function test:hello($user as xs:string*) { 
    let $title := 'Hello ' 
    return 
     <html xmlns="http://www.w3.org/1999/xhtml"> 
      <head> 
       <title>{$title}</title> 
      </head> 
      <body> 
       <h1>{$title , $user}</h1> 
      </body> 
     </html> 
}; 

하지만이 새로운 모듈이 restxq에게 "알지"못하도록하려면 어떻게해야합니까? 그것은 분명 그렇게 자동으로하지 않습니다. 내가 전화하면 "xyz.com:8080/exist/restxq/super?user=John"나는

HTTP ERROR 405 

Problem accessing /exist/restxq/super. Reason: 

    HTTP method GET is not supported by this URL 

내가 존재를 다시 시작 얻을 내가 확인은/var/www /에서 존재/웹 애플리케이션/WEB-INF/로그/restxq.log하지만 거기에 항목이 없습니다 ... 나는 함수와 속성 매핑이 정확하다고 확신합니다. "/db/apps/demo/examples/templating/restxq-demo.xql"(분명히 등록되어 있음)에 동일한 기능을 추가하면 완벽하게 작동합니다. 그래서 나는 새로운 모듈이 등록되지 않은 것 같아요. 어떻게해야합니까?

답변

2

내가 코멘트를 게시 할 것입니다,하지만 포인트가 부족합니다. 이것이 내가 내 응용 프로그램에서 사용하지 않은 때문에 RESTXQ으로 모든 문제를 해결하는 것입니다 있는지 확실하지 않습니다,하지만 당신이 잘못된 컬렉션 collection.xconf 파일이있는 것 같다. 시스템 콜렉션에 넣어야합니다 : /db/system/config. 즉, 구성 파일은 /db/system/config/db/apps/superapp 콜렉션에 있어야합니다. Configuring Database Triggers

+0

감사 : 트리거에 더 많은 정보는이 문서 페이지에 존재-DB 웹 사이트에 있습니다. 이것은 효과가 있었다. 하지만 RESTXQ를 사용하는 모든 데모 응용 프로그램이 /db/apps/appXYZ/collection.xconf 폴더에 트리거를 추가하는 이유가 궁금합니다. 저처럼 초보자들에게는 다소 혼란 스럽습니다. –

+0

신고 해 주셔서 죄송 합니다만 그 앱은 잘못 설계되었습니다. 그들은 오히려 이동보다, 자신의 편의를 수집 및 사전 install.xql 복사 파일에이 그것을 – adamretter

+0

: 도움말 및 여기에 정보 –