Annoying publish on Server during development [message #196028] |
Wed, 11 July 2007 13:33 |
Eclipse User |
|
|
|
Originally posted by: tjerk.wolterinkwebdesign.com
Case:
I have a webproject
and a webserver (Tomcat 5.5) on which i
test my project.
Server Settings:
-Server
Security is disabled
Tomcat Debug mode is disabled
'Run directly from workspace' is disabled
-Automatic Publishing
publish interval: 3 seconds
Problem:
Each time i update i file in my workspace webproject
it will trigger the publish timer (3 seconds).
After those 3 seconds my running project on the server
is synchronized (updated).
This is exactly what i want
BUT:
When your project that runs under tomcat created directories
programmatically (for examples /uploads/images is created)
then each time a publish takes place the created directory is
deleted (i.e. synchronized with the directory structure in your workspace)
This is a problem with my project, because each time the
uploaded files are deleted, because those files are not in my
workspace (that is correct behaviour)
Question:
- How can i prevent the "publish" action to delete certain
created directories?
Without this feature my testing procedure is really annoying,
( because the uploaded files are gone on each publish )
Side note:
I have AspectJ installed, this alters the build process,
could this be the problem?
I hope someone can give me some help, this is the third time i post
this question.
Thanks in advance!
|
|
|
|
|
Re: Annoying publish on Server during development [message #196105 is a reply to message #196028] |
Wed, 11 July 2007 17:21 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
While it may not be unusual for a self-modifying webapp to work
successfully in a servlet-container or app server, there isn't anything
in the servlet spec that I'm aware of that requires this to work. Thus,
the servers on which you can run this webapp may be limited, though
Tomcat would be one on which it works.
The issue you face is that it was deemed too expensive (i.e. a lot of
work to code while avoiding bugs and performance issues) to micromanage
resources with respect to server publishing. As a result, the goal of
publishing is simply to synchronize your project with the published
webapp. In the case of files found in the published webapp that do not
exist in the project, they are assumed to have existed in the project
but were deleted. Thus, publishing deletes them from the webapp too.
To work around this issue when using Tomcat, I would say your best bet
is to upgrade to Eclipse 3.3 and WTP 2.0. In the server settings, there
is a new option called "Serve Modules without publishing". With this
option checked, the WebContent folder will be served directly and the
created files will appear in your project. This should avoid the
deletion problem. You may need to refresh the project occasionally to
keep your workspace in sync with files created in the file system. Doing
so should allow you to delete them from Eclipse when desired.
Cheers,
Larry
Tjerk Wolterink wrote:
> Case:
>
> I have a webproject
> and a webserver (Tomcat 5.5) on which i
> test my project.
>
> Server Settings:
> -Server
> Security is disabled
> Tomcat Debug mode is disabled
> 'Run directly from workspace' is disabled
> -Automatic Publishing
> publish interval: 3 seconds
>
>
> Problem:
> Each time i update i file in my workspace webproject
> it will trigger the publish timer (3 seconds).
>
> After those 3 seconds my running project on the server
> is synchronized (updated).
> This is exactly what i want
>
> BUT:
>
> When your project that runs under tomcat created directories
> programmatically (for examples /uploads/images is created)
> then each time a publish takes place the created directory is
> deleted (i.e. synchronized with the directory structure in your workspace)
>
> This is a problem with my project, because each time the
> uploaded files are deleted, because those files are not in my workspace
> (that is correct behaviour)
>
>
> Question:
> - How can i prevent the "publish" action to delete certain
> created directories?
> Without this feature my testing procedure is really annoying,
> ( because the uploaded files are gone on each publish )
>
>
> Side note:
> I have AspectJ installed, this alters the build process,
> could this be the problem?
>
>
>
> I hope someone can give me some help, this is the third time i post this
> question.
>
> Thanks in advance!
|
|
|
Re: Annoying publish on Server during development [message #196121 is a reply to message #196105] |
Wed, 11 July 2007 17:37 |
Eclipse User |
|
|
|
Originally posted by: tjerk.wolterinkwebdesign.com
Larry Isaacs schreef:
> While it may not be unusual for a self-modifying webapp to work
> successfully in a servlet-container or app server, there isn't anything
> in the servlet spec that I'm aware of that requires this to work. Thus,
> the servers on which you can run this webapp may be limited, though
> Tomcat would be one on which it works.
>
Ok Larry Thanks for your info!
I understand all your information,
but one question remains:
You say it is not in the specs..
Thus am i using a wrong method for the handling of file uploads?
(i put the file uplaods directly under the the web folder)
What is the correct method of handling file uploads?
I could put them in a database but serving large files from a database
is not really good...
I also could put them in a non webserver-directory and write
a FileHandlerServlet that serves these files...
But this is exactly what the DefaultServlet in Tomcat does...
This servlet handles the serving of files and
has a lot of http features implemented....
I cannot use the DefaultServlet because it is baked into tomcat..
What is the 'normal' wat of handling file uploads that
need to be published on the running webserver?
(a method that is correct with respect to the specifications)
--
Tjerk Wolterink
|
|
|
Re: Annoying publish on Server during development [message #196129 is a reply to message #196089] |
Wed, 11 July 2007 17:39 |
Eclipse User |
|
|
|
Originally posted by: tjerk.wolterinkwebdesign.com
David Carver schreef:
> Tjerk Wolterink wrote:
>>
>> Please respond if you dont understand my question...
>
> You're best bet to get this addressed is to file a bug report under the
> Web Tools section. You can file the bug at:
>
> http://bugs.eclipse.org/bugs
>
> Dave
Well maybe it is a bug,
But as Larry Isaacs noted eclipse is
handling this correct with respect to the specs..
This means that i am handling file uploads the wrong way????
I donnot know..
(see my response to larry's message)
|
|
|
Re: Annoying publish on Server during development [message #196145 is a reply to message #196121] |
Wed, 11 July 2007 18:51 |
Eclipse User |
|
|
|
Originally posted by: kosta.bea.com
You would typically put app data (in your case uploaded files)
separately from the app code. Typically, you will want to make the
location configurable. Then you write a servlet (or something else) that
grabs urls of certain format, figures out what user data to fetch, and
pipes the file back to the client.
- Konstantin
|
|
|
Re: Annoying publish on Server during development [message #196161 is a reply to message #196121] |
Wed, 11 July 2007 19:05 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
The only thing I believe the servlet spec promises to a webapp is that
the "javax.servlet.context.tempdir" context attribute will contain a
java.io.File object that references a writable directory. As a "temp"
directory the server is not required to preserve files across a restart.
If you want files that persist, then it means going outside the spec. I
think the alternative is as mentioned in other posts, use a directory
outside of the webapp and a servlet to serve the files as needed. You
could start with the source for the DefaultServlet to see if you can
derive a servlet that will meet your needs. However, I haven't done
much work with the DefaultServlet, so I can't say how tied to Tomcat
internals it might be and if that might be difficult to fix. Using an
outside directory would have the advantage of putting the files in a
"safe" place. Even though your current webapp is "working" under
Tomcat, under the right circumstances, Tomcat could also delete your
files depending on how the webapp is deployed or re-deployed.
Cheers,
Larry
Tjerk Wolterink wrote:
> Larry Isaacs schreef:
>> While it may not be unusual for a self-modifying webapp to work
>> successfully in a servlet-container or app server, there isn't
>> anything in the servlet spec that I'm aware of that requires this to
>> work. Thus, the servers on which you can run this webapp may be
>> limited, though Tomcat would be one on which it works.
>>
>
> Ok Larry Thanks for your info!
>
> I understand all your information,
> but one question remains:
>
> You say it is not in the specs..
>
> Thus am i using a wrong method for the handling of file uploads?
> (i put the file uplaods directly under the the web folder)
> What is the correct method of handling file uploads?
> I could put them in a database but serving large files from a database
> is not really good...
>
> I also could put them in a non webserver-directory and write
> a FileHandlerServlet that serves these files...
> But this is exactly what the DefaultServlet in Tomcat does...
> This servlet handles the serving of files and
> has a lot of http features implemented....
>
> I cannot use the DefaultServlet because it is baked into tomcat..
>
> What is the 'normal' wat of handling file uploads that
> need to be published on the running webserver?
> (a method that is correct with respect to the specifications)
>
>
> --
> Tjerk Wolterink
|
|
|
Powered by
FUDForum. Page generated in 0.02843 seconds