웹 응용 프로그램에서 나머지 API를 통해 자원을 시작/관리하려면 다른 웹 서비스 (개발/관리)를 호출해야합니다. 웹 서비스는 tomcat6에서 실행됩니다. POST 요청이 통과하지만 GET 요청이 금지되어 있음을 브라우저 로그에서 볼 수 있습니다. 웹 서비스 자체에서 동일한 호출을하면 문제가 발생하지 않습니다. 내가 tomcat6에 대한 교차 원산지 필터를 정의하고 지원되는 방법에서 GET을 언급했으나 여전히 문제가 지속됩니다.POST 요청이 정상적으로 처리되는 동안 GET 요청이 금지됩니다.
web.xml에서 응용 프로그램 서버 수준 자체에서이 방식으로 교차점 필터를 정의했습니다. http://software.dzhuvinov.com/cors-filter.html에서 CORS 필터 라이브러리를 사용하고 있습니다. "금지 된 오류의 이야기를 - 이것은 tomcat6 서버이며, 필터는
이상하게<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.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>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CORS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
, 웹 서비스는 수락 POST 호출을 다음과 같이 ($ TOMCAT6_HOME/conf의/web.xml 파일)에 정의되어 있지만 GET 요청에, 그 (403)를 던지고있다 지정된 자원에 대한 액세스가 금지되었습니다. " 다음과 같이 GET 호출에 대한
헤더는
Request URL:https://remote.vm.mycompany.com/remote/tunnel?read:c2faeb31-4147-49e8-b8d3-53d89496e5ca:0
Request Method:GET
Status Code:403 Forbidden
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:remote.vm.mycompany.com
Origin:https://ec2-184-72-200-91.compute-1.amazonaws.com
Referer:https://ec2-184-72-200-91.compute-1.amazonaws.com/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36
Query String Parametersview sourceview URL encoded
read:c2faeb31-4147-49e8-b8d3-53d89496e5ca:0:
Response Headersview source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:https://ec2-184-72-200-91.compute-1.amazonaws.com
Content-Length:961
Content-Type:text/html;charset=utf-8
Date:Sun, 21 Jul 2013 17:17:37 GMT
Server:Apache-Coyote/1.1
톰캣 액세스 로그는
여기- - - [21/Jul/2013:17:17:37 +0000] POST /remote/tunnel?connect HTTP/1.1 200 -
- - - [21/Jul/2013:17:17:37 +0000] GET /remote/tunnel?read:c2faeb31-4147-49e8-b8d3-53d89496e5ca:0 HTTP/1.1 403 -
는 로그의에서 어떤 단서를 제공 GET 요청이 금지 된 공개하지만 does't 내 서블릿 코드. 나는 (라이선스 GPL) here
아마도 내가 무엇을 놓치고 수입니다 GuacamoleHTTPTunnelServlet에 대한 guacamole (웹 서비스와 같은 HTML5 VNC 클라이언트)
package com.mycompany.html5remote;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.GuacamoleSocket;
import net.sourceforge.guacamole.net.GuacamoleTunnel;
import net.sourceforge.guacamole.net.InetGuacamoleSocket;
import net.sourceforge.guacamole.protocol.ConfiguredGuacamoleSocket;
import net.sourceforge.guacamole.protocol.GuacamoleClientInformation;
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
import net.sourceforge.guacamole.servlet.GuacamoleHTTPTunnelServlet;
import net.sourceforge.guacamole.servlet.GuacamoleSession;
public class HttpTunnel extends GuacamoleHTTPTunnelServlet {
private Logger logger = LoggerFactory.getLogger(HttpTunnel.class);
@Override
protected GuacamoleTunnel doConnect(HttpServletRequest request) throws GuacamoleException {
HttpSession httpSession = request.getSession(true);
logger.info("Inside doConnect Method.");
GuacamoleClientInformation info = new GuacamoleClientInformation();
String hostname = request.getParameter("hostname");
String protocol = request.getParameter("protocol");
// Create socket
GuacamoleConfiguration config = new GuacamoleConfiguration();
config.setProtocol(protocol);
config.setParameter("hostname", hostname);
//config.setParameter("hostname", "ec2-184-73-104-108.compute-1.amazonaws.com");
if("vnc".equals(protocol)){
config.setParameter("port", "5901");
}else if ("rdp".equals(protocol)){
config.setParameter("port", "3389");
}else{
config.setParameter("port", "22");
}
logger.info("Set the configuration. Creating the socket connection now..");
// Return connected socket
GuacamoleSocket socket = new ConfiguredGuacamoleSocket(
new InetGuacamoleSocket("localhost", 4822),
config, info
);
logger.info("Successfully created socket connection.");
// Create tunnel from now-configured socket
GuacamoleTunnel tunnel = new GuacamoleTunnel(socket);
// Attach tunnel
GuacamoleSession session = new GuacamoleSession(httpSession);
session.attachTunnel(tunnel);
logger.info("Done");
return tunnel;
}
}
문서를 통합하려고? 단서를 찾을 수있는 다른 곳이 있습니까? 제발 도와주세요
가능한 경우 컨트롤러 또는 서블릿 코드를 첨부 할 수 있습니까? – Karthikeyan
@ Karthikeyan 서블릿 코드를 업데이트했습니다. get/post 요청이 부모 클래스에 정의되어있는 일반 간단한 서블릿 – Ram