• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Long Response Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Long Response Problems


  • Subject: Long Response Problems
  • From: Greg Hulands <email@hidden>
  • Date: Mon, 2 Aug 2004 09:41:02 +1000

Hi,
I am trying to implement a long response page that processes images and
then generates a config file from a component to write to disk. The
config file can only be generated once all the images are processed.
When I try and do this I am getting the following exception:

2004-08-02 09:21:04,832 DEBUG ShoeBox[598:50212 7] NSLog
(ERXNSLogLog4jBridge.java:44)  - Session.context() evaluates to null.
You may be trying to get the context object from an archived session
object. there is no context object outside of the request-response
loop.
  2004-08-02 09:21:04,834 DEBUG ShoeBox[598:50212 7] NSLog
(ERXNSLogLog4jBridge.java:44)  - Session.context() evaluates to null.
You may be trying to get the context object from an archived session
object. there is no context object outside of the request-response
loop.
  2004-08-02 09:21:04,837 WARN  ShoeBox[598:50212 7] NSLog
(ERXNSLogLog4jBridge.java:41)  - <ConsumerProcessOrder> long response
thread raised : java.lang.IllegalArgumentException: <Application>:
Unable to create page 'ConsumerFotowireXMLGenerator'.  No context was
passed.
  2004-08-02 09:21:04,839 WARN  ShoeBox[598:50212 7] NSLog
(ERXNSLogLog4jBridge.java:41)  - STACK TRACE:
  [2004-08-02 09:21:04 EST] <Thread-1>
java.lang.IllegalArgumentException: <Application>: Unable to create
page 'ConsumerFotowireXMLGenerator'.  No context was passed.
	at
com.webobjects.appserver.WOApplication.pageWithName(WOApplication.java:
1934)
	at
com.webobjects.appserver.WOComponent.pageWithName(WOComponent.java:
1200)
	at ConsumerProcessOrder.performAction(ConsumerProcessOrder.java:56)
	at
com.webobjects.woextensions.WOLongResponsePage.run(WOLongResponsePage.ja
va:155)
	at java.lang.Thread.run(Thread.java:552)

 From what I can tell is that I cannot generate the config file in the
perform Action method of the long response as it seems to be in a
seperate thread. Is there a way to get notified once the processing is
complete so that I can generate the config file in the main thread?

Any help is greatly appreciated.

Regards,
Greg


here is the performAction method.

public Object performAction() {

		while (current < imgCount) {
			processChunk();
		}
		Session s = ((Session)session());

		//generate the xml
		ConsumerFotowireXMLGenerator xml =
(ConsumerFotowireXMLGenerator)pageWithName("ConsumerFotowireXMLGenerator
");

		xml.setImages(images);
		WOResponse xmlData = xml.generateResponse();
		String content = new String(xmlData.content().bytes());

		try {
			FileWriter file = new FileWriter(stagingFolder + "JOB_" +
s.onlineSale().saleID() + ".FWJ");
			file.write(content);
			file.close();
		} catch (IOException e) {
			System.out.println(e);
		}

		// Generate the pdf job sheet
		FOPOnlineJobSheet pdf =
(FOPOnlineJobSheet)pageWithName("FOPOnlineJobSheet");
		pdf.setFotowireData(s.tempArray());
		WOResponse fop = pdf.generateResponse();
		NSData pdfData = new NSData(fop.content().bytes());

		// Write to temp dir, print it, delete it.
		String pdfFile = "/tmp/" +
generator.generateRandomBasedUUID().toString() + ".pdf";
		File f = new File(pdfFile);

		try {
			FileOutputStream fos = new FileOutputStream(pdfFile);
			pdfData.writeToStream(fos);
		} catch (IOException e) {
			System.out.println("Failed to write pdf job sheet to " + pdfFile);
		}

		String printerQueue =
((Application)application()).preferenceForKey("ShoeBoxPrinterQueue").val
ue();

		try {
			Process pr = Runtime.getRuntime().exec("open " + pdfFile);
			//Process pr = Runtime.getRuntime().exec(printerQueue + " " +
pdfFile);
			pr.waitFor();
			//pr = Runtime.getRuntime().exec("rm " + pdfFile);
			//pr.waitFor();
		}
		catch (Exception e)
		{
			System.out.println("Error printing file: " + pdfFile + "\n" + e);
		}

		s.setOnlineSale(null);
		isProcessing = false;

		return null;
     }
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: AW: AW: Dreamweaver translator extension for WebObjects
  • Next by Date: Re: Long Response Problems
  • Previous by thread: AW: AW: Dreamweaver translator extension for WebObjects
  • Next by thread: Re: Long Response Problems
  • Index(es):
    • Date
    • Thread