Package jmri.web.servlet
Class ServletUtil
java.lang.Object
jmri.web.servlet.ServletUtil
- All Implemented Interfaces:
InstanceManagerAutoDefault
Utility methods to reduce code duplication in servlets.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a common footer.Create a common navigation header.getRailroadName(boolean inComments) Get the railroad name for HTML documents.Return the complete title for an HTML document given the portion of the title specific to the document.setNonCachingHeaders(javax.servlet.http.HttpServletResponse response) Set HTTP headers to prevent caching.voidWrite a file to the given response.
-
Field Details
-
UTF8
-
APPLICATION_JAVASCRIPT
- See Also:
-
APPLICATION_JSON
- See Also:
-
APPLICATION_XML
- See Also:
-
IMAGE_PNG
- See Also:
-
TEXT_HTML
- See Also:
-
UTF8_CHARSET
- See Also:
-
UTF8_APPLICATION_JAVASCRIPT
- See Also:
-
UTF8_APPLICATION_JSON
- See Also:
-
UTF8_APPLICATION_XML
- See Also:
-
UTF8_TEXT_HTML
- See Also:
-
HIDDEN
- See Also:
-
-
Constructor Details
-
ServletUtil
public ServletUtil()
-
-
Method Details
-
getRailroadName
Get the railroad name for HTML documents.- Parameters:
inComments- Return the railroad name prepended and appended by closing and opening comment markers- Returns:
- the Railroad name, possibly with formatting
-
setNonCachingHeaders
Set HTTP headers to prevent caching.- Parameters:
response- the response to set headers in- Returns:
- the date used for headers setting expiration and modification times
-
writeFile
public void writeFile(javax.servlet.http.HttpServletResponse response, File file, String contentType) throws IOException Write a file to the given response.- Parameters:
response- the response to write the file intofile- file to writecontentType- file mime content type- Throws:
IOException- if communications lost with client
-
getTitle
Return the complete title for an HTML document given the portion of the title specific to the document.- Parameters:
locale- The requested Localetitle- Portion of title specific to page- Returns:
- The complete title
-