Package overit.geocall.servlet.gate
Class Gate
java.lang.Object
overit.geocall.servlet.gate.Gate
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ConcreteGate
This class defines all the method used to download a file (from a
Source.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddownload(HttpServletRequest req, HttpServletResponse res) Download a fileReturns theBrowserPolicytransforms the disposition values of i,w,d in a standard Content-Disposition http header if the disposition is 'd' the returned value is "attachment", if 'i' it returns "inline" and otherwise it is nullReturns the dispositionReturns the full name of the file, composed by the @{code path} and thebasenamegetFileName(boolean full) Returns the name of the fileabstract SourceReturns theSourceabstract StringgetUrl()Returns the URLvoidoutput(OutputStream os, boolean compressed) Write in the OutputStreamvoidsetDisposition(String disposition) Sets the disposition, possible values are: "i" to indicate the page border, "d" to download or save with name, "w" to open in a tab or a windowprotected static final StringtoGetParams(Map<String, String> m) voidupload(HttpServletRequest req, HttpServletResponse resp) Upload a new binary file.
-
Field Details
-
_fileName
-
_browserPolicy
-
_disposition
-
-
Constructor Details
-
Gate
Creates a new Gate- Parameters:
fileName- The name of the filebrowserPolicy- TheBrowserPolicy
-
-
Method Details
-
toGetParams
-
getFileName
Returns the full name of the file, composed by the @{code path} and thebasename- Returns:
- The name of the file
-
getFileName
Returns the name of the file- Parameters:
full- true to ask the full name, false to ask only for the basename- Returns:
- The name of the file
-
getBrowserPolicy
Returns theBrowserPolicy- Returns:
- The
BrowserPolicy
-
setDisposition
Sets the disposition, possible values are: "i" to indicate the page border, "d" to download or save with name, "w" to open in a tab or a window- Parameters:
disposition- The disposition
-
getDispositon
Returns the disposition- Returns:
- Possible return values are: "i" to indicate the page border, "d" to download or save with name, "w" to open in a tab or a window
-
getSource
Returns theSource- Returns:
- The
Source
-
getUrl
Returns the URL- Returns:
- The URL
-
getContentDisposition
transforms the disposition values of i,w,d in a standard Content-Disposition http header if the disposition is 'd' the returned value is "attachment", if 'i' it returns "inline" and otherwise it is null- Returns:
- the equivalent Content-Disposition header
-
download
Download a file- Parameters:
req- The HttpServletRequestres- The HttpServletResponse- Throws:
IOException- if an I/O exception occurs
-
upload
public void upload(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException Upload a new binary file. If the URL refers to a folder, it is possible to specify the resources file name via thex-geocall-resource-namecustom header- Parameters:
req- The HttpServletRequestresp- The HttpServletResponse- Throws:
IOException- in case of uploaded binary read error or if it can not be correctly saved.ServletException
-
output
Write in the OutputStream- Parameters:
os- The OutputStreamcompressed- Boolean value indicating if is compressed- Throws:
IOException- If an I/O error occurs
-