Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Publish webapp without deleting generated folders
Publish webapp without deleting generated folders [message #547663] Mon, 19 July 2010 06:10 Go to next message
Tarek is currently offline Tarek
Messages: 6
Registered: July 2010
Junior Member
Hello!

I am developing a kind of content management system. Uploading files with the cms will generate folders with these content in the webapp directory. When i republish the webapp all created folders and the content is deleted.

Is it possible to exclude some files/folders from deletion while republishing a webapp?

I am using eclipse Galileo and Web Developer Tools 3.1.1

Thanks
Tarek
Re: Publish webapp without deleting generated folders [message #547730 is a reply to message #547663] Mon, 19 July 2010 09:28 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 7/19/2010 6:10 AM, Tarek wrote:
> Hello!
> I am developing a kind of content management system. Uploading files
> with the cms will generate folders with these content in the webapp
> directory. When i republish the webapp all created folders and the
> content is deleted.
> Is it possible to exclude some files/folders from deletion while
> republishing a webapp?
> I am using eclipse Galileo and Web Developer Tools 3.1.1
>
> Thanks
> Tarek

Server publishing is designed to keep the published project synchronized
with the project in the workspace. If something exists in the published
project that doesn't exist in the workspace project, it assumes you
deleted it from the workspace project and therefore deletes it from the
published project. I don't know of any way to work around this behavior.

Cheers,
Larry
Re: Publish webapp without deleting generated folders [message #547750 is a reply to message #547730] Mon, 19 July 2010 10:22 Go to previous messageGo to next message
Tarek is currently offline Tarek
Messages: 6
Registered: July 2010
Junior Member
Larry Isaacs wrote on Mon, 19 July 2010 09:28
On 7/19/2010 6:10 AM, Tarek wrote:
> Hello!
> I am developing a kind of content management system. Uploading files
> with the cms will generate folders with these content in the webapp
> directory. When i republish the webapp all created folders and the
> content is deleted.
> Is it possible to exclude some files/folders from deletion while
> republishing a webapp?
> I am using eclipse Galileo and Web Developer Tools 3.1.1
>
> Thanks
> Tarek

Server publishing is designed to keep the published project synchronized
with the project in the workspace. If something exists in the published
project that doesn't exist in the workspace project, it assumes you
deleted it from the workspace project and therefore deletes it from the
published project. I don't know of any way to work around this behavior.

Cheers,
Larry


Hi Larry,

thanks for the fast answer. The tools do their synchronzing jobs very good:-) But we are developing an uploading tool which generates some gigs of jpegs and movies which must be downloadable within the same webapp. We dont want to put this data in our workspace project.
Do you have a hint were i can start hacking/changing the publishing? We just changed from old eclipse 3.3 with sysdeo tomcat plugin to 3.5 with WTP and we dont want to go back.

Regards
Tarek
Re: Publish webapp without deleting generated folders [message #547776 is a reply to message #547750] Mon, 19 July 2010 11:11 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 7/19/2010 10:22 AM, Tarek wrote:
> Larry Isaacs wrote on Mon, 19 July 2010 09:28
>> On 7/19/2010 6:10 AM, Tarek wrote:
>> > Hello!
>> > I am developing a kind of content management system. Uploading files
>> > with the cms will generate folders with these content in the webapp
>> > directory. When i republish the webapp all created folders and the
>> > content is deleted.
>> > Is it possible to exclude some files/folders from deletion while
>> > republishing a webapp?
>> > I am using eclipse Galileo and Web Developer Tools 3.1.1
>> >
>> > Thanks
>> > Tarek
>>
>> Server publishing is designed to keep the published project
>> synchronized with the project in the workspace. If something exists in
>> the published project that doesn't exist in the workspace project, it
>> assumes you deleted it from the workspace project and therefore
>> deletes it from the published project. I don't know of any way to work
>> around this behavior.
>>
>> Cheers,
>> Larry
>
>
> Hi Larry,
>
> thanks for the fast answer. The tools do their synchronzing jobs very
> good:-) But we are developing an uploading tool which generates some
> gigs of jpegs and movies which must be downloadable within the same
> webapp. We dont want to put this data in our workspace project.
> Do you have a hint were i can start hacking/changing the publishing? We
> just changed from old eclipse 3.3 with sysdeo tomcat plugin to 3.5 with
> WTP and we dont want to go back.
>
> Regards
> Tarek
>

If you grab source for the org.eclipse.tomcat.core plug-in and start
with PublishOperation2.publishDir(). This method is responsible for
publishing the web content of the project when the Server Location is
configured for the default "Use workspace metadata(...)" and "Serve
modules without publishing" is not enabled. I suspect
org.eclipse.wst.server.core.util.PublishHelper is the class that will
need hacking.

An alternative that is more Servlet Spec compliant is to store the data
external of the web application and provide a servlet that can serve the
content from the external location.

Cheers,
Larry
Re: Publish webapp without deleting generated folders [message #547778 is a reply to message #547776] Mon, 19 July 2010 11:25 Go to previous messageGo to next message
Tarek is currently offline Tarek
Messages: 6
Registered: July 2010
Junior Member
Thanks for the Info, i will give it a try!!

Quote:
An alternative that is more Servlet Spec compliant is to store the data
external of the web application and provide a servlet that can serve the
content from the external location.


hmm, more Spec compliant sounds good! Perhaps i can convince our team.

Thanks!
Tarek
Re: Publish webapp without deleting generated folders [message #547813 is a reply to message #547663] Mon, 19 July 2010 12:13 Go to previous messageGo to next message
Eclipse User
Originally posted by: nowhere.a.com

Tarek wrote :
> Hello!
>
> I am developing a kind of content management system. Uploading files with the
> cms will generate folders with these content in the webapp directory. When i
> republish the webapp all created folders and the content is deleted.
>
> Is it possible to exclude some files/folders from deletion while republishing
> a webapp?

I had the same issue. I had the application create the set of folders
and content "beside" the main project

TomCat/webapps/mainproject
TimCat/webapps/foldersystem

Since "foldersystem" is not part of he project within Eclipse, then it
is not touched. yet Tomcat can see it as it is in its webb application
system.

--
Wojtek :-)
Re: Publish webapp without deleting generated folders [message #547903 is a reply to message #547778] Tue, 20 July 2010 03:13 Go to previous messageGo to next message
Tarek is currently offline Tarek
Messages: 6
Registered: July 2010
Junior Member

Quote:
An alternative that is more Servlet Spec compliant is to store the data
external of the web application and provide a servlet that can serve the
content from the external location.



@Larry: why is this not Spec compliant?
Re: Publish webapp without deleting generated folders [message #547904 is a reply to message #547813] Tue, 20 July 2010 03:14 Go to previous messageGo to next message
Tarek is currently offline Tarek
Messages: 6
Registered: July 2010
Junior Member
Eclipse User wrote on Mon, 19 July 2010 12:13
Originally posted by: nowhere.a.com

Tarek wrote :
> Hello!
>
> I am developing a kind of content management system. Uploading files with the
> cms will generate folders with these content in the webapp directory. When i
> republish the webapp all created folders and the content is deleted.
>
> Is it possible to exclude some files/folders from deletion while republishing
> a webapp?

I had the same issue. I had the application create the set of folders
and content "beside" the main project

TomCat/webapps/mainproject
TimCat/webapps/foldersystem

Since "foldersystem" is not part of he project within Eclipse, then it
is not touched. yet Tomcat can see it as it is in its webb application
system.

--
Wojtek Smile


Thanks for the hint! I will have a look if this works with our application, too.
Re: Publish webapp without deleting generated folders [message #548054 is a reply to message #547903] Tue, 20 July 2010 09:36 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 7/20/2010 3:13 AM, Tarek wrote:
>
> Quote:
>> An alternative that is more Servlet Spec compliant is to store the data
>> external of the web application and provide a servlet that can serve the
>> content from the external location.
>
>
> @Larry: why is this not Spec compliant?

The Servlet Spec only says guarantees you can deploy a WAR to the
servlet container and it will serve it. It makes no guarantees about
how the web application will be served. Serving the web application via
the file system is not required. This is why
ServletContext.getRealPath() is allowed to return null. By making your
web application self-modifying, you may be creating portability and
security issues. It would depend on your use case how much these mattered.

Cheers,
Larry
Re: Publish webapp without deleting generated folders [message #548489 is a reply to message #548054] Thu, 22 July 2010 03:15 Go to previous message
Tarek is currently offline Tarek
Messages: 6
Registered: July 2010
Junior Member
Larry Isaacs wrote on Tue, 20 July 2010 09:36
On 7/20/2010 3:13 AM, Tarek wrote:
>
> Quote:
>> An alternative that is more Servlet Spec compliant is to store the data
>> external of the web application and provide a servlet that can serve the
>> content from the external location.
>
>
> @Larry: why is this not Spec compliant?

The Servlet Spec only says guarantees you can deploy a WAR to the
servlet container and it will serve it. It makes no guarantees about
how the web application will be served. Serving the web application via
the file system is not required. This is why
ServletContext.getRealPath() is allowed to return null. By making your
web application self-modifying, you may be creating portability and
security issues. It would depend on your use case how much these mattered.

Cheers,
Larry


Hi Larry,

that's a point I didnt considered.

Thanks
Tarek
Previous Topic:Create own server adapter
Next Topic:Eclipse - setup steps for Web service application
Goto Forum:
  


Current Time: Thu Aug 28 11:23:32 EDT 2014

Powered by FUDForum. Page generated in 0.02755 seconds