tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jef Newsom <...@axyssolutions.com>
Subject Re: Multipart Support
Date Tue, 11 Jul 2000 18:33:16 GMT
Also, getting further off topic, but FYI, there is a bug in at least the latest source release
of JavaMail/Java Activation Framework where
windows style filenames are not parsed correctly because the HeaderTokenizer class incorrectly
(at least in my naive view), tries to
convert embedded backslashes into escaped chars. If you absolutely need the filename as specified
from the source browser, you can fairly
easily parse the filename from the content-disposition of the BodyPart. This is left as an
exercise to the reader, though.

Jef

Jef Newsom wrote:

> The enclosed files are the simplest example I could think of. The text
> files contain printouts of the original body of the post and the parsed
> output of the FileUploadServlet. The formatting is raw... sorry. You need
> javamail, of course.
>
> No warranties expressed or implied.
> Jef
>
> Nick Bauman wrote:
>
> > Well first you need to get something that supports the
> > multipart format, unless you want to code that
> > yourself. I nabbed some code from com.oreilly.servlet
> > that does this.
> >
> > Then, of course, javamail supports attachments
> > directly. I have some code I can send you offline: I
> > can quickly GPL what's mine and post it to you, gimme
> > a few minutes here.
> >
> > --- James Cook <jimcook@iname.com> wrote:
> > > Interesting approach Jef!
> > >
> > > Can you share more information on how specifically,
> > > JavaMail can accomplish
> > > File Uploads in a servlet?
> > >
> > > jim
> > >
> > > ----- Original Message -----
> > > From: Jef Newsom <jef@axyssolutions.com>
> > > To: <tomcat-dev@jakarta.apache.org>
> > > Sent: Tuesday, July 11, 2000 11:02 AM
> > > Subject: Re: Multipart Support
> > >
> > >
> > > > I don't know anything about official support, but
> > > it is very simple to add
> > > > in multipart support in a custom servlet using the
> > > JavaMail API. I would
> > > be
> > > > more than happy to send you some sample code, if
> > > you would like.
> > > Personally,
> > > > I would be reluctant to include specific support
> > > into tomcat/servlets,
> > > > because it isn't an architectural fit to be part
> > > of the servlet
> > > > infrastructure, IMNSHO. File form upload isn't a
> > > specialization of http as
> > > > much as it is a specialized function of html form
> > > posts. Therefore, I
> > > would
> > > > expect to see it in an HTML or MIME library, but
> > > not in a servlet spec,
> > > > which should be focused solely on HTTP for proper
> > > separation of concerns.
> > > >
> > > > Jef
> > > >
> > > >
> > > >
> > > > Arion Yu wrote:
> > > >
> > > > > Hi!
> > > > >
> > > > > Would there be official multipart support for
> > > file upload? I remembered
> > > > > this issue has been discussed some time ago and
> > > what is the result (if
> > > > > any)?
> > > > >
> > > > > It seems servlet 2.3 isn't going to support this
> > > either. Am I right?
> > > > >
> > > > > Arion
> > > > >
> > > > > --
> > > > > [This email and any files transmitted with it
> > > are confidential and may
> > > > > contain information that is legally privileged.
> > > They are intended solely
> > > > > for the addressee(s). Access to this email by
> > > anyone else is
> > > > > unauthorized. If you are not the intended
> > > recipient, please delete it
> > > > > and notify the sender by email immediately; you
> > > should not copy or use
> > > > > it for any purpose, nor disclose its contents to
> > > any other person. Thank
> > > > > you.]
> > > > >
> > > > >
> > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > tomcat-dev-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > tomcat-dev-help@jakarta.apache.org
> > > >
> > > >
> > > >
> > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > tomcat-dev-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > tomcat-dev-help@jakarta.apache.org
> > > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > tomcat-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > tomcat-dev-help@jakarta.apache.org
> > >
> >
> > =====
> > # Nick Bauman
> > # Technical Programmer
> > # http://webhelp.com
> > # real software, real code, real time
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get Yahoo! Mail – Free email you can access from anywhere!
> > http://mail.yahoo.com/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>   ------------------------------------------------------------------------
>                                  Name: InputStreamDataSource.java
>    InputStreamDataSource.java    Type: Java File (application/x-unknown-content-type-JBuilder.JavaFile)
>                              Encoding: base64
>
>                              Name: FileUploadServlet.java
>    FileUploadServlet.java    Type: Java File (application/x-unknown-content-type-JBuilder.JavaFile)
>                          Encoding: base64
>
>                       Name: BytePumper.java
>    BytePumper.java    Type: Java File (application/x-unknown-content-type-JBuilder.JavaFile)
>                   Encoding: base64
>
>   ------------------------------------------------------------------------
> -----------------------------7d029a2bd30426
> Content-Disposition: form-data; name="file1"; filename="C:\WINNT\Profiles\jnewsom\Desktop\dhtml.html"
> Content-Type: text/html
>
> <HTML>
> <BODY>
> <STYLE TYPE="text/css">
> .but {
>     border:2px buttonface solid;
>     padding-top:1;
>     height:20;
>     text-align:center;
>     cursor:default;
> }
> </STYLE>
>
> <SCRIPT language="JavaScript">
> var toolbarButtons =
>         [
>         ["", "file()", "File"],
>         ["", "edit()", "Edit"],
>         ["", "view()", "View"],
>         ["", "favorites()", "Favorites"],
>         ["", "tools()", "Tools"],
>         ["", "help()", "Help"]
>         ];
>
> </SCRIPT>
>
> <DIV ID="toolbar"
>    STYLE="width:250;height:22;overflow:hidden;
>           background-color:buttonface;
>           font-family:MS Sans Serif;font-size:8pt;
>           padding-top:1px;padding-left:2px;">
>
> <SCRIPT language="JavaScript">
>         function addToolbarButtons( buttons )
>         {
>                 for( i = 0; i < toolbarButtons.length; i++ )
>                 {
>                 addToolbarButton( buttons[i][0], buttons[i][1], buttons[i][2] );
>                 }
>         }
>
>         function addToolbarButton( style, onClickFunction, label )
>         {
>                 document.write( "<BUTTON CLASS=but STYLE='" + style + "' onClick='"
+ onClickFunction + "'>" + label + "</BUTTON>"  );
>         }
>
> addToolbarButtons( toolbarButtons );
>
> allSPANs = toolbar.children;
>
> for (i=0; i< allSPANs.length; i++)
> {
>     tSpan = allSPANs(i);
>     tSpan.onselectstart = function(){return false}
>     tSpan.onmouseover = function(){
>         this.style.border = "2px buttonhighlight outset";
>     }
>     tSpan.onmouseout = function(){
>         this.style.border = "2px buttonface solid";
>     }
>     tSpan.onmousedown = function(){
>         this.style.border = "2px buttonhighlight inset";
>     }
>     tSpan.onmouseup = function(){
>         this.style.border = "2px buttonhighlight outset";
>     }
> }
>
> </SCRIPT>
>
> </DIV>
>
> </BODY>
> </HTML>
>
> -----------------------------7d029a2bd30426
> Content-Disposition: form-data; name="file2"; filename="C:\WINNT\Profiles\jnewsom\Desktop\03
July 2000.txt"
> Content-Type: text/plain
>
> 8 vacation
> 8 holiday
>
> 08:30 11:30 3
> 11:30 12:00
> 12:00 18:30 6.5
>
> 9.5
>
> 09:00 12:00 3
> 12:00 12:15
> 12:15 17:15 5
>
> 8
>
> 09:15 11:15 2
> 11:15 13:30
> 13:30 18:00 4.5
>
> 6.5
>
> -----------------------------7d029a2bd30426--
>
>   ------------------------------------------------------------------------
> text/html
> C:WINNTProfilesjnewsomDesktopdhtml.html
> null
> <HTML>
> <BODY>
> <STYLE TYPE="text/css">
> .but {
>     border:2px buttonface solid;
>     padding-top:1;
>     height:20;
>     text-align:center;
>     cursor:default;
> }
> </STYLE>
>
> <SCRIPT language="JavaScript">
> var toolbarButtons =
>         [
>         ["", "file()", "File"],
>         ["", "edit()", "Edit"],
>         ["", "view()", "View"],
>         ["", "favorites()", "Favorites"],
>         ["", "tools()", "Tools"],
>         ["", "help()", "Help"]
>         ];
>
> </SCRIPT>
>
> <DIV ID="toolbar"
>    STYLE="width:250;height:22;overflow:hidden;
>           background-color:buttonface;
>           font-family:MS Sans Serif;font-size:8pt;
>           padding-top:1px;padding-left:2px;">
>
> <SCRIPT language="JavaScript">
>         function addToolbarButtons( buttons )
>         {
>                 for( i = 0; i < toolbarButtons.length; i++ )
>                 {
>                 addToolbarButton( buttons[i][0], buttons[i][1], buttons[i][2] );
>                 }
>         }
>
>         function addToolbarButton( style, onClickFunction, label )
>         {
>                 document.write( "<BUTTON CLASS=but STYLE='" + style + "' onClick='"
+ onClickFunction + "'>" + label + "</BUTTON>"  );
>         }
>
> addToolbarButtons( toolbarButtons );
>
> allSPANs = toolbar.children;
>
> for (i=0; i< allSPANs.length; i++)
> {
>     tSpan = allSPANs(i);
>     tSpan.onselectstart = function(){return false}
>     tSpan.onmouseover = function(){
>         this.style.border = "2px buttonhighlight outset";
>     }
>     tSpan.onmouseout = function(){
>         this.style.border = "2px buttonface solid";
>     }
>     tSpan.onmousedown = function(){
>         this.style.border = "2px buttonhighlight inset";
>     }
>     tSpan.onmouseup = function(){
>         this.style.border = "2px buttonhighlight outset";
>     }
> }
>
> </SCRIPT>
>
> </DIV>
>
> </BODY>
> </HTML>
> text/plain
> C:WINNTProfilesjnewsomDesktop03 July 2000.txt
> null
> 8 vacation
> 8 holiday
>
> 08:30 11:30 3
> 11:30 12:00
> 12:00 18:30 6.5
>
> 9.5
>
> 09:00 12:00 3
> 12:00 12:15
> 12:15 17:15 5
>
> 8
>
> 09:15 11:15 2
> 11:15 13:30
> 13:30 18:00 4.5
>
> 6.5
>
> 8 vacation
> 8 holiday
>
> 08:30 11:30 3
> 11:30 12:00
> 12:00 18:30 6.5
>
> 9.5
>
> 09:00 12:00 3
> 12:00 12:15
> 12:15 17:15 5
>
> 8
>
> 09:15 11:15 2
> 11:15 13:30
> 13:30 18:00 4.5
>
> 6.5
>
> -----------------------------7d029a2bd30426--
>
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message