Re: WROX chapter 5, pg 150 - compile error?
On Mar 28, 2007, at 12:11 PM, Jeremy Matthews wrote: Anyone get the example to compile correctly at the end of ch. 5? I keep getting the :"Cannot find symbol" on this (second) line: // value returned by the function sales = (Number)result.ObjectForKey("sales"); objectForKey, lower-case O at start. Chuck -- 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 (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 archive@mail-archive.com
WROX chapter 5, pg 150 - compile error?
Anyone get the example to compile correctly at the end of ch. 5? I keep getting the :"Cannot find symbol" on this (second) line: // value returned by the function sales = (Number)result.ObjectForKey("sales"); Thanks, j ___ 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 archive@mail-archive.com
Re: Returning a PDF file
Thanks Daniele, using a DA has resolved the problem. Don't know why but apparently these are handled differently by Apache/WOAdaptor/WO (?). Am 28.03.2007 um 18:00 schrieb Daniele Corti: 2007/3/28, Johann Werner <[EMAIL PROTECTED]>: I found the cause of the problems to correctly display an inline pdf. Apparently the header information "application/pdf" is overwritten by Apache to "text/html". I suppose that it does so because the URL doesn't end with ".pdf" but ends with the context ID. I don't think so... but, to be sure, try to return the response as a WOComponent throught a Direct Action: e.g. yourLink: WOHyperlink { directActionName = "donwload"; } public WOActionResult downloadAction() { ///obtain your NSData aktPDF ComponentEmpty c = (ComponentEmpty) pageWithName ("ComponentEmpty"); c.setAktPDF(aktPDF); return c; } public class ComponentEmpty extends WOComponent { private NSData _aktPDF; public ComponentEmpty(WOContext aContext) { super(aContext); } public NDData aktPDF() { return _aktPDF; } public void setAktPDF(NSData newaktPDF) { _aktPDF = newaktPDF; } public void appendToResponse(WOResponse aResponse, WOContext context) { aResponse.disableClientCaching(); aResponse.removeHeadersForKey("cache-control"); aResponse.removeHeadersForKey("pragma"); aResponse.setHeader ("application/pdf", "content-type"); aResponse.setHeader("Report PDF", "content-description"); aResponse.setHeader("inline; filename=\"" + --> your PDF file name <-- + ".pdf\"", "content-disposition"); aResponse.setHeader( --> your PDF file length <--, "content- length"); aResponse.setContent( --> your PDF <-- ); /DO NOT CALL SUPER.APPENDTORESPONSE() } } This should work... How can I prevent Apache from ignoring the headers from WO or is it possible to return a WOComponent (the PDF file) but with a "corrected" URL? Johann ___ 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/ildenae% 40gmail.com This email sent to [EMAIL PROTECTED] -- Daniele Corti AIM: S0CR4TE5 Messenger: [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Re: Returning a PDF file
2007/3/28, Johann Werner <[EMAIL PROTECTED]>: I found the cause of the problems to correctly display an inline pdf. Apparently the header information "application/pdf" is overwritten by Apache to "text/html". I suppose that it does so because the URL doesn't end with ".pdf" but ends with the context ID. I don't think so... but, to be sure, try to return the response as a WOComponent throught a Direct Action: e.g. yourLink: WOHyperlink { directActionName = "donwload"; } public WOActionResult downloadAction() { ///obtain your NSData aktPDF ComponentEmpty c = (ComponentEmpty) pageWithName("ComponentEmpty"); c.setAktPDF(aktPDF); return c; } public class ComponentEmpty extends WOComponent { private NSData _aktPDF; public ComponentEmpty(WOContext aContext) { super(aContext); } public NDData aktPDF() { return _aktPDF; } public void setAktPDF(NSData newaktPDF) { _aktPDF = newaktPDF; } public void appendToResponse(WOResponse aResponse, WOContext context) { aResponse.disableClientCaching(); aResponse.removeHeadersForKey("cache-control"); aResponse.removeHeadersForKey("pragma"); aResponse.setHeader("application/pdf", "content-type"); aResponse.setHeader("Report PDF", "content-description"); aResponse.setHeader("inline; filename=\"" + --> your PDF file name <-- + ".pdf\"", "content-disposition"); aResponse.setHeader( --> your PDF file length <--, "content-length"); aResponse.setContent( --> your PDF <-- ); /DO NOT CALL SUPER.APPENDTORESPONSE() } } This should work... How can I prevent Apache from ignoring the headers from WO or is it possible to return a WOComponent (the PDF file) but with a "corrected" URL? Johann ___ 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/ildenae%40gmail.com This email sent to [EMAIL PROTECTED] -- Daniele Corti AIM: S0CR4TE5 Messenger: [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Re: Returning a PDF file
Just to be clear, I also still include the content-disposition header. So the file name is in the headers twice. -- Mark On Mar 28, 2007, at 10:51 AM, Mark Morris wrote: Looking at my generic PDF code (from 4 years ago it appears, wow...), it looks like I'm doing almost exactly what George suggested, but my content-type header is different: response.setHeader( "application/pdf; name=\"" + fileName() + "\"", "content-type" ); (Where fileName() is going to return a string with a .pdf extension.) I don't recall running into your issue, so perhaps this will help make sure apache doesn't think it knows better than you what the content-type should be. ;-) Regards, Mark On Mar 28, 2007, at 10:37 AM, Johann Werner wrote: I found the cause of the problems to correctly display an inline pdf. Apparently the header information "application/pdf" is overwritten by Apache to "text/html". I suppose that it does so because the URL doesn't end with ".pdf" but ends with the context ID. How can I prevent Apache from ignoring the headers from WO or is it possible to return a WOComponent (the PDF file) but with a "corrected" URL? Johann ___ 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/markm% 40onpointsoftware.com This email sent to [EMAIL PROTECTED] ___ 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/markm% 40onpointsoftware.com This email sent to [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Re: Returning a PDF file
Looking at my generic PDF code (from 4 years ago it appears, wow...), it looks like I'm doing almost exactly what George suggested, but my content-type header is different: response.setHeader( "application/pdf; name=\"" + fileName () + "\"", "content-type" ); (Where fileName() is going to return a string with a .pdf extension.) I don't recall running into your issue, so perhaps this will help make sure apache doesn't think it knows better than you what the content-type should be. ;-) Regards, Mark On Mar 28, 2007, at 10:37 AM, Johann Werner wrote: I found the cause of the problems to correctly display an inline pdf. Apparently the header information "application/pdf" is overwritten by Apache to "text/html". I suppose that it does so because the URL doesn't end with ".pdf" but ends with the context ID. How can I prevent Apache from ignoring the headers from WO or is it possible to return a WOComponent (the PDF file) but with a "corrected" URL? Johann ___ 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/markm% 40onpointsoftware.com This email sent to [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Re: Returning a PDF file
I found the cause of the problems to correctly display an inline pdf. Apparently the header information "application/pdf" is overwritten by Apache to "text/html". I suppose that it does so because the URL doesn't end with ".pdf" but ends with the context ID. How can I prevent Apache from ignoring the headers from WO or is it possible to return a WOComponent (the PDF file) but with a "corrected" URL? Johann ___ 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 archive@mail-archive.com
Re: Returning a PDF file
Johann: I believe here's the entire list of method calls you want within appendToResponse for a PDF response: aResponse.disableClientCaching(); aResponse.removeHeadersForKey("cache-control"); aResponse.removeHeadersForKey("pragma"); aResponse.setHeader("application/pdf", "content-type"); aResponse.setHeader("Report PDF", "content-description"); aResponse.setHeader("inline; filename=\"" + --> your PDF file name <-- + ".pdf\"", "content-disposition"); aResponse.setHeader( --> your PDF file length <--, "content-length"); aResponse.setContent( --> your PDF <-- ); -George On Mar 28, 2007, at 5:34 AM, Johann Werner wrote: Hi, I have some trouble returning a PDF file that I am creating on the fly to a browser. I set the header information as noted on the wikibooks website to: public void appendToResponse(WOResponse aResponse, WOContext aContext) { super.appendToResponse(aResponse, aContext); aResponse.setHeader("application/pdf", "Content-Type"); aResponse.setHeader("inline; attachment; filename=\"MyPDF.pdf\"", "Content-Disposition"); aResponse.setHeader("" + aktPDF.length(), "Content-Length"); aResponse.setContent(aktPDF); } where aktPDF is of type NSData. When I click on the link to return the PDF I get a blank page in Safari. When I look at the page source I can see that the data has been loaded. In order to see the PDF I have to save the page and change the file extension to pdf prior to being able to open it in Preview. Firefox displays all the ASCII text in the browser window instead of a blank page. By changing the second header information from "inline; attachment;" to "application;" Firefox ask to download the pdf file. Safari behaves as in the first case. How can I get that to work? Could it be related to the fact, that I am setting the default encoding to UTF8 and setting header information in the applications appendToResponse? public Application() { super(); System.out.println("Welcome to " + this.name() + "!"); /* ** Put your application initialization code here ** */ WOMessage.setDefaultEncoding("UTF8"); } public void appendToResponse(WOResponse response, WOContext wocontext) { super.appendToResponse(response, wocontext); if (_NSUtilities.UTF8StringEncoding.equals (response.contentEncoding())) response.setHeader("text/html; charset=UTF-8", "Content-Type"); } But if I call super first and then set the header to "application/ pdf" there should be no problem? Johann ___ 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/george% 40boxofficetickets.com This email sent to [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Re: WOSortOrderManyKey
I haven't actually tried using the component, but from the documentation it appears to me that the key list should be a simple set of strings that become choices in a popup button. fOrderKeyList = new NSArray(new Object[] {"nomWeb", "prixVente"}); Then connect the WOSortOrderManyKey up to your display group. You are creating an array of EOSortOrderings. If you're going to create the sort orderings in your code then you could just set them directly on display group with displayGroup.setSortOrderings(). The WOSortOrderManyKey is a component used to let the user choose an attribute and direction for sorting. It looks like you are actually wanting to sort on multiple attributes. If this is the case, I don't think that WOSortOrderManyKey is what you want. On Mar 28, 2007, at 5:55 AM, WIESEN Bruno wrote: Hello, I use a WOSortOrderManyKey to sort my WODisplayGroup but i can"t get it work correctly... Here is how I do this : First, in WOBuilder, I added a WOSortOrderManyKey in a WOForm with binding multipleSubmit= true Then, I bind my displayGroup and my keyList Here is my KeyList : NSMutableArray sortOrderings = new NSMutableArray (); sortOrderings.addObject ( new EOSortOrdering ("nomWeb", EOSortOrdering.CompareAscending)); sortOrderings.addObject ( new EOSortOrdering ("prixVente", EOSortOrdering.CompareAscending)); fSession.fProduitsGroup.setSortOrderings (sortOrderings); fOrderKeyList= new NSMutableArray (fSession.fProduitsGroup.sortOrderings()); The problem is the following : The first time it works then...nothing happens... An idea?? Thank you! Bruno ___ 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/robertwalker1% 40mac.com This email sent to [EMAIL PROTECTED] -- Robert Walker [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Re: Returning a PDF file
Thanks for the fast reply. I took the call to super.appendToResponse out of the code. But now unfortunately Safari shows the ASCII content of the pdf file in the window or - by setting the header to attachment - downloads it to a xyz.pdf.html file. Firefox in contrast saves it in the correct format but shows ASCII too when set to inline. Any suggestions? Johann ___ 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 archive@mail-archive.com
Re: Returning a PDF file
2007/3/28, Johann Werner <[EMAIL PROTECTED]>: Hi, I have some trouble returning a PDF file that I am creating on the fly to a browser. I set the header information as noted on the wikibooks website to: public void appendToResponse(WOResponse aResponse, WOContext aContext) { super.appendToResponse(aResponse, aContext); if you call super.appendToResponse you generate the page with the default header, simply don't call it. I hope this work! aResponse.setHeader("application/pdf", "Content-Type"); aResponse.setHeader("inline; attachment; filename=\" MyPDF.pdf\"", "Content-Disposition"); aResponse.setHeader("" + aktPDF.length(), "Content-Length"); aResponse.setContent(aktPDF); } where aktPDF is of type NSData. When I click on the link to return the PDF I get a blank page in Safari. When I look at the page source I can see that the data has been loaded. In order to see the PDF I have to save the page and change the file extension to pdf prior to being able to open it in Preview. Firefox displays all the ASCII text in the browser window instead of a blank page. By changing the second header information from "inline; attachment;" to "application;" Firefox ask to download the pdf file. Safari behaves as in the first case. try use "attachment;" Safari will download it too! How can I get that to work? Could it be related to the fact, that I am setting the default encoding to UTF8 and setting header information in the applications appendToResponse? public Application() { super(); System.out.println("Welcome to " + this.name() + "!"); /* ** Put your application initialization code here ** */ WOMessage.setDefaultEncoding("UTF8"); } public void appendToResponse(WOResponse response, WOContext wocontext) { super.appendToResponse(response, wocontext); if (_NSUtilities.UTF8StringEncoding.equals( response.contentEncoding ())) response.setHeader("text/html; charset=UTF-8", "Content-Type"); } But if I call super first and then set the header to "application/ pdf" there should be no problem? mmm I'm not sure, don't call is tha best policy Johann ___ 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/ildenae%40gmail.com This email sent to [EMAIL PROTECTED] -- Daniele Corti AIM: S0CR4TE5 Messenger: [EMAIL PROTECTED] ___ 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 archive@mail-archive.com
Returning a PDF file
Hi, I have some trouble returning a PDF file that I am creating on the fly to a browser. I set the header information as noted on the wikibooks website to: public void appendToResponse(WOResponse aResponse, WOContext aContext) { super.appendToResponse(aResponse, aContext); aResponse.setHeader("application/pdf", "Content-Type"); aResponse.setHeader("inline; attachment; filename=\"MyPDF.pdf\"", "Content-Disposition"); aResponse.setHeader("" + aktPDF.length(), "Content-Length"); aResponse.setContent(aktPDF); } where aktPDF is of type NSData. When I click on the link to return the PDF I get a blank page in Safari. When I look at the page source I can see that the data has been loaded. In order to see the PDF I have to save the page and change the file extension to pdf prior to being able to open it in Preview. Firefox displays all the ASCII text in the browser window instead of a blank page. By changing the second header information from "inline; attachment;" to "application;" Firefox ask to download the pdf file. Safari behaves as in the first case. How can I get that to work? Could it be related to the fact, that I am setting the default encoding to UTF8 and setting header information in the applications appendToResponse? public Application() { super(); System.out.println("Welcome to " + this.name() + "!"); /* ** Put your application initialization code here ** */ WOMessage.setDefaultEncoding("UTF8"); } public void appendToResponse(WOResponse response, WOContext wocontext) { super.appendToResponse(response, wocontext); if (_NSUtilities.UTF8StringEncoding.equals(response.contentEncoding ())) response.setHeader("text/html; charset=UTF-8", "Content-Type"); } But if I call super first and then set the header to "application/ pdf" there should be no problem? Johann ___ 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 archive@mail-archive.com
WOSortOrderManyKey
Hello, I use a WOSortOrderManyKey to sort my WODisplayGroup but i can"t get it work correctly... Here is how I do this : First, in WOBuilder, I added a WOSortOrderManyKey in a WOForm with binding multipleSubmit= true Then, I bind my displayGroup and my keyList Here is my KeyList : NSMutableArray sortOrderings = new NSMutableArray (); sortOrderings.addObject ( new EOSortOrdering ("nomWeb", EOSortOrdering.CompareAscending)); sortOrderings.addObject ( new EOSortOrdering ("prixVente", EOSortOrdering.CompareAscending)); fSession.fProduitsGroup.setSortOrderings (sortOrderings); fOrderKeyList= new NSMutableArray (fSession.fProduitsGroup.sortOrderings()); The problem is the following : The first time it works then...nothing happens... An idea?? Thank you! Bruno ___ 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 archive@mail-archive.com