|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.poscoict.glueframework.web.control.GlueMultipartRequest
public class GlueMultipartRequest
GlueMultipartRequest´Â formÀÌ multipart/form-data Àΰæ¿ì »ý¼ºµÈ´Ù.
GlueMultipartRequest¸¦ Default »ý¼ºÀÚ·Î »ý¼ºÇÑ´Ù. ÃÖ´ë Size´Â 100MbyteÀÌ´Ù.
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 Summary | |
---|---|
GlueMultipartRequest(ServletRequest request)
»ý¼ºÀÚ(constructor). |
Method Summary | |
---|---|
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µéÀ» ÀúÀåÇÏ±æ ¿øÇÒ¶§ »ç¿ëÇÑ´Ù. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GlueMultipartRequest(ServletRequest request) throws Exception
¹æ¹ý 1: glue.properties¿¡ ´ÙÀ½°ú °°ÀÌ ¼±¾ð max.upload.file.size=1000000000 ¹æ¹ý 2: ´ÙÀ½°ú °°ÀÌ ±¸Çö reqeust.setAttribute(GlueWebConstants.MAXUPLOADSIZE,"1000000000");
request
- HTTP Request
Exception
- Request¸¦ parsing ÇÏ´Â µµÁß ¿¡·¯°¡ ¹ß»ýµÇ¸é throw µÈ´Ù.Method Detail |
---|
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 Map<String,String[]> getParameterMap()
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 ÆÄÀÏ ÀúÀåÁß ¿À·ù°¡ ³µÀ»¶§ ¹ß»ýµÈ´Ù.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |