Sorry List,

I just sent the message I found some mistakes on the example code.

This is the corrected code

public String cssStyle = ((Application)application()).baseURL() + "/" + ((Application)application()).name()+ ".woa/Contents/ WebServerResources/CSS/style.css";

public String myJS = ((Application)application()).baseURL() + "/" + ((Application)application()).name()+ ".woa/Contents/ WebServerResources/JS/myJS.js";

On my HTML and WOD file I create components like these:

(HTML FOR CSS)
<webobject name = "ThemeCSS" />

(WOD FOR CSS)
ThemeCSS: WOGenericElement {
        elementName = "link";
        rel = "stylesheet";
        type = "text/css";
        href = cssStyle;
}

(HTML for JavaScript)

<webobject name = "myJS" />

(WOD for JavaScript)

myJS: WOJavaScript {
        scriptSource = myJS;
}


At runtime I get the following HTML code:

(CSS)

<link href="/WebObjects/myApp.woa/Contents/WebServerResources/CSS/ style.css" type="text/css" rel="stylesheet">

(JavaScript)

<script src="/WebObjects/myApp.woa/Contents/WebServerResources/JS/ myJS.js" type="text/javascript">




On Mar 4, 2009, at 9:38 AM, Miguel Angel Torres Avila wrote:

Hi List,


For those who have CSS and JavaScript files on their WebServerResources and do not use Project Wonder Framework (I think it is easier with that Framework) and want to deploy on TOMCAT I just find a simple way to access those resources.

First,

On my application y generate links like these to access my resources:

public String cssStyle = ((Application)application()).baseURL() + "/" + ((Application)application()).name()+ ".woa/Contents/ WebServerResources/CSS/style.css";

public String myJS = ((Application)application()).baseURL() + "/" + ((Application)application()).name()+ ".woa/Contents/ WebServerResources/JS/myJS.js";

On my HTML and WOD file I create components like these:

(HTML FOR CSS)
<webobject name = "ThemeCSS" />

(WOD FOR CSS)
ThemeCSS: WOGenericElement {
        elementName = "link";
        rel = "stylesheet";
        type = "text/css";
        href = cssStyle;
}

(HTML for JavaScript)

<webobject name = "myJS" />

(WOD for JavaScript)

loadingJS: WOJavaScript {
        scriptSource = myJS;
}


At runtime I get the following HTML code:

(CSS)

<link href="/WebObjects/myApp.woa/Contents/WebServerResources/CSS/ style.css" type="text/css" rel="stylesheet">

(JavaScript)

<script src="/WebObjects/myApp.woa/Contents/WebServerResources/ JavaScript/scriptaculous/controls.js" type="text/javascript">


In a WebObjects Split installation I just make a copy (or symbolic link) of myApp WebServer resources to MY_WEB_SERVER_ROOT_DIRECTORY/ WebObjects/myApp.woa/Contents/


But in Tomcat I was not sure how to do that because on runtime my app was accessible via a URL like this: http://localhost:8080/myApp/WebObjects/myApp.woa, so my generated URL's for CSS an JS resources (/WebObjects/myApp.woa/Contents/ WebServerResources/CSS/style.css" type="text/css)
tried to find it here
http://localhost:8080/WebObjects/myApp.woa/Contents/ WebServerResources/CSS/style.css" type="text/css using the port, so it was not matter that I published my WebServerResources on my WebServer because the URL's were relative to the root path of TOMCAT.

Then I found that TOMCAT has the ROOT folder inside the webapps folder and it works like the WebServer's Root Directory, so anything you put there you can access it using URL's like this

http://mySite:myTomcatPort/myResourse, example (http://localhost: 8080/myPage.html)

So, It is just necessary to create the WebObjects folder inside the TOMCAT's ROOT folder and a folder for each project you deploy on it, and obviously create the Contents/WebServerResources structure inside the project's folder.

It also works for Frameworks, just create the directory Frameworks inside the WebObjects folder and a folder for each Framework's WebServerResourses you want to publish, and finally copy the WebServerResources of the framework to its folder.


Hope this results helpful for some one.


_______________________________
Ing. Miguel Angel Torres Avila





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to