public class GlueMultipartRequest extends Object
File Upload Size º¯°æ ¹æ¹ý 1: glue.properties¿¡ ´ÙÀ½°ú °°ÀÌ ¼±¾ð. ´Ü, Integer.MAX_VALUE °¡ »óÇÑ°ªÀÓ. max.upload.file.size=1000000000 ÀÌ size¸¦ ³ÑÀ¸¸é connection error¸¦ ¹ß»ýÇÏ°Ô µÈ´Ù. 2: GlueAbstractAction, GlueAbstractController À» »ó¼Ó¹Þ¾Æ¼ ±¸Çö reqeust.setAttribute(GlueWebConstants.MAXUPLOADSIZE,"1000000000"); ÀÌ GlueMultipartRequest´Â Glue F/W¿¡¼ »ý¼º ÇÏ¿© ÁÖ¸ç WebÀÌ ¾Æ´Ñ Non Web ÇÁ·Î±×·¥¿¡¼´Â »ç¿ëÇÒ ¼ö ¾ø´Ù. »ç¿ë ¹æ¹ýÀº ´ÙÀ½°ú °°´Ù. GlueMultipartRequest mReq = ctx.getMultiPartRequest(); if(mReq != null) { File f = getFile("a.txt"); } ´ë¿ë·® File Upload Àû¿ë ¹æ¹ý ´ë¿ë·® FileÀÇ °æ¿ì WASÀÇ Memory Size¿¡ Á¦¾àÀ» ¹Þ´Â´Ù. ¿¹¸¦ µé¾î WASÀÇ Memory¸¦ 100MB·Î ÇÏ¿´´Ù°í ÇÑ´Ù¸é 100MB º¸´Ù Å« FileÀº Upload¸¦ ÇÏÁö ¸øÇÏ°Ô µÈ´Ù. ÀÌ·±°æ¿ì ´ë¿ë·® FileÀ» Àû¿ëÇÏ¿©¾ß ÇÑ´Ù. ´ë¿ë·® File Àû¿ë ¹æ¹ý: - JAVA Option ¼³Á¤ (Çʼö) : "-Dfile.bigsize=true" - JAVA Option ¼³Á¤ (¼±ÅÃ) : "-Dtemp.bigfile.path=ÀÓ½ÃÆÄÀÏÀÇ Àý´ë°æ·Î" ´ë¿ë·® FileÀ» Àӽà ÆÄÀÏ·Î ¸ÕÀú ÀúÀåÇÏ¿© »ç¿ëÇÏ°Ô µÈ´Ù. µ¿ÀÏ ÆÄÀÏ¸í¿¡ ´ëÇؼ Àӽà ÆÄÀÏÀº overwrite µÈ´Ù (since ver.4.2.9) Á¦¾à »çÇ×: - ±âÁ¸ byte [] ÇüÅ·ΠFileÀÇ Contents¸¦ ¹Þ¾Æ ó¸® ÇÏ´ø LogicÀº ´õÀÌ»ó »ç¿ë µÉ ¼ö ¾ø´Ù. - ÇØ´ç Method List : public byte[] getFileContent(String fileName) public byte[] getFileContentByInputName(String inputName) public byte[][] getMultiFilesContentByInputName(String inputName) public String toStringFileContent(String fileName)
Constructor and Description |
---|
GlueMultipartRequest(javax.servlet.ServletRequest request)
»ý¼ºÀÚ(constructor).
|
Modifier and Type | Method and Description |
---|---|
static void |
copyFile(File input,
File output)
File À» Copy ÇÑ´Ù.
|
Object |
getFileContentsForHuge(String fileName)
HTTP Request Stream¿¡¼ ÀÐ¾î µéÀÎ ÆÄÀÏÀÇ ÄÁÅÙÃ÷¸¦ Return ÇÑ´Ù.
|
Iterator<String> |
getFileNames()
File ¸íÀ» Ž»öÇϱâ À§ÇÑ Iterator¸¦ ¹Ý³³ÇÑ´Ù.
|
InputStream |
getInputStream(String fileName)
¸Þ¸ð¸®¿¡ ij½¬ÇÏ°í ÀÖ´Â ÆÄÀÏÀÇ ³»¿ëÀ» InputStreamÇüÅ·Π¹ÝȯÇÑ´Ù.
|
Map<String,String[]> |
getParameterMap() |
File |
saveFile(String fileName)
ÆÄÀÏÀ» Server»óÀÇ ÁöÁ¤µÈ ¾÷·Îµå µð·ºÅ丮¿¡ ÀúÀåÇÑ´Ù.
|
void |
setTargetDirectory(String path)
UploadµÈ FileµéÀ» ÀúÀåÇÏ±æ ¿øÇÒ¶§ »ç¿ëÇÑ´Ù.
|
public GlueMultipartRequest(javax.servlet.ServletRequest request) throws Exception
¹æ¹ý 1: glue.properties¿¡ ´ÙÀ½°ú °°ÀÌ ¼±¾ð max.upload.file.size=1000000000 ¹æ¹ý 2: ´ÙÀ½°ú °°ÀÌ ±¸Çö reqeust.setAttribute(GlueWebConstants.MAXUPLOADSIZE,"1000000000");
request
- HTTP RequestException
- Request¸¦ parsing ÇÏ´Â µµÁß ¿¡·¯°¡ ¹ß»ýµÇ¸é throw µÈ´Ù.public void setTargetDirectory(String path)
±âº»ÀûÀ¸·Î Web ȯ°æ¿¡¼ ´ÙÀ½ 2°³ Action Class°¡ »ç¿ëµÈ´Ù¸é setTargetDirectory()°¡ ½ÇÇàµÈ´Ù. mReq.setTargetDirectory("/upload/chain/"); mReq.saveFile("a.txt"); À§ ¿¹¿¡¼ ¸¸ÀÏ mReq.setTargetDirectory()¸¦ ¸ÕÀú ½ÇÇàÇÏÁö ¾Ê¾Ò´Ù¸é Error°¡ ¹ß»ýµÈ´Ù.
path
- String FileÀ» ÀúÀåÇÒ Directory ¸íIllegalArgumentException
- DirectoryÀÇ ±ÇÇÑ ¹× À߸øµÈ °æ·Îpublic Iterator<String> getFileNames()
public InputStream getInputStream(String fileName)
fileName
- ÆÄÀϸípublic Object getFileContentsForHuge(String fileName)
fileName
- ÆÄÀϸíException
public static void copyFile(File input, File output)
input
- fileoutput
- filepublic File saveFile(String fileName)
fileName
- ÀúÀåÇÏ°íÀÚ ÇÏ´Â ÆÄÀϸíException
- FileNotFoundException ÆĶó¹ÌÅÍ·Î ³Ñ¾î¿Â ÆÄÀϸíÀÌ Á¸ÀçÇÏÁö ¾ÊÀ»¶§ ¹ß»ýµÈ´Ù. Exception ÆÄÀÏ ÀúÀåÁß ¿À·ù°¡ ³µÀ»¶§ ¹ß»ýµÈ´Ù.Copyright © 2013–2020 POSCO ICT. All rights reserved.