Alfresco 5.0社区formprocessor不支持方法GET

时间:2016-09-06 09:23:20

标签: java alfresco alfresco-webscripts

我在文档库中添加了一个新操作。我的java类扩展了

ActionExecuterAbstractBase

。在内部代码中,我创建了一个HttpsURLConnection并读取响应,如下所示:

URL url = new URL("https://...................................Get?username="+Name+"&password="+Password);
        HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();


        if (conn.getResponseCode() != 200) {
            throw new RuntimeException("Failed : HTTP error code : "
                    + conn.getResponseCode());
        }

        BufferedReader br = new BufferedReader(new InputStreamReader(
            (conn.getInputStream())));

在Alfresco之外,java脚本可以正常工作,但在其中会抛出以下错误:

Web Script Status 405 - Method Not Allowed

The Web Script /alfresco/s/api/action/cosign/formprocessor has responded with a status of 405 - Method Not Allowed.

405 Description:    The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.

Message:    08060002 Script url /api/action/cosign/formprocessor does not support the method GET

Exception:  org.springframework.extensions.webscripts.WebScriptException - 08060002 Script url /api/action/cosign/formprocessor does not support the method GET

org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:179)
org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)

Server: Community v5.0.0 (d r99759-b2) schema 8.022
Time:   6 Σεπ 2016 11:25:36 πμ

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

最后问题来自SSL证书。 Alfresco为了使https url连接应该信任ssl证书。您可以使用以下命令在Alfresco / java文件夹中添加SSL:

on('end