Re: How to target a WO component in an html include
Re: How to target a WO component in an html include
- Subject: Re: How to target a WO component in an html include
- From: Chuck Hill <email@hidden>
- Date: Fri, 21 Mar 2008 10:03:16 -0700
Hi Reid,
See fix below.
On Mar 21, 2008, at 9:35 AM, Reid Bundonis wrote:
On Mar 20, 2008, at 2:59 PM, Chuck Hill wrote:
Info: New request is GET /Apps/WebObjects/Classes.woa/1/wa/default
INCLUDED
That INCLUDED on the end looks unusual to me.
Info: Request GET /Apps/WebObjects/Classes.woa/1/wa/default INCLUDED
sent, awaiting response
Waiting....
Info: Reading configuration from http://localhost:1085/WebObjects/wotaskd.woa/wa/woconfig
Info: attempting to connect to localhost on port 1085
Info: Preparing to read config for host: localhost
Info: New response: HTTP/1.0 200 Apple WebObjects
Debug: nonBlockingRecv(): recv() returned 0 (connection closed)
Info: retrying request due to connection reset
And the app did not respond.
What I would do now is to override dispatchRequest() in the
application and log out the request.uri and all of the headers.
Then call super in a try...catch:
try {
return super.dispatchRequest(request);
}
catch (Exception e) {
NSLog.out.appendln(e);
throw e;
}
See if it gets as far as dispatch request and if it throws.
<snip>
Luckily I have your book :) Page 18 was what the doctor ordered.
In any case, I put in the logging code and output to a file. I
started the application from the command line instead of WOMonitor
and watched the output. This is what I get when I hit the app
directly using http://fqdn/Apps/WebObjects/
TrainingCourses.woa/-64754. I should note that the project name is
TrainingCourses but I've been creating the shorter name Classes when
deploying under WOMonitor. For this example, I used the output from
the command line start.
[2008-03-21 10:22:50 EST] <main> The URL for webserver connect is:
http://fqdn/cgi-bin/WebObjects/TrainingCourses.woa/-64754
[2008-03-21 10:22:51 EST] <main> null
[2008-03-21 10:22:50 EST] <main> Waiting for requests...
[2008-03-21 10:25:27 EST] <WorkerThread0> ======= Cycle start /Apps/
WebObjects/TrainingCourses.woa/-64754
[2008-03-21 10:25:27 EST] <WorkerThread0> Request header:
{remote_host = (210.211.212.213); user-agent = (Mozilla/5.0
(Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/523.12.2 (KHTML,
like Gecko) Version/3.0.4 Safari/523.12.2); document_root = (/
Library/WebServer/Documents/www_site); server_name =
(www.domain.com); accept = (text/xml,application/xml,application/
xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5); x-
webobjects-adaptor-version = ("Apache"); remote_addr =
(210.211.212.213); remote_port = (64834); x-webobjects-request-id =
(47e2a5a800001e4400000009); server_admin = (email@hidden);
server_software = (Apache/1.3.33); script_filename = (/Apps/
WebObjects/TrainingCourses.woa/-64754); x-webobjects-request-method
= (GET); accept-encoding = (gzip, deflate); server_port = (160);
host = (www.domain.com); pc-remote-addr = (209.166.50.150); accept-
language = (en-us); connection = (close); }
[2008-03-21 10:25:27 EST] <WorkerThread0> cookies: null
[2008-03-21 10:25:27 EST] <WorkerThread0> Response cookie ()
[2008-03-21 10:25:27 EST] <WorkerThread0> Response headers: {cache-
control = ("private", "no-cache", "no-store", "must-revalidate",
"max-age=0"); expires = ("Fri, 21-Mar-2008 15:22:50 GMT"); date =
("Fri, 21-Mar-2008 15:22:50 GMT"); content-length = ("3874"); pragma
= ("no-cache"); x-webobjects-loadaverage = ("1"); content-type =
("text/html"); set-cookie = (); }
[2008-03-21 10:25:27 EST] <WorkerThread0> ======= End Cycle /Apps/
WebObjects/TrainingCourses.woa/-64754
Now if I take the URL (/Apps/WebObjects/TrainingCourses.woa/-64754)
and place it into my include statement and I get the following. As
you predicted, the INCLUDED seems to be causing me some headaches.
I am not getting to the dispatch.
[2008-03-21 10:27:11 EST] <WorkerThread1> <WOWorkerThread id=1
socket=Socket[addr=/210.211.212.213,port=64866,localport=64754]>
Exception while creating request:
java.lang.IllegalArgumentException:
<com.webobjects.appserver.WORequest>: 'INCLUDED' is not a valid HTTP-
version; dropping connection
[2008-03-21 10:27:11 EST] <WorkerThread1>
java.lang.IllegalArgumentException:
<com.webobjects.appserver.WORequest>: 'INCLUDED' is not a valid HTTP-
version
at com.webobjects.appserver.WORequest.<init>(WORequest.java:
224)
at
com
.webobjects.appserver.WOApplication.createRequest(WOApplication.java:
1734)
at
com
.webobjects
.appserver._private.WOHttpIO.readRequestFromSocket(WOHttpIO.java:345)
at
com
.webobjects
.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:79)
at
com
.webobjects
.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:552)
At least this is easy to fix. Add this to your Application class:
public WORequest createRequest(String aMethod, String aURL, String
anHTTPVersion, NSDictionary someHeaders, NSData aContent, NSDictionary
someInfo) {
if( ! anHTTPVersion.startsWith("HTTP/")) {
anHTTPVersion = "HTTP/1.1";
}
return super.createRequest(Method, aURL, anHTTPVersion,
someHeaders, aContent, someInfo);
}
Profit.
Chuck
[2008-03-21 10:27:11 EST] <WorkerThread2> <WOWorkerThread id=2
socket=Socket[addr=/210.211.212.213,port=64868,localport=64754]>
Exception while creating request:
java.lang.IllegalArgumentException:
<com.webobjects.appserver.WORequest>: 'INCLUDED' is not a valid HTTP-
version; dropping connection
[2008-03-21 10:27:11 EST] <WorkerThread2>
java.lang.IllegalArgumentException:
<com.webobjects.appserver.WORequest>: 'INCLUDED' is not a valid HTTP-
version
at com.webobjects.appserver.WORequest.<init>(WORequest.java:
224)
at
com
.webobjects.appserver.WOApplication.createRequest(WOApplication.java:
1734)
at
com
.webobjects
.appserver._private.WOHttpIO.readRequestFromSocket(WOHttpIO.java:345)
at
com
.webobjects
.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:79)
at
com
.webobjects
.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:552)
My WO App is just the following:
<table>
<WORepetition...>
<a bunch of WOStrings in table cells with first row as header
</webobjects>
</table>
I thought maybe this is my server, or the fact that I am developing
on Intel but deploying on PPC. So I just set up an Intel server
running 10.4.11 server with all the patches. I made a simple .shtml
file:
<html>
<body>
<h1>Some content</h1>
<!--#include virtual="/cgi-bin/WebObjects/TrainingCourses" -->
</body>
</html>
In this case I named the app the same in WOMonitor that it is in the
project. I then also tried the directAction uri. All of these
produced the same results. First attempt. No instance available.
Second attempt, requested app not found on this server.
I am using the following commands to build the projects on these
servers:
xcodebuild install -configuration Deployment DSTROOT=/
xcodebuild install -configuration WebServer DSTROOT=/
Any other suggestions from this point. Thanks all for the continued
support and suggestions. I even thought, maybe this is just Safari
so I tried changing my user agent. That did not work either.
Reid
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden