RE: PATCH org.apache.commons.httpclient.methods.multipart.FilePart
Hey Adrian, Its in http://issues.apache.org/bugzilla/show_bug.cgi?id=20986 I put it source in the description and attached it. Eric -Original Message- From: Adrian Sutton [mailto:[EMAIL PROTECTED] Sent: Saturday, June 21, 2003 12:01 AM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hi Eric, Thanks for your effort, unfortunately attachments don't seem to come through on the list. Could you create a new bug in bugzilla for this and attach the file to that? Thanks, Adrian Sutton On Saturday, June 21, 2003, at 12:57 PM, Eric M Devlin wrote: Hey Mike, Adrian Oleg Got it. Thanks for the kick in the right direction. I wasn't seeing addPart. Please find attached the contrib file. Hope it helps someone else. I tried to make it as apacheish as possible if it needs any changes just let me know. Thanks to everyone working on httpclient. It's been a really nice find. I'm using to at work, but I've gotten more out of it at home. Eric -Original Message- From: Michael Becke [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:01 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Eric, You want to create the FilePart manually and then add it to the MultipartPostMethod. Something like: MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080/something; ); FilePart part = new FilePart(name, file, contentType, charset); mpm.addPart(part); Mike On Thursday, June 19, 2003, at 10:23 PM, Eric M Devlin wrote: Hey Adrian, Ok, but what about what something below? MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080; + /something ); mpm.addParameter( A, new File( /usr/dev/images/add.gif ) ); How do I set the content type for the file? It seems either the addParameter needs to return FilePart which would have to have setters provided or an overloaded version of addParameter which accepted the content type and charset. //MultipartPostMethod public void addParameter(String parameterName, File parameterFile, String contentType, String charset ) -- or -- //MultipartPostMethod public FilePart addParameter(String parameterName, File parameterFile ) //FilePart public void setContentType( String contentType ) public void setCharset( String charset ) I've got the code pulled into class but without a place to apply it's going to be pretty useless. ;- I think this is why I was putting the contentType determination in the FilePart class it self. Just let me know. Eric -Original Message- From: Adrian Sutton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 11:10 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hi Eric, This isn't really something that should be included directly into HttpClient as HttpClient isn't intended to care about the actual content it sends and receives but just takes care of the actual HTTP protocol side of things. Adding auto-mime type detection would mean we'd also have to provide a way to configure the default mime-types etc, in other words it opens a whole can of worms. However, this would be an excellent submission to the HttpClient contrib package, particularly if we refactor it so that instead of being a patch it's a complete class that extends FilePart to add the functionality, then it could easily be used without any changes to HttpClient. Would you be happy with that course of action? If so, would you like to adapt the patch into a standalone class yourself or would you like me to take a crack at it? I don't mind either way. Thanks a lot for the contribution, it will definitely be useful to a number of people. Regards, Adrian Sutton. On Thursday, June 19, 2003, at 12:46 PM, Eric M Devlin wrote: Hey, This is a patch which will determine the content type if null based on file extension. I used the file extension mapping from $TOMCAT_HOME/conf/web.xml. As a side note, I'm having trouble sending gif files. Any thoughts or a kick in the right direction would be helpful. Thanks and Hope It Helps Eric contentTypeByExtension.txt- - - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: PATCH org.apache.commons.httpclient.methods.multipart.FilePart
Hey Mike, Adrian Oleg Got it. Thanks for the kick in the right direction. I wasn't seeing addPart. Please find attached the contrib file. Hope it helps someone else. I tried to make it as apacheish as possible if it needs any changes just let me know. Thanks to everyone working on httpclient. It's been a really nice find. I'm using to at work, but I've gotten more out of it at home. Eric -Original Message- From: Michael Becke [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:01 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Eric, You want to create the FilePart manually and then add it to the MultipartPostMethod. Something like: MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080/something; ); FilePart part = new FilePart(name, file, contentType, charset); mpm.addPart(part); Mike On Thursday, June 19, 2003, at 10:23 PM, Eric M Devlin wrote: Hey Adrian, Ok, but what about what something below? MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080; + /something ); mpm.addParameter( A,new File( /usr/dev/images/add.gif ) ); How do I set the content type for the file? It seems either the addParameter needs to return FilePart which would have to have setters provided or an overloaded version of addParameter which accepted the content type and charset. //MultipartPostMethod public void addParameter(String parameterName, File parameterFile, String contentType, String charset ) -- or -- //MultipartPostMethod public FilePart addParameter(String parameterName, File parameterFile ) //FilePart public void setContentType( String contentType ) public void setCharset( String charset ) I've got the code pulled into class but without a place to apply it's going to be pretty useless. ;- I think this is why I was putting the contentType determination in the FilePart class it self. Just let me know. Eric -Original Message- From: Adrian Sutton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 11:10 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hi Eric, This isn't really something that should be included directly into HttpClient as HttpClient isn't intended to care about the actual content it sends and receives but just takes care of the actual HTTP protocol side of things. Adding auto-mime type detection would mean we'd also have to provide a way to configure the default mime-types etc, in other words it opens a whole can of worms. However, this would be an excellent submission to the HttpClient contrib package, particularly if we refactor it so that instead of being a patch it's a complete class that extends FilePart to add the functionality, then it could easily be used without any changes to HttpClient. Would you be happy with that course of action? If so, would you like to adapt the patch into a standalone class yourself or would you like me to take a crack at it? I don't mind either way. Thanks a lot for the contribution, it will definitely be useful to a number of people. Regards, Adrian Sutton. On Thursday, June 19, 2003, at 12:46 PM, Eric M Devlin wrote: Hey, This is a patch which will determine the content type if null based on file extension. I used the file extension mapping from $TOMCAT_HOME/conf/web.xml. As a side note, I'm having trouble sending gif files. Any thoughts or a kick in the right direction would be helpful. Thanks and Hope It Helps Eric contentTypeByExtension.txt-- - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart
Hi Eric, Thanks for your effort, unfortunately attachments don't seem to come through on the list. Could you create a new bug in bugzilla for this and attach the file to that? Thanks, Adrian Sutton On Saturday, June 21, 2003, at 12:57 PM, Eric M Devlin wrote: Hey Mike, Adrian Oleg Got it. Thanks for the kick in the right direction. I wasn't seeing addPart. Please find attached the contrib file. Hope it helps someone else. I tried to make it as apacheish as possible if it needs any changes just let me know. Thanks to everyone working on httpclient. It's been a really nice find. I'm using to at work, but I've gotten more out of it at home. Eric -Original Message- From: Michael Becke [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:01 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Eric, You want to create the FilePart manually and then add it to the MultipartPostMethod. Something like: MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080/something; ); FilePart part = new FilePart(name, file, contentType, charset); mpm.addPart(part); Mike On Thursday, June 19, 2003, at 10:23 PM, Eric M Devlin wrote: Hey Adrian, Ok, but what about what something below? MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080; + /something ); mpm.addParameter( A,new File( /usr/dev/images/add.gif ) ); How do I set the content type for the file? It seems either the addParameter needs to return FilePart which would have to have setters provided or an overloaded version of addParameter which accepted the content type and charset. //MultipartPostMethod public void addParameter(String parameterName, File parameterFile, String contentType, String charset ) -- or -- //MultipartPostMethod public FilePart addParameter(String parameterName, File parameterFile ) //FilePart public void setContentType( String contentType ) public void setCharset( String charset ) I've got the code pulled into class but without a place to apply it's going to be pretty useless. ;- I think this is why I was putting the contentType determination in the FilePart class it self. Just let me know. Eric -Original Message- From: Adrian Sutton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 11:10 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hi Eric, This isn't really something that should be included directly into HttpClient as HttpClient isn't intended to care about the actual content it sends and receives but just takes care of the actual HTTP protocol side of things. Adding auto-mime type detection would mean we'd also have to provide a way to configure the default mime-types etc, in other words it opens a whole can of worms. However, this would be an excellent submission to the HttpClient contrib package, particularly if we refactor it so that instead of being a patch it's a complete class that extends FilePart to add the functionality, then it could easily be used without any changes to HttpClient. Would you be happy with that course of action? If so, would you like to adapt the patch into a standalone class yourself or would you like me to take a crack at it? I don't mind either way. Thanks a lot for the contribution, it will definitely be useful to a number of people. Regards, Adrian Sutton. On Thursday, June 19, 2003, at 12:46 PM, Eric M Devlin wrote: Hey, This is a patch which will determine the content type if null based on file extension. I used the file extension mapping from $TOMCAT_HOME/conf/web.xml. As a side note, I'm having trouble sending gif files. Any thoughts or a kick in the right direction would be helpful. Thanks and Hope It Helps Eric contentTypeByExtension.txt- - - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PATCH org.apache.commons.httpclient.methods.multipart.FilePart
Eric, I would rather keep web.xml file parsing out. We have to maintain compatibility with Java 1.2.2 for which JAXP is an optional component. I do not think we should introduce JAXP as a dependency for HttpClient. Oleg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thu 6/19/2003 17:16 To: Commons HttpClient Project Cc: Subject:Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hey Adrian, Thanks for responding. Contrib class would fine and I would be willing to do it. Do you have a suggestion on a name? I agree with your assessment about configurating the whole can of worms, but some solution was better than none. The only other thing I could think of would be having a contstructor (for the contrib class) to which you could pass the location of $TOMCAT_HOME/conf/web.xml. Parse it for the mappings. Eric On Thu, 19 Jun 2003 13:09:50 +1000 Adrian Sutton [EMAIL PROTECTED] wrote: Hi Eric, This isn't really something that should be included directly into HttpClient as HttpClient isn't intended to care about the actual content it sends and receives but just takes care of the actual HTTP protocol side of things. Adding auto-mime type detection would mean we'd also have to provide a way to configure the default mime-types etc, in other words it opens a whole can of worms. However, this would be an excellent submission to the HttpClient contrib package, particularly if we refactor it so that instead of being a patch it's a complete class that extends FilePart to add the functionality, then it could easily be used without any changes to HttpClient. Would you be happy with that course of action? If so, would you like to adapt the patch into a standalone class yourself or would you like me to take a crack at it? I don't mind either way. Thanks a lot for the contribution, it will definitely be useful to a number of people. Regards, Adrian Sutton. On Thursday, June 19, 2003, at 12:46 PM, Eric M Devlin wrote: Hey, This is a patch which will determine the content type if null based on file extension. I used the file extension mapping from $TOMCAT_HOME/conf/web.xml. As a side note, I'm having trouble sending gif files. Any thoughts or a kick in the right direction would be helpful. Thanks and Hope It Helps Eric contentTypeByExtension.txt--- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PATCH org.apache.commons.httpclient.methods.multipart.FilePart
Hey Adrian, Ok, but what about what something below? MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080; + /something ); mpm.addParameter( A, new File( /usr/dev/images/add.gif ) ); How do I set the content type for the file? It seems either the addParameter needs to return FilePart which would have to have setters provided or an overloaded version of addParameter which accepted the content type and charset. //MultipartPostMethod public void addParameter(String parameterName, File parameterFile, String contentType, String charset ) -- or -- //MultipartPostMethod public FilePart addParameter(String parameterName, File parameterFile ) //FilePart public void setContentType( String contentType ) public void setCharset( String charset ) I've got the code pulled into class but without a place to apply it's going to be pretty useless. ;- I think this is why I was putting the contentType determination in the FilePart class it self. Just let me know. Eric -Original Message- From: Adrian Sutton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 11:10 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hi Eric, This isn't really something that should be included directly into HttpClient as HttpClient isn't intended to care about the actual content it sends and receives but just takes care of the actual HTTP protocol side of things. Adding auto-mime type detection would mean we'd also have to provide a way to configure the default mime-types etc, in other words it opens a whole can of worms. However, this would be an excellent submission to the HttpClient contrib package, particularly if we refactor it so that instead of being a patch it's a complete class that extends FilePart to add the functionality, then it could easily be used without any changes to HttpClient. Would you be happy with that course of action? If so, would you like to adapt the patch into a standalone class yourself or would you like me to take a crack at it? I don't mind either way. Thanks a lot for the contribution, it will definitely be useful to a number of people. Regards, Adrian Sutton. On Thursday, June 19, 2003, at 12:46 PM, Eric M Devlin wrote: Hey, This is a patch which will determine the content type if null based on file extension. I used the file extension mapping from $TOMCAT_HOME/conf/web.xml. As a side note, I'm having trouble sending gif files. Any thoughts or a kick in the right direction would be helpful. Thanks and Hope It Helps Eric contentTypeByExtension.txt--- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart
Eric, You want to create the FilePart manually and then add it to the MultipartPostMethod. Something like: MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080/something; ); FilePart part = new FilePart(name, file, contentType, charset); mpm.addPart(part); Mike On Thursday, June 19, 2003, at 10:23 PM, Eric M Devlin wrote: Hey Adrian, Ok, but what about what something below? MultipartPostMethod mpm = new MultipartPostMethod( http://localhost:8080; + /something ); mpm.addParameter( A, new File( /usr/dev/images/add.gif ) ); How do I set the content type for the file? It seems either the addParameter needs to return FilePart which would have to have setters provided or an overloaded version of addParameter which accepted the content type and charset. //MultipartPostMethod public void addParameter(String parameterName, File parameterFile, String contentType, String charset ) -- or -- //MultipartPostMethod public FilePart addParameter(String parameterName, File parameterFile ) //FilePart public void setContentType( String contentType ) public void setCharset( String charset ) I've got the code pulled into class but without a place to apply it's going to be pretty useless. ;- I think this is why I was putting the contentType determination in the FilePart class it self. Just let me know. Eric -Original Message- From: Adrian Sutton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 11:10 PM To: Commons HttpClient Project Subject: Re: PATCH org.apache.commons.httpclient.methods.multipart.FilePart Hi Eric, This isn't really something that should be included directly into HttpClient as HttpClient isn't intended to care about the actual content it sends and receives but just takes care of the actual HTTP protocol side of things. Adding auto-mime type detection would mean we'd also have to provide a way to configure the default mime-types etc, in other words it opens a whole can of worms. However, this would be an excellent submission to the HttpClient contrib package, particularly if we refactor it so that instead of being a patch it's a complete class that extends FilePart to add the functionality, then it could easily be used without any changes to HttpClient. Would you be happy with that course of action? If so, would you like to adapt the patch into a standalone class yourself or would you like me to take a crack at it? I don't mind either way. Thanks a lot for the contribution, it will definitely be useful to a number of people. Regards, Adrian Sutton. On Thursday, June 19, 2003, at 12:46 PM, Eric M Devlin wrote: Hey, This is a patch which will determine the content type if null based on file extension. I used the file extension mapping from $TOMCAT_HOME/conf/web.xml. As a side note, I'm having trouble sending gif files. Any thoughts or a kick in the right direction would be helpful. Thanks and Hope It Helps Eric contentTypeByExtension.txt-- - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]