开发者

app.yaml url mapping problem

app.yaml

application: cloudymovie
version: 1
runtime: java

welcome_files:
  - test.jsp

handlers:
  - url: /test/*
  - servlet: com.test.TestLexerServlet
  - name: testlexer

test.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
</head>
<body>
<form action="/t开发者_如何学Cest/" method="get">
    <input type="submit" value="Go">
</form>
</body>
</html>

and then when i press button

HTTP ERROR 404

Problem accessing /test/. Reason:

    NOT_FOUND
Powered by Jetty://

and i take a look in the auto-generated web.xml i found that

<servlet-mapping>
    <servlet-name>com.test.TestLexerServlet</servlet-name>
    <url-pattern>null</url-pattern>
</servlet-mapping>

url-pattern should not be null

I'm new in GAE. Thanks for any advice.


/test/* will match '/test', '/test/', '/test//', etc - probably not what you intended. Try /test/.* instead.

The root cause of your problem, though, is that your YAML markup isn't valid. Instead of this:

handlers:
  - url: /test/*
  - servlet: com.test.TestLexerServlet
  - name: testlexer

it should look like this:

handlers:
  - url: /test/*
    servlet: com.test.TestLexerServlet
    name: testlexer
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜