Skip to content

Issue with Tomcat #1

@geoffroya

Description

@geoffroya

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions