Skip to content

Commit 96ad96a

Browse files
authored
Closes issue spring-projects#38902
1 parent ad8e6bf commit 96ad96a

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.adoc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,59 @@ Before adopting virtual threads extensively, thoroughly test applications under
203203

204204
Excessive advertising of virtual threads might overlook the associated risks. Emphasize a cautious approach, encouraging users to consider the limitations and employ them judiciously.
205205

206+
### Adding Custom MimeMappings
207+
**Step 1: Identify the MimeMappings File**
208+
209+
Locate the configuration file responsible for MimeMappings. Typically, it's named web.xml or similar.
210+
211+
**Step 2: Edit the MimeMappings**
212+
213+
Open the identified configuration file.
214+
215+
Look for the <mime-mapping> section or similar entries.
216+
217+
To add a new MimeMapping, use the following xml format:
218+
<mime-mapping>
219+
<extension>[FILE_EXTENSION]</extension>
220+
<mime-type>[MIME_TYPE]</mime-type>
221+
</mime-mapping>
222+
223+
Replace [FILE_EXTENSION] with the file extension (e.g., pdf, docx) and [MIME_TYPE] with the corresponding MIME type (e.g., application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document).
224+
225+
Save the changes to the configuration file.
226+
227+
**Step 3: Restart the Application (if required)**
228+
229+
If the changes to the configuration file require a server/application restart, perform the necessary steps to restart the application.
230+
231+
### Configuring MimeMappings Using Properties
232+
**Step 1: Identify Properties File**
233+
234+
Locate the properties file used for configuring your application.
235+
236+
237+
**Step 2: Add MimeMappings Properties**
238+
Open the properties file.
239+
240+
**Add or modify properties related to MimeMappings using the following css format:**
241+
242+
mimeMappings.[FILE_EXTENSION]=[MIME_TYPE]
243+
Replace [FILE_EXTENSION] with the file extension (e.g., pdf, docx) and [MIME_TYPE] with the corresponding MIME type (e.g., application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document).
244+
245+
**For example (bash):**
246+
247+
`mimeMappings.pdf=application/pdf
248+
mimeMappings.docx=application/vnd.openxmlformats-officedocument.wordprocessingml.document
249+
Save the changes to the properties file.`
250+
251+
**Step 3: Load Properties in Application**
252+
253+
Ensure that the application loads and utilizes these properties during runtime. This may involve a configuration setup within your application codebase to read and apply these properties for MimeMappings.
254+
255+
**Step 4: Restart the Application (if required)**
256+
257+
If changes to the properties file necessitate a server/application restart, proceed to restart the application accordingly.
258+
206259

207260
== Guides
208261
The https://spring.io/[spring.io] site contains several guides that show how to use Spring Boot step-by-step:

0 commit comments

Comments
 (0)