Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Tomcat #1

Open
geoffroya opened this issue Dec 7, 2020 · 0 comments · May be fixed by #2
Open

Issue with Tomcat #1

geoffroya opened this issue Dec 7, 2020 · 0 comments · May be fixed by #2

Comments

@geoffroya
Copy link

With Tomcat, I can't make Bastillion work.
I found that in TemplateServlet::doGet, variable uri just equals '/'. Thus Thymeleaf fails to find the template.

This makes the trick :

       @Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

		TemplateEngine engine = TemplateConfig.getTemplateEngine(request.getServletContext());
		WebContext context = new WebContext(request, response, request.getServletContext());
		context.getResponse().setContentType("text/html; charset=UTF-8");
		String uri = request.getRequestURI()
				.replaceAll("\\" + TemplateServlet.VIEW_EXT + ".*", TemplateServlet.VIEW_EXT)
				.replaceAll("^" + request.getContextPath(), "");

		if (StringUtils.equals("/", uri)) {
			uri = "/index.html";
		}

		engine.process(uri, context, response.getWriter());
	}

Any objection to a pull-request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant