aspose file tools*
The moose likes Servlets and the fly likes sharing  of resources like  html  / jsp out of  web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sharing  of resources like  html  / jsp out of  web application" Watch "sharing  of resources like  html  / jsp out of  web application" New topic
Author

sharing of resources like html / jsp out of web application

vijay dadhwal
Ranch Hand

Joined: Dec 02, 2008
Posts: 47

hi guys,

my name is vijay dadhwal
i have registered today at javaranch.com

i have a question.

From my webapplication, how do we access html / jsp pages from the domain which are not running under any servlet engine.

regards
vj
[ December 02, 2008: Message edited by: Bear Bibeault ]

MCA , SJCP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61424
    
  67

You don't. A servlet engine is required to process servlets and JSP pages.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Richard Corbin
Greenhorn

Joined: Nov 22, 2008
Posts: 12
I think I know what you mean, I'm doing the same thing. You have an HTML file thats used as an internal resource to be distributed with the bundle and you wish to pre/app-end this content to a servlet's output stream?

If thats the case the next question is are you just reading or are you in need of filelocks for synchronized writing? If you are just reading, you would use standard file reading procedures. Do this in a servlet that you initialize on startup, store it in a public static String in a global resources class/enum and you wont have to read anything again throughout the life cycle of the app.

If you need reads and writes on *file* in a specific order (gulp)

public writefile(String FileName, String content){
!isLocked ? call method below
}

private synchronized String SetFileContents(String FileName, String content) {
lock file access,
update file revision id,
re-buffer to global variable/store,
unlock
}

I highlight file because you can, to an extent do the same thing with the String Buffer you cached without syncing your app.
Laxman Jadi
Greenhorn

Joined: Dec 02, 2008
Posts: 1
You can use c:import to locate resource.
vijay dadhwal
Ranch Hand

Joined: Dec 02, 2008
Posts: 47

Hi guys,

I really appreciate your prompt reply for this thread.

just making my earlier question more precise with example.
domain-1 say, A.com is running web application under say tomcat
domain-2 say, B.com is running as website under IIS
now b.com contains many html files which needs to be published as footer by domain A.com's JSP pages.

As i know by default JSP can use jsp:include file = "url" to call other html files but it has it's own contraints :-

(1) Domain name cannot be part of url
(2) Context root of the URL should be visible to the calling JSP.

How do i make the context root of the IIS based B.com website visible to A.com ? so that i can use the resources atleast static HTML pages of B.com on my will.

Regards
vj
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61424
    
  67

The best place to do this sharing is at build time, not at run time.

A single copy of the shared file can be stored in a source-control repository, but propagated to all web apps that need it when the war files are being built.
vijay dadhwal
Ranch Hand

Joined: Dec 02, 2008
Posts: 47

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sharing of resources like html / jsp out of web application