You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sendi Tho <se...@mail.com.INVALID> on 2024/07/05 12:16:11 UTC
[commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Greetings guys,
I am trying to use the new "commons-fileupload2-jakarta-servlet6"
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
<version>2.0.0-M2</version>
</dependency>
looks like the M2 jar from maven and the code differs ( getting warning like bycode and source code does not match).
so currently this build does not allow DiskFileFactory api users to set the repository path.. is this intentional ? how to set the path?
the path seems to come from FileItemFactory, but as FileItemFactory is abstract and DiskItemFactory delegates through its builder the path setter is lost.
also I could not find the 1.x prod build ( assuming we are on 2.x version) of upload2 servlet6. the 2.x using the builder and change in api.. I just wanted to change the package name to jakarta and be done with this.. :)
thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Posted by Gary Gregory <ga...@gmail.com>.
I'm not sure what you're missing, it works here:
https://github.com/apache/commons-fileupload/blob/e1ae2a1f64dfde98879bbd11f539beb3ebb76770/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/DiskFileItemSerializeTest.java#L101-L104
Gary
On Sat, Jul 6, 2024 at 3:28 PM sendi Tho <se...@mail.com.invalid> wrote:
>
> Thank you for looking. I may be not clear .. here is what I am trying to say.
>
>
>
> 1.) The 2.0.0.M2 is using commons-io 2.16.1, here is the api
>
> https://commons.apache.org/proper//commons-io/apidocs/org/apache/commons/io/build/AbstractStreamBuilder.html
>
> setPath not public
>
> 2.) https://github.com/apache/commons-fileupload/blob/master/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/DiskFileItemFactory.java#L71
>
> public static class Builder extends AbstractStreamBuilder<DiskFileItemFactory, Builder> { ...}
>
> does not have setPath() so we api consumers don;t have access to this setter.
>
> 3.) The following call from documentation does not work, as setPath is not available.
>
> DiskFileItemFactory factory = DiskFileItemFactory.builder().setPath(path).setBufferSize(DEFAULT_THRESHOLD).get();
>
>
> ------------------------------------------------------------------------------------------------------------
>
> Sent: Saturday, July 06, 2024 at 2:31 PM
> From: "Gary Gregory" <ga...@gmail.com>
> To: "Commons Developers List" <de...@commons.apache.org>
> Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
> Those two methods are public. What am I missing?
>
> Gary
>
> On Sat, Jul 6, 2024, 11:09 AM sendi Tho <se...@mail.com.invalid> wrote:
>
> > the exact issue I think is
> >
> > DiskFileItemFactory.Builder does not expose the property setPath and
> > setBufferSize.
> >
> >
> > in this file line# 82, #83
> >
> > commons-fileupload/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/DiskFileItemFactory.java
> >
> >
> > TIA.
> >
> >
> >
> >
> >
> > Sent: Friday, July 05, 2024 at 11:31 PM
> > From: "sendi Tho" <se...@mail.com.INVALID>
> > To: dev@commons.apache.org
> > Cc: "Commons Developers List" <de...@commons.apache.org>
> > Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2
> > -DiskItemFile setPath
> > hi, thank you for reviewing this. I am just trying to set the path for
> > temporaty file location for upload
> >
> >
> > String path = new File(System.getProperty("java.io.tmpdir")).getPath();
> >
> > DiskFileItemFactory factory = DiskFileItemFactory.builder().get();
> > // sets temporary location to store files
> > factory.setPath(path); // does not have setter for path
> > factory.setRepository();// does not have setter for repo, it does have the
> > getter though
> >
> >
> > or I tried to see if Jakarta has setter available
> >
> > JakartaServletDiskFileUpload upload = new
> > JakartaServletDiskFileUpload(factory);
> > upload.setSizeMax(MEMORY_THRESHOLD);
> > upload.setSizeMax(MEMORY_THRESHOLD);
> > upload.setPath(path);// not there eiter
> >
> >
> >
> >
> > Sent: Friday, July 05, 2024 at 9:04 PM
> > From: "Gary Gregory" <ga...@gmail.com>
> > To: "Commons Developers List" <de...@commons.apache.org>
> > Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2
> > -DiskItemFile setPath
> > Hello,
> >
> > Could you point out precisely in code what you are wanting to do with
> > DiskFileFactory?
> >
> > Gary
> >
> > On Fri, Jul 5, 2024 at 8:18 AM sendi Tho <se...@mail.com.invalid>
> > wrote:
> > >
> > > Greetings guys,
> > >
> > >
> > > I am trying to use the new "commons-fileupload2-jakarta-servlet6"
> > > <dependency>
> > > <groupId>org.apache.commons</groupId>
> > > <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
> > > <version>2.0.0-M2</version>
> > > </dependency>
> > >
> > >
> > > looks like the M2 jar from maven and the code differs ( getting warning
> > like bycode and source code does not match).
> > >
> > > so currently this build does not allow DiskFileFactory api users to set
> > the repository path.. is this intentional ? how to set the path?
> > >
> > > the path seems to come from FileItemFactory, but as FileItemFactory is
> > abstract and DiskItemFactory delegates through its builder the path setter
> > is lost.
> > >
> > > also I could not find the 1.x prod build ( assuming we are on 2.x
> > version) of upload2 servlet6. the 2.x using the builder and change in api..
> > I just wanted to change the package name to jakarta and be done with this..
> > :)
> > >
> > > thanks in advance.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Posted by sendi Tho <se...@mail.com.INVALID>.
Thank you for looking. I may be not clear .. here is what I am trying to say.
1.) The 2.0.0.M2 is using commons-io 2.16.1, here is the api
https://commons.apache.org/proper//commons-io/apidocs/org/apache/commons/io/build/AbstractStreamBuilder.html
setPath not public
2.) https://github.com/apache/commons-fileupload/blob/master/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/DiskFileItemFactory.java#L71
public static class Builder extends AbstractStreamBuilder<DiskFileItemFactory, Builder> { ...}
does not have setPath() so we api consumers don;t have access to this setter.
3.) The following call from documentation does not work, as setPath is not available.
DiskFileItemFactory factory = DiskFileItemFactory.builder().setPath(path).setBufferSize(DEFAULT_THRESHOLD).get();
------------------------------------------------------------------------------------------------------------
Sent: Saturday, July 06, 2024 at 2:31 PM
From: "Gary Gregory" <ga...@gmail.com>
To: "Commons Developers List" <de...@commons.apache.org>
Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Those two methods are public. What am I missing?
Gary
On Sat, Jul 6, 2024, 11:09 AM sendi Tho <se...@mail.com.invalid> wrote:
> the exact issue I think is
>
> DiskFileItemFactory.Builder does not expose the property setPath and
> setBufferSize.
>
>
> in this file line# 82, #83
>
> commons-fileupload/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/DiskFileItemFactory.java
>
>
> TIA.
>
>
>
>
>
> Sent: Friday, July 05, 2024 at 11:31 PM
> From: "sendi Tho" <se...@mail.com.INVALID>
> To: dev@commons.apache.org
> Cc: "Commons Developers List" <de...@commons.apache.org>
> Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2
> -DiskItemFile setPath
> hi, thank you for reviewing this. I am just trying to set the path for
> temporaty file location for upload
>
>
> String path = new File(System.getProperty("java.io.tmpdir")).getPath();
>
> DiskFileItemFactory factory = DiskFileItemFactory.builder().get();
> // sets temporary location to store files
> factory.setPath(path); // does not have setter for path
> factory.setRepository();// does not have setter for repo, it does have the
> getter though
>
>
> or I tried to see if Jakarta has setter available
>
> JakartaServletDiskFileUpload upload = new
> JakartaServletDiskFileUpload(factory);
> upload.setSizeMax(MEMORY_THRESHOLD);
> upload.setSizeMax(MEMORY_THRESHOLD);
> upload.setPath(path);// not there eiter
>
>
>
>
> Sent: Friday, July 05, 2024 at 9:04 PM
> From: "Gary Gregory" <ga...@gmail.com>
> To: "Commons Developers List" <de...@commons.apache.org>
> Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2
> -DiskItemFile setPath
> Hello,
>
> Could you point out precisely in code what you are wanting to do with
> DiskFileFactory?
>
> Gary
>
> On Fri, Jul 5, 2024 at 8:18 AM sendi Tho <se...@mail.com.invalid>
> wrote:
> >
> > Greetings guys,
> >
> >
> > I am trying to use the new "commons-fileupload2-jakarta-servlet6"
> > <dependency>
> > <groupId>org.apache.commons</groupId>
> > <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
> > <version>2.0.0-M2</version>
> > </dependency>
> >
> >
> > looks like the M2 jar from maven and the code differs ( getting warning
> like bycode and source code does not match).
> >
> > so currently this build does not allow DiskFileFactory api users to set
> the repository path.. is this intentional ? how to set the path?
> >
> > the path seems to come from FileItemFactory, but as FileItemFactory is
> abstract and DiskItemFactory delegates through its builder the path setter
> is lost.
> >
> > also I could not find the 1.x prod build ( assuming we are on 2.x
> version) of upload2 servlet6. the 2.x using the builder and change in api..
> I just wanted to change the package name to jakarta and be done with this..
> :)
> >
> > thanks in advance.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Posted by Gary Gregory <ga...@gmail.com>.
Those two methods are public. What am I missing?
Gary
On Sat, Jul 6, 2024, 11:09 AM sendi Tho <se...@mail.com.invalid> wrote:
> the exact issue I think is
>
> DiskFileItemFactory.Builder does not expose the property setPath and
> setBufferSize.
>
>
> in this file line# 82, #83
>
> commons-fileupload/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/DiskFileItemFactory.java
>
>
> TIA.
>
>
>
>
>
> Sent: Friday, July 05, 2024 at 11:31 PM
> From: "sendi Tho" <se...@mail.com.INVALID>
> To: dev@commons.apache.org
> Cc: "Commons Developers List" <de...@commons.apache.org>
> Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2
> -DiskItemFile setPath
> hi, thank you for reviewing this. I am just trying to set the path for
> temporaty file location for upload
>
>
> String path = new File(System.getProperty("java.io.tmpdir")).getPath();
>
> DiskFileItemFactory factory = DiskFileItemFactory.builder().get();
> // sets temporary location to store files
> factory.setPath(path); // does not have setter for path
> factory.setRepository();// does not have setter for repo, it does have the
> getter though
>
>
> or I tried to see if Jakarta has setter available
>
> JakartaServletDiskFileUpload upload = new
> JakartaServletDiskFileUpload(factory);
> upload.setSizeMax(MEMORY_THRESHOLD);
> upload.setSizeMax(MEMORY_THRESHOLD);
> upload.setPath(path);// not there eiter
>
>
>
>
> Sent: Friday, July 05, 2024 at 9:04 PM
> From: "Gary Gregory" <ga...@gmail.com>
> To: "Commons Developers List" <de...@commons.apache.org>
> Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2
> -DiskItemFile setPath
> Hello,
>
> Could you point out precisely in code what you are wanting to do with
> DiskFileFactory?
>
> Gary
>
> On Fri, Jul 5, 2024 at 8:18 AM sendi Tho <se...@mail.com.invalid>
> wrote:
> >
> > Greetings guys,
> >
> >
> > I am trying to use the new "commons-fileupload2-jakarta-servlet6"
> > <dependency>
> > <groupId>org.apache.commons</groupId>
> > <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
> > <version>2.0.0-M2</version>
> > </dependency>
> >
> >
> > looks like the M2 jar from maven and the code differs ( getting warning
> like bycode and source code does not match).
> >
> > so currently this build does not allow DiskFileFactory api users to set
> the repository path.. is this intentional ? how to set the path?
> >
> > the path seems to come from FileItemFactory, but as FileItemFactory is
> abstract and DiskItemFactory delegates through its builder the path setter
> is lost.
> >
> > also I could not find the 1.x prod build ( assuming we are on 2.x
> version) of upload2 servlet6. the 2.x using the builder and change in api..
> I just wanted to change the package name to jakarta and be done with this..
> :)
> >
> > thanks in advance.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Posted by sendi Tho <se...@mail.com.INVALID>.
the exact issue I think is
DiskFileItemFactory.Builder does not expose the property setPath and setBufferSize.
in this file line# 82, #83
commons-fileupload/commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/DiskFileItemFactory.java
TIA.
Sent: Friday, July 05, 2024 at 11:31 PM
From: "sendi Tho" <se...@mail.com.INVALID>
To: dev@commons.apache.org
Cc: "Commons Developers List" <de...@commons.apache.org>
Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
hi, thank you for reviewing this. I am just trying to set the path for temporaty file location for upload
String path = new File(System.getProperty("java.io.tmpdir")).getPath();
DiskFileItemFactory factory = DiskFileItemFactory.builder().get();
// sets temporary location to store files
factory.setPath(path); // does not have setter for path
factory.setRepository();// does not have setter for repo, it does have the getter though
or I tried to see if Jakarta has setter available
JakartaServletDiskFileUpload upload = new JakartaServletDiskFileUpload(factory);
upload.setSizeMax(MEMORY_THRESHOLD);
upload.setSizeMax(MEMORY_THRESHOLD);
upload.setPath(path);// not there eiter
Sent: Friday, July 05, 2024 at 9:04 PM
From: "Gary Gregory" <ga...@gmail.com>
To: "Commons Developers List" <de...@commons.apache.org>
Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Hello,
Could you point out precisely in code what you are wanting to do with
DiskFileFactory?
Gary
On Fri, Jul 5, 2024 at 8:18 AM sendi Tho <se...@mail.com.invalid> wrote:
>
> Greetings guys,
>
>
> I am trying to use the new "commons-fileupload2-jakarta-servlet6"
> <dependency>
> <groupId>org.apache.commons</groupId>
> <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
> <version>2.0.0-M2</version>
> </dependency>
>
>
> looks like the M2 jar from maven and the code differs ( getting warning like bycode and source code does not match).
>
> so currently this build does not allow DiskFileFactory api users to set the repository path.. is this intentional ? how to set the path?
>
> the path seems to come from FileItemFactory, but as FileItemFactory is abstract and DiskItemFactory delegates through its builder the path setter is lost.
>
> also I could not find the 1.x prod build ( assuming we are on 2.x version) of upload2 servlet6. the 2.x using the builder and change in api.. I just wanted to change the package name to jakarta and be done with this.. :)
>
> thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Posted by sendi Tho <se...@mail.com.INVALID>.
hi, thank you for reviewing this. I am just trying to set the path for temporaty file location for upload
String path = new File(System.getProperty("java.io.tmpdir")).getPath();
DiskFileItemFactory factory = DiskFileItemFactory.builder().get();
// sets temporary location to store files
factory.setPath(path); // does not have setter for path
factory.setRepository();// does not have setter for repo, it does have the getter though
or I tried to see if Jakarta has setter available
JakartaServletDiskFileUpload upload = new JakartaServletDiskFileUpload(factory);
upload.setSizeMax(MEMORY_THRESHOLD);
upload.setSizeMax(MEMORY_THRESHOLD);
upload.setPath(path);// not there eiter
Sent: Friday, July 05, 2024 at 9:04 PM
From: "Gary Gregory" <ga...@gmail.com>
To: "Commons Developers List" <de...@commons.apache.org>
Subject: Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Hello,
Could you point out precisely in code what you are wanting to do with
DiskFileFactory?
Gary
On Fri, Jul 5, 2024 at 8:18 AM sendi Tho <se...@mail.com.invalid> wrote:
>
> Greetings guys,
>
>
> I am trying to use the new "commons-fileupload2-jakarta-servlet6"
> <dependency>
> <groupId>org.apache.commons</groupId>
> <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
> <version>2.0.0-M2</version>
> </dependency>
>
>
> looks like the M2 jar from maven and the code differs ( getting warning like bycode and source code does not match).
>
> so currently this build does not allow DiskFileFactory api users to set the repository path.. is this intentional ? how to set the path?
>
> the path seems to come from FileItemFactory, but as FileItemFactory is abstract and DiskItemFactory delegates through its builder the path setter is lost.
>
> also I could not find the 1.x prod build ( assuming we are on 2.x version) of upload2 servlet6. the 2.x using the builder and change in api.. I just wanted to change the package name to jakarta and be done with this.. :)
>
> thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [commons-fileupload2-jakarta-servlet6] - 2.0.0.M2 -DiskItemFile setPath
Posted by Gary Gregory <ga...@gmail.com>.
Hello,
Could you point out precisely in code what you are wanting to do with
DiskFileFactory?
Gary
On Fri, Jul 5, 2024 at 8:18 AM sendi Tho <se...@mail.com.invalid> wrote:
>
> Greetings guys,
>
>
> I am trying to use the new "commons-fileupload2-jakarta-servlet6"
> <dependency>
> <groupId>org.apache.commons</groupId>
> <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
> <version>2.0.0-M2</version>
> </dependency>
>
>
> looks like the M2 jar from maven and the code differs ( getting warning like bycode and source code does not match).
>
> so currently this build does not allow DiskFileFactory api users to set the repository path.. is this intentional ? how to set the path?
>
> the path seems to come from FileItemFactory, but as FileItemFactory is abstract and DiskItemFactory delegates through its builder the path setter is lost.
>
> also I could not find the 1.x prod build ( assuming we are on 2.x version) of upload2 servlet6. the 2.x using the builder and change in api.. I just wanted to change the package name to jakarta and be done with this.. :)
>
> thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org