0
votes

I have successfully deployed my spring boot sample web application to App Engine Standard (Java 8). This applications has some jsp pages. But i am getting blank page instead of my orginal page. And also not getting any errors.

My index page controller is

@RequestMapping(value = "/", method = RequestMethod.GET)
    public String showIndexPage(Model model,HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException
    {
        return "index";
    }

index.jsp

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Index</title>
    </head>
    <body>
        <p>Welcome</p>
    </body>
</html>

application.propertoes

spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.jsp

This is the documentation i have done.

https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard

enter image description here

Any suggession?

EDIT

But /hello is working fine

@RestController
public class HelloworldController {
  @GetMapping("/hello")
  public String hello() {
    return "Hello world - springboot-appengine-standard!";
  }
}
1

1 Answers

0
votes

Without being anything close to spring-boot expert, I suspect 2 things:

1: You're using @RequestMapping where most examples (some that I just tried) use @GetMapping instead. If I'm not mistaken using @RequestMapping means you'll need to define @ResponseBody as well.

2: To serve static files with GAE you'll need to include that in the appengine-web.xml too as mentioned here under <static-files>:

A sample:

<static-files>
  <include path="/my_static-files" >
    <http-header name="Access-Control-Allow-Origin"
                 value="http://example.org" />
  </include>
</static-files>

GAE seems to be working fine ans serving requests as expected. It's either your spring-boot config or appengine-web.xml