2013-08-11 15 views
0

나는 tQueryCar와 함께 몇 가지 물건을하려고했다 urlmapping :웹 사이트 -

http://learningthreejs.com/blog/2012/05/21/sport-car-in-webgl/ 내가 새로운 애플 리케이션 엔진 프로젝트를 생성하고 필요한 물건을이 WebGL을 자동차가 실행 벌금을 localhost에서. 하지만 앱 엔진에 파일을 업로드하면 방화 상자 콘솔에 오류가 발생합니다. 차를 제외한 모든 것이 렌더링됩니다. 다음은 앱 엔진 URL입니다. http://tquerycar.appspot.com

실제로 어떤 일이 일어나는지 파악할 수 없었습니다. localhost에서 모든 것이 잘 작동합니다.

편집 : 확인. 나는 무슨 일이 일어나고 있는지 잘못 생각했다. 내 tQueryCar HTML 코드가이 주소로 GET 요청을하고 있습니다 : http://tquerycar.appspot.com/plugins/car//examples/obj/veyron/parts/veyron_body_bin.js. 그러나 내 web.xml에서 URL /을 내 CarServlet 클래스에 매핑했으며이 클래스는 항상 내 index.html 파일을 출력합니다. 그래서 지금 Java Servlet의 URL을 일반적인 apache 서버에서 작동하는 것으로 매핑하는 방법에 대해 묻고 싶습니다. 사이트가 localhost에서 실행중인 apache 서버에서 제대로 작동하는 이유입니다.

P. 나는 개인적으로 자바 서블릿에 대해 많이 모른다. 이 때문에 이중 슬래시의 생산에로드되지 않습니다

http://tquerycar.appspot.com/plugins/car//examples/obj/veyron/parts/veyron_wheel_bin.js http://tquerycar.appspot.com/plugins/car//examples/obj/veyron/parts/veyron_body_bin.js

: 당신은 자원의 URL의 두 오타가 같은

+0

'some error'? 어떤 오류입니까? – Greg

+0

앱 엔진 URL을 제공했습니다. 웹 브라우저에서 열어서 오류를 볼 수 있습니다. – omerjerk

+1

이메일 주소를 공유하고 싶지 않은 사람들은 도움을 원할 수도 있지만 선택할 수는 있습니다. – Greg

답변

0

그래서 모든 URL이 CarServlet 클래스로 매핑되어 응답으로 index.html을 출력했습니다.

package in.omerjerk.tquerycar; 

@SuppressWarnings("serial") 
public class CommonServlet extends HttpServlet { 
@Override 
protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
    throws ServletException, IOException { 
    ServletContext sc = getServletContext(); 
    String path=req.getRequestURI().substring(req.getContextPath().length()+1, req.getRequestURI().length()); 
    String filename = sc.getRealPath(path); 

    // Get the MIME type of the image 
    String mimeType = sc.getMimeType(filename); 
    if (mimeType == null) { 
     sc.log("Could not get MIME type of "+filename); 
     resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 
     return; 
    } 
    // Set content type 
    resp.setContentType(mimeType); 

    // Set content size 
    File file = new File(filename); 
    resp.setContentLength((int)file.length()); 

    // Open the file and output streams 
    FileInputStream in = new FileInputStream(file); 
    OutputStream out = resp.getOutputStream(); 

    // Copy the contents of the file to the output stream 
    byte[] buf = new byte[1024]; 
    int count = 0; 
    while ((count = in.read(buf)) >= 0) { 
     out.write(buf, 0, count); 
    } 
    in.close(); 
    out.close(); 
} 
} 

을 그리고 CommonServletCarServlet//car를 매핑 : 그래서 다른 모든 URL을 매핑 할 CommonServlet 클래스를 만들었습니다.

0

보인다. 특히, tquery.car.js의 tQuery.Car.baseUrl에는 슬래시가있을 수 있습니다.

+0

힌트를 보내 주셔서 감사합니다. 질문을 업데이트했습니다. 대답 해주세요. – omerjerk