gf-home | Source codes of GoFrame home site | Object-Relational Mapping library
kandi X-RAY | gf-home Summary
kandi X-RAY | gf-home Summary
Source codes of GoFrame home site.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Middleware is the middleware stack
- GetTitleByPath returns the title for the given path
- SearchMdByKey search for Md by key
- ParseMarkdown parses a markdown string
- Called to handle requests
- Build binary path
- UpdateDocGit updates document
- Md5 returns the MD5 hash of the zip
- refreshCacheMap updates the cache map
- refreshFilesSet refreshes the files set .
gf-home Key Features
gf-home Examples and Code Snippets
Community Discussions
Trending Discussions on gf-home
QUESTION
When deploying a .war file to a GlassFish Server (4.1 currently), the GF server automatically delivers files from the WEB-INF/
folder. (Unless I override their addresses by specifying a Servlet, that is.)
Actually when deploying the .war file to the GF server, it extracts those files under WEB-INF/
to {gf-home}/glassfish/domains/domain1/applications/{app-name}
.
Then it delivers them when accessing http://{hostname}:8080/{app-name}/{path}
.
Now when accessing .json files, the server does NOT send the HTTP Content-Type: application/json
header.
This results in the page not loading properly, FireFox console showing me a XML Parsing Error: not well-formed
exception, even though the file contents are exactly the same.
So my guess is that it's the missing Content-Type tag.
How can I change this mime-mapping for the app/project itself?
From the pages I have seen so far, it is possible to redefine this behaviour in the {gf-home}/glassfish/domains/domain1/default-web.xml
file, defining the mime-mapping
. But presuming I cannot access that file, only upload .war files. Is there any solution? Is it possible to pack a default-web.xml
somewhere into the .war file?
The other solution I can think of at the moment is to override the specific .json files' addresses with a servlet and adding the Content-Type
header in Java. But I'm not sure if there is a foolproof way of accessing and reading the .json files at runtime, but without moving them anywhere in the Java source code, but leaving them in the WEB-INF/ folder? Any suggestions?
ANSWER
Answered 2017-Dec-04 at 06:15How can I change this mime-mapping for the app/project itself?
By declaring the entries in webapp's own
/WEB-INF/web.xml
.
Since Servlet version 3.0, the web.xml
file became optional. That'll perhaps explain why you could find no one. You can just supply your own in the webapp. GlassFish 4.1 is a Servlet 3.1 capable container, so the below Servlet 3.1 compatible web.xml
should get you started:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gf-home
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page