Project

General

Profile

Defect #584

Velocity servlet hangs after 404

Added by Robert Ivens over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
velocity
Target version:
Start date:
11/22/2012
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

When you use an URL that calls up some resources as defined in the config.json and this resource doesn't exists Velocity completely hangs.
My config.json is essentially this:

my_solution: {
    type: "pool",
    poolSize: 3,
    resources: ["css", "images", "js", "files"],
    pages: {
        "*":{form:"my_form", template:"index.html"}
    },
    errorPage: "errorPage.html",
    deny:["*.json","*.xml","*.pdf"]
}

When I use the following URL I get a 404 and everything keeps working as it should:
http://localhost:8080/servoy-service/velocity/mycss.css

But when I access the css directory it completely hangs after showing the 404 page:
http://localhost:8080/servoy-service/velocity/css/mycss.css

I found this issue after I tried to access the solution using the following URL:
http://localhost:8080/servoy-service/velocity/my_solution
Notice the missing slash.
This does load the index.html as defined in the config.json but any css and images defined in the template using a relative path will call up the wrong URL as described.
Perhaps the servlet should add the slash automatically when a solution is called ?

History

#1

Updated by Patrick Talbot over 11 years ago

Actually you cannot add a / this simply to the url

Because the problem is that the browser is calling the related files (css/images/js) based on the base URL, so let's say you have a base URL of http://localhost:8080/servoy-service/velocity/my_solution
the browser is calling http://localhost:8080/servoy-service/velocity/css etc... (so considering /my_solution to be a file and stripping it)

So the only way is to redirect the browser to http://localhost:8080/servoy-service/velocity/my_solution/ - that I can do.

As to access to unexisting resources hanging Velocity I'll have to hunt that down.

#2

Updated by Patrick Talbot over 11 years ago

  • Status changed from New to In Progress

OK, so I now redirect from http://localhost:8080/servoy-service/velocity/my_solution to http://localhost:8080/servoy-service/velocity/my_solution/
meaning the browser will then call related resources from the right path.
For resources not found I now return a 404 (no more hang).

Will be available in next Velocity update - with many other things ;)

#3

Updated by Patrick Talbot over 11 years ago

  • Category set to velocity
  • Target version set to v2.0
#4

Updated by Patrick Talbot over 11 years ago

  • Status changed from In Progress to Closed

Fixed in v2.2.0

Also available in: Atom PDF