Package jp.cssj.cti2.helpers
Class CTISessionHelper
java.lang.Object
jp.cssj.cti2.helpers.CTISessionHelper
Utilities for sending client-side files, URLs, and streams.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidproperties(CTISession session, Properties props) Sets multiple properties at once.static voidsendResourceDir(CTISession session, File dir, String mimeType, String encoding) Sends all files in a directory as resources.static voidsendResourceFile(CTISession session, File file, String mimeType, String encoding) Sends a file as a resource.static voidsendResourceStream(CTISession session, InputStream in, URI uri, String mimeType, String encoding) Sends data read from a stream as a resource.static voidsendResourceURL(CTISession session, URL url, String mimeType, String encoding) Sends a URL as a resource.static voidsetResultFile(CTISession session, File file) Sets the output file.static voidsetResultStream(CTISession session, OutputStream out) Sets the output stream.static voidtranscodeFile(CTISession session, File file, String mimeType, String encoding) Sends a file as the document body.static voidtranscodeStream(CTISession session, InputStream in, URI uri, String mimeType, String encoding) Sends data read from a stream as the document body.static voidtranscodeURL(CTISession session, URL url, String mimeType, String encoding) Sends a URL as the document body.
-
Method Details
-
setResultFile
Sets the output file.- Parameters:
session-file-- Throws:
IOException
-
setResultStream
Sets the output stream.- Parameters:
session-out-- Throws:
IOException
-
properties
Sets multiple properties at once.- Parameters:
session-props-- Throws:
IOException
-
sendResourceFile
public static void sendResourceFile(CTISession session, File file, String mimeType, String encoding) throws IOException Sends a file as a resource.- Parameters:
session- The sessionfile- The filemimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOException
-
sendResourceURL
public static void sendResourceURL(CTISession session, URL url, String mimeType, String encoding) throws IOException Sends a URL as a resource.- Parameters:
session- The sessionurl- URLmimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOException
-
sendResourceStream
public static void sendResourceStream(CTISession session, InputStream in, URI uri, String mimeType, String encoding) throws IOException Sends data read from a stream as a resource.- Parameters:
session- The sessionin- The input streammimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOException
-
sendResourceDir
public static void sendResourceDir(CTISession session, File dir, String mimeType, String encoding) throws IOException Sends all files in a directory as resources. This method also processes subdirectories recursively.- Parameters:
session- The sessiondir- The directorymimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOException
-
transcodeFile
public static void transcodeFile(CTISession session, File file, String mimeType, String encoding) throws IOException, TranscoderException Sends a file as the document body.- Parameters:
session- The sessionfile- The filemimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOExceptionTranscoderException
-
transcodeURL
public static void transcodeURL(CTISession session, URL url, String mimeType, String encoding) throws IOException, TranscoderException Sends a URL as the document body.- Parameters:
session- The sessionurl- URLmimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOExceptionTranscoderException
-
transcodeStream
public static void transcodeStream(CTISession session, InputStream in, URI uri, String mimeType, String encoding) throws IOException, TranscoderException Sends data read from a stream as the document body.- Parameters:
session- The sessionin- The input streammimeType- The MIME type (null if omitted)encoding- The encoding (null if omitted)- Throws:
IOExceptionTranscoderException
-