Re: RE: Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ?

2007-01-11 Thread Tapestry User List

Thanks Ben,

That's what I did and it works great !

Best regards,

D.

2007/1/4, Ben Dotte [EMAIL PROTECTED]:

Crap.. I forgot about that dependency on the web request. That never
made sense to me for the case of application-scope ASOs.

In any case, here is a wild idea. If you can capture and hold onto the
Hivemind-created instance of the ASO, you could then give out access to
it through a static getter, similar to a regular old singleton.

To do this you would need to wire up the ASO through a
StateObjectFactory.

So in hivemodule.xml:

contribution configuration-id=tapestry.state.ApplicationObjects
  state-object name=myApplicationObject scope=application
invoke-factory object=service:stateFactory /
  /state-object
/contribution

service-point id=stateFactory
interface=org.apache.tapestry.engine.state.StateObjectFactory
  invoke-factory
construct class=ns.MyAppObjectFactory /
  /invoke-factory
/service-point

In MyAppObjectFactory you can instantiate the object you want to use as
an ASO:

public class MyAppObjectFactory implements StateObjectFactory
{
  public Object createStateObject()
  {
return new MyApplicationObject();
  }
}

Then in MyApplicationObject you could store the instance that gets
created:

public class MyApplicationObject
{
  private static MyApplicationObject instance;

  public MyApplicationObject()
  {
instance = this;
  }

  public static MyApplicationObject getInstance()
  {
return instance;
  }
}

Then in your ServletContextListener you can just call
MyApplicationObject.getInstance().

Not the prettiest solution but I believe this would work.

Ben

-Original Message-
From: Tapestry User List [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 04, 2007 9:19 AM
To: Tapestry users
Subject: Re: Re: how to retrieve an Application State Object (ASO) with
an application scope from the ServletContext ?

It doesn't work.
Registry registry =
(Registry)context.getAttribute(org.apache.tapestry.Registry:app);
returns null.

D.

2007/1/4, James Carman [EMAIL PROTECTED]:
 I don't think that'll work.  The ApplicationStateManager needs a
 reference to the current web request (eventually the session).


 On 1/4/07, Ben Dotte [EMAIL PROTECTED] wrote:
  Hi,
 
  You could do something like this:
 
  ((ApplicationStateManager) ((Registry)
 
context.getAttribute(org.apache.tapestry.Registry:app)).getService(App
  licationStateManager.class)).get(myStateObject);
 
  Where myStateObject is the name of your ASO.
 
  HTH
 
  Ben
 
  -Original Message-
  From: Tapestry User List [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 04, 2007 8:45 AM
  To: tapestry-user@jakarta.apache.org
  Subject: how to retrieve an Application State Object (ASO) with an
  application scope from the ServletContext ?
 
  Hi,
 
  Happy new year 
 
  I have created a class that implements ServletContextListener.
  In the method public void contextDestroyed(ServletContextEvent
event),
  I need to retrieve an Application State Object (ASO) of tapestry 4
  with an application scope (not session).
 
  My question is how to retrieve an Application State Object (ASO)
from
  the ServletContext ?
 
 
  public void contextDestroyed(ServletContextEvent event) {
ServletContext context = event.getServletContext();
// retrieve myApplicationObject here
  }
 
  In hivemodule.xml:
  ...
  contribution configuration-id=tapestry.state.ApplicationObjects
  state-object name=myApplicationObject
  scope=application
  create-instance
  class=ns.MyApplicationObject/
  /state-object
  /contribution
  ...
 
  Thanks so much,
 
  D.
 
 
-
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
-
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax example with Tapestry 4.1.1(Dojo)

2007-01-11 Thread Mika Tammilehto

Hi Daniel

What Alexandru proposed is certainly right. All head-content is rendered 
by the Shell. To render additional stylesheet links, etc. you might 
provide them as params (assets) to the Shell.


However, I'm not sure if this extra head tag makes it not to work...

The onclick event is bound by the script rendered at the bottom of the 
page; you don't have to do this yourself:


 dojo.addOnLoad(function(e) {
 tapestry.cleanConnect(dojo.byId(deDiv), onclick,event389921977);

Is your event listener method called on server, i.e. is there any output 
in the server log? Are you trying to update the content of the div??? If 
so, try starting with a DirectLink on the page... something like this:

-
div jwcid=[EMAIL PROTECTED]
  span jwcid=@Insert value=ognl:textoutput here/span
/div

a href=# jwcid=@DirectLink listener=listener:update async=true 
updateComponents=ognl: { 'output' }click here/a

-

and on the page's java class:

-

public String getText() { return Hello world; }

public void update() {}

--

Cheers,
mika



Daniel Anguita O. wrote:

Hi Mika

Mika Tammilehto escribió:

Hi Daniel

I wrote that to the page head and it's OK. I run the app and i don't 
get any error message... BUT, it doesnt works... the 'ajax-thing' 
dont do anything..
What do you mean with : same params apply for Shell-component as 
well. What Shell-component? sorry, but im learning :D


The Shell component outputs the same script tags required for 
dojo/ajax, but also the html as well as head, i.e. basically 
everything required around the body.




im using the Firefox Console Error and it's everything all right now, 
but it doesnt works.
to develope my app i'm using eclipse and tomcat for windows... I'm 
learning from the book Enjoying Web Development with Tapestry.


HELP! if you need to see the code just ask for it, please help!



Maybe have a look at the html source that is rendered, e.g. if there 
are onclick events on your DirectLinks etc.


Did you set async=true on the components (form, link)? Did you set 
updateComponents=...?


Hope that helps you a little bit further!

mika

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This is what my:
Class:---
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.annotations.EventListener;
import org.apache.tapestry.event.*;

public abstract class Ajax extends BasePage{

   @EventListener(elements = deDiv, events = onclick, async=true)
   public void watchText(BrowserEvent e)
   {
System.out.println(Hola scriptalert('hola');/script);
   }

}
-

Page:---
?xml version=1.0?
!DOCTYPE page-specification PUBLIC
-//Apache Software Foundation//Tapestry Specification 4.1//EN
http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd;
page-specification class=austec.chileansky.remotecontrol.Ajax
/page-specification


Html---
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html jwcid=@Shell
   title=Ajax
head
titleAjax/title
link jwcid=@Style href=stylesheets/main.css media=all/
/head
body jwcid=@Body
   div id=deDiv class=boxBig brother is watching you./div
/body
/html


and finally, the html rendered with Firefox:

HTML Rendered---

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;

!-- Application: RemoteControl --
!-- Page: Ajax --
!-- Generated: Wed Jan 10 17:50:45 CLST 2007 --
html
head
meta name=generator content=Tapestry Application Framework, version 
4.1.1 /

meta http-equiv=Content-Type content=text/html;charset=UTF-8 /
titleAjax/title
script type=text/javascriptdjConfig = 
{isDebug:true,debugContainerId:debug,baseRelativePath:/RemoteControl/app?service=assetpath=%2Fdojo%2F,preventBackButtonFix:false,parseWidgets:false,locale:es-ar} 
/script


script type=text/javascript 
src=/RemoteControl/app?service=assetpath=%2Fdojo%2Fdojo.js/script


script type=text/javascript
dojo.registerModulePath(tapestry, 
/RemoteControl/app?service=assetpath=%2Ftapestry%2F);

/script
script type=text/javascript 
src=/RemoteControl/app?service=assetpath=%2Ftapestry%2Fcore.js/script

script type=text/javascript
dojo.require(dojo.logging.Logger);
dojo.log.setLevel(dojo.log.getLevel(WARNING));
dojo.require(tapestry.namespace);
/script
link rel=stylesheet type=text/css media=all 
href=stylesheets/main.css /

/head
head
titleAjax/title

/head

body id=Body
script type=text/javascript!--
dojo.require(tapestry.event);
// --/script

div id=deDiv 

Re: .page file

2007-01-11 Thread Mika Tammilehto

Hi Simon

The .page file is not mandatory, but you may be have to set the 
following to your app.application file:


meta key=org.apache.tapestry.page-class-packages
value=com.foo.bar /

This results in tapestry looking for page classes below this package 
namespace, e.g. page Home will be mapped to com.foo.bar.Home class.


Cheers,
mika

Simon Raveh wrote:

Hi,

Is there something like @ComponentClass that I can use with a page or is 
it mandatory to have .page file


Thanks,
Simon


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Beanform: Nested Beanforms with Binding Overrides

2007-01-11 Thread DJ Gredler

Well, I'm glad you sorted it out :-)

On 1/11/07, Steve Wells [EMAIL PROTECTED] wrote:


ok, after rolling back to just a simple one-off Beanform on its own and it
still failing ,cleaning the hell out of everything, the problem seems to
have (most unbelievably) been an empty left-over .page file; it only had
the
page-specification...

Serve me right for leaving mess around.

On 10/01/07, Steve Wells [EMAIL PROTECTED] wrote:

 Hi Daniel,

 None of them print correctly.

 I meant the only thing printed is the name of the property surrounded by
 '[]' eg: [PASSWORD]:

 text=literal:possibility was me experimenting trying to remove
 uncertainties.  I found when you use a resource bundle for the page with
 BeanForm and use  _title=ognl: messages.getMessage(
 components.bf.property.name + '_title' ) :

 1. the field prompt text is taken from a properties file property with
the
 same name as the Bean property and
 2. the field label is taken from property_name
 So if I have a bean property text and in my page properties file
 text=Enter some text
 text_title=This is where you type stuff

 you will get:
 td class=bf_Left id=informal_0label for=nameEnter some
 text/label:/td

 td class=bf_Right id=informal_1input type=text name=name
 value= id=name title=This is where you type stuff class=text
//td

  I've tried removing: _title=ognl:messages.getMessage(
 components.bf.property.name + '_title' ) and other combinations but
 nothing quite works...yet.

  On 10/01/07, DJ Gredler [EMAIL PROTECTED] wrote:
 
  I'm not sure why this would cause a problem. So looking at your code,
  you're
  saying that the titles for BeanForm bf print correctly, but the
title
  for
  BeanForm bf_inner doesn't? Or neither of them work?
 
  What do you mean by all I see is the [PROPERTY_NAME] coming out?
 
  As an aside, what is the following binding on bf_inner supposed to
be
  doing?
 
text=literal:possibility
 
 
  On 1/11/07, Steve Wells [EMAIL PROTECTED] wrote:
  
   Hi,
  
   Bit of extreme BF'ing here.  Titles are not printing; be it
  dynamically or
   literally when I do something of the form:
  
   form
   beanform1
   for (iterate over a list)
   new beanform from each list item
  
   All I see is the [PROPERTY_NAME] coming out.
  
   Detailed Code as follows:
  
   form jwcid=[EMAIL PROTECTED] delegate=bean:delegate
   clientValidationEnabled=ognl:false
  
   table jwcid= [EMAIL PROTECTED]:BeanForm bean=prop:vote
  
  
properties=literal:question=TextArea,explaination=TextArea,expiresOn
   _title=ognl:messages.getMessage(
components.bf.property.name+
   '_title' )
   /table
  
   span jwcid=@For source=ognl:vote.possibilityList
   value=prop:possibility
table jwcid=[EMAIL PROTECTED]:BeanForm bean=prop:possibility
   properties=text
   text=literal:possibility
   text_title=literal:possibility text
  /table
   /span
   input jwcid=[EMAIL PROTECTED] value=literal:create Vote
   listener=listener:createVote/
   /form
  
   Any ideas?
  
   Thanks,
  
   Steve
  
  
 
 





Re: AW: Re: AW: download a file

2007-01-11 Thread Barry Books

It would be nice if you could return Object from a listener and let
Tapestry figure it out. Having to pick between ILink and IPage at
compile time is a bit of a problem.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



contrib unit tests

2007-01-11 Thread Carlos.Fernandez
I just noticed that the code coverage reports show that the contrib
library has almost no unit tests in both the 4.1 and 4.0 branches.

4.1
http://tapestry.apache.org/tapestry4.1/tapestry-contrib/cobertura/index.
html

4.0
http://tapestry.apache.org/tapestry4/tapestry-contrib/clover/index.html

Am I missing something, or is that an accurate reflection of contrib
unit testing?

Carlos

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Q: Body Scripts in T4.1 DojoAjaxResponseBuilder

2007-01-11 Thread Jesse Kuhnert

If it's not getting parsed out / executed it definitely sounds like a
bug. Could've sworn I was handling this but maybe it got overlooked
somehow. If you file a JIRA issue I'll be able to take a peak during
my next round of changes.

On 1/10/07, Jeremy F. Kassis [EMAIL PROTECTED] wrote:


Hi everyone,

I'm just getting around to upgrading from T4.0.2 to T4.1.2-SNAPSHOT. I have
a widget that returns an html fragment that contains a script block... i.e.
Script language=javascript blah foo /script.

My problem is that this script isn't gettiing run after the ajax response.
Does the core.js client-side javascript that handles this request actually
parse and run script in embedded script blocks anymore? If not, what's the
recommended way to handle this?

Many thanks!
Jeremy F. Kassis
BumpQ, Inc.


--
View this message in context: 
http://www.nabble.com/Q%3A-Body-Scripts-in-T4.1-DojoAjaxResponseBuilder-tf2954962.html#a8265731
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: contrib unit tests

2007-01-11 Thread Jesse Kuhnert

I think it's an accurate report - sort of.. I think a lot of them do
still get unit tested in the integration tests.

Previous versions of the framework had a really robust api for doing
component testing, but it wasn't public so contrib didn't really have
a straightforward way to use it. This has since been made into a
public API but I haven't sat down and tried to write extensive unit
tests for contrib yet.

On 1/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

I just noticed that the code coverage reports show that the contrib
library has almost no unit tests in both the 4.1 and 4.0 branches.

4.1
http://tapestry.apache.org/tapestry4.1/tapestry-contrib/cobertura/index.
html

4.0
http://tapestry.apache.org/tapestry4/tapestry-contrib/clover/index.html

Am I missing something, or is that an accurate reflection of contrib
unit testing?

Carlos

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HtmlUnit testing with Contrib Palette

2007-01-11 Thread Mike Leonardo
Hey,

I'm using the Palette contrib component... it works great when I user
test it, but I get a strange error when I try to test it using HtmlUnit
testing. I enabled the javascript, and built utility function to select
and click the right links, but the javascript breaks in the test. Anyone
have any ideas?

Here's the error:




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HtmlUnit testing with Contrib Palette 2

2007-01-11 Thread Mike Leonardo
Sorry, I actually hit send too soon... 

Here's the error. Thanks!

Cheers, 
Mike Leonardo

=== EXCEPTION START 
EcmaError: lineNumber=[145] column=[0] lineSource=[null]
name=[TypeError]
sourceName=[http://localhost:9001/app?digest=db3d317f3d6334ce6ec25039e12b6d52path=%2Forg%2Fapache%2Ftapestry%2Fcontrib%2Fpalette%2FPaletteFunctions.jsservice=asset]
 message=[TypeError: Method remove called on incompatible object. 
(http://localhost:9001/app?digest=db3d317f3d6334ce6ec25039e12b6d52path=%2Forg%2Fapache%2Ftapestry%2Fcontrib%2Fpalette%2FPaletteFunctions.jsservice=asset#145)]
com.gargoylesoftware.htmlunit.ScriptException: TypeError: Method
remove called on incompatible object.
(http://localhost:9001/app?digest=db3d317f3d6334ce6ec25039e12b6d52path=
%2Forg%2Fapache%2Ftapestry%2Fcontrib%2Fpalette%
2FPaletteFunctions.jsservice=asset#145)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:253)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:693)
at
com.gargoylesoftware.htmlunit.html.HtmlAnchor.doClickAction(HtmlAnchor.java:105)
at
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:120)
at
com.ifactory.cms.testsupport.HtmlTestClient.clickLink(HtmlTestClient.java:167)
at
com.ifactory.columbia.gaz.admin.AddEditPlaceTest.selectPaletteOption(AddEditPlaceTest.java:74)
at
com.ifactory.columbia.gaz.admin.AddEditPlaceTest.testAddPlace(AddEditPlaceTest.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at
com.ifactory.columbia.gaz.util.HtmlTestCase.runTest(HtmlTestCase.java:52)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.mozilla.javascript.EcmaError: TypeError: Method remove
called on incompatible object.
(http://localhost:9001/app?digest=db3d317f3d6334ce6ec25039e12b6d52path=
%2Forg%2Fapache%2Ftapestry%2Fcontrib%2Fpalette%
2FPaletteFunctions.jsservice=asset#145)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3232)
at
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3244)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:434)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3084)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2250)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:149)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:160)
at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:249)
... 25 more
Enclosed exception: 
org.mozilla.javascript.EcmaError: TypeError: Method remove called on
incompatible object.
(http://localhost:9001/app?digest=db3d317f3d6334ce6ec25039e12b6d52path=
%2Forg%2Fapache%2Ftapestry%2Fcontrib%2Fpalette%
2FPaletteFunctions.jsservice=asset#145)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3232)
at

Re: XHR Exception Not Rendering to Browser

2007-01-11 Thread Jeremy F. Kassis

Hi Jessek!

This sounds right on.

Since a few service points, including DojoAjaxResponseBuilder get the
exceptionPageName from the Infrastructure service point, I tried to add a
contribution to the Infrastructure service point configuration as follows:

  contribution configuration-id=tapestry.Infrastructure
property name=exceptionPageName value=bumpq:Exception/
  /contribution  

But Hivemind doesn't seem to like that. I'm getting this exception...

- Allocate exception for servlet bumpq
org.apache.hivemind.ApplicationRuntimeException: Error at
jar:file:/C:/Documents
%20and%20Settings/Jeremy/My%20Documents/eclipse%20workspace/bumpq/context/WEB-IN
F/lib/tapestry-framework-4.1.1.jar!/META-INF/tapestry.error.xml, line 110,
colum
n 59: Infrastructure contribution for property 'exceptionPageName' (mode
'null')
 conflicts with a prior contribution (at context:/WEB-INF/hivemodule.xml,
line 5
2, column 65) and has been ignored.
[jar:file:/C:/Documents%20and%20Settings/Jer
emy/My%20Documents/eclipse%20workspace/bumpq/context/WEB-INF/lib/tapestry-framew
ork-4.1.1.jar!/META-INF/tapestry.error.xml, line 110, column 59]
at
org.apache.hivemind.impl.StrictErrorHandler.error(StrictErrorHandler.
java:39)
at org.apache.hivemind.impl.ErrorLogImpl.error(ErrorLogImpl.java:40)
at
org.apache.tapestry.services.impl.InfrastructureImpl.buildMapFromCont
ributions(InfrastructureImpl.java:345)

Maybe it's just been a while since I went digging in hivemind, but I thought
this would work. I'll try overridding the DojoAjaxResponeBuilder
configuration just to see if it fixes the primary issue.

Jeremy







Jessek wrote:
 
 The DojoAjaxResponseBuilder handler currently gets configured with the
 names of pages representing exceptions in order to detect an exception
 page and properly render the response so it is presented properly for
 ajax requests.
 
 This configuration currently is done via hivemind :
 
 http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.services.DojoAjaxResponseContributor.html
 
 This could possibly be a bug on my part but I'm not sure? Either way
 your feedback would be greatly appreciated, hopefully I can use your
 issues to enhance the 4.0-4.1 upgrade guide.
 
 On 1/11/07, Jeremy F. Kassis [EMAIL PROTECTED] wrote:

 I just noticed something that seems related. The browser reports a syntax
 error in dojo/src/browser_debug.js:

 missing } after function body
 browser_debug.js (line 17)
 document.write(script
 type='text/javascript'dojo.hostenv._global_omit_module_check =
 false;/script);dojo.hostenv._loadedUrisListStart = 0;if
 (!willCallAgain)
 {dj_eval = old_dj_eval;dojo.hostenv.loadUri = dojo.hostenv.oldLoadUri;}}

 Since this file comes from the official Tapestry 4.1.1 release, I'd
 assume
 that others have experienced the same problem, but I don't see any
 mention
 of it in these forums.






 Jeremy F. Kassis wrote:
 
  Hi again,
 
  Still working out some issues migrating from Tap 4.0.2 to Tap 4.1.1.
 
  One of my XHR Ajax requests is returning an exception. Here is the XHR
  response:
 
  ?xml version=1.0 encoding=UTF-8?!DOCTYPE html PUBLIC
 -//W3C//DTD
  XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; [
  !ENTITY nbsp '#160;'
  ]
  ajax-responseresponse id=bumpq:PageErrorPage type=exception
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  http://www.w3.org/TR/html4/loose.dtd;
 
  !-- Application: bumpq --
  !-- Page: bumpq:PageErrorPage --
  !-- Generated: Thu Jan 11 00:42:47 PST 2007 --
  html
  head
  meta name=generator content=Tapestry Application Framework, version
  4.1.1 /
  meta http-equiv=Content-Type content=text/xml;charset=UTF-8 /
  etc...
 
  Problem is that this isn't popping up in Firefox. I'm actually getting
 a
  Dojo Warning as follows:
 
  WARNING: 12:42:47 AM: No ajax-response elements recieved.
 
  Is there anything I've got to do to get XHR exceptions to popup like
 they
  did in Tap 4.0.2?
 
  Many thanks,
  Jeremy
 

 --
 View this message in context:
 http://www.nabble.com/XHR-Exception-Not-Rendering-to-Browser-tf2957595.html#a8273906
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 -- 
 Jesse Kuhnert
 Tapestry/Dojo team member/developer
 
 Open source based consulting work centered around
 dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/XHR-Exception-Not-Rendering-to-Browser-tf2957595.html#a8285684
Sent from the Tapestry - User mailing list archive at Nabble.com.


-

Re: XHR Exception Not Rendering to Browser

2007-01-11 Thread Jeremy F. Kassis

OK. I think I've got this mostly figured out.

As it turned out, I had already configured the exceptionPageName using the
tapestry.InfrastructureOverrides configuration point. When I was on Tap
4.0.2, it looked like this:

contribution configuration-id=tapestry.InfrastructureOverrides
property name=exceptionPageName value=PageErrorPage' /
/contribution

Also in Tap 4.0.2, I had done some funky stuff with
PageSpecificationResolver and ComponentSpecificationResolver so that the
application could resolve PageErrorPage without the library prefix.

When I went to Tap 4.1.1, I started moving everything toward a stock
configuration, including the specification resolvers, to get the basics
working right. So I also changed the tapestry.InfrastructureOverrides
configuration point to look like this:

contribution configuration-id=tapestry.InfrastructureOverrides
property name=exceptionPageName value=bumpq:PageErrorPage' 
/
/contribution

At that point, the basic XHR capability was working, but the exceptions
weren't coming up. So it seems that the core.js machinery has trouble
recognizing and presenting error pages with a library prefix. Not a major
deal, but perhaps a bug.

Many thanks for your help Jessek!

jeremy






Jeremy F. Kassis wrote:
 
 Hi Jessek!
 
 This sounds right on.
 
 Since a few service points, including DojoAjaxResponseBuilder get the
 exceptionPageName from the Infrastructure service point, I tried to add a
 contribution to the Infrastructure service point configuration as follows:
 
   contribution configuration-id=tapestry.Infrastructure
 property name=exceptionPageName value=bumpq:Exception/
   /contribution  
 
 But Hivemind doesn't seem to like that. I'm getting this exception...
 
 - Allocate exception for servlet bumpq
 org.apache.hivemind.ApplicationRuntimeException: Error at
 jar:file:/C:/Documents
 %20and%20Settings/Jeremy/My%20Documents/eclipse%20workspace/bumpq/context/WEB-IN
 F/lib/tapestry-framework-4.1.1.jar!/META-INF/tapestry.error.xml, line 110,
 colum
 n 59: Infrastructure contribution for property 'exceptionPageName' (mode
 'null')
  conflicts with a prior contribution (at context:/WEB-INF/hivemodule.xml,
 line 5
 2, column 65) and has been ignored.
 [jar:file:/C:/Documents%20and%20Settings/Jer
 emy/My%20Documents/eclipse%20workspace/bumpq/context/WEB-INF/lib/tapestry-framew
 ork-4.1.1.jar!/META-INF/tapestry.error.xml, line 110, column 59]
 at
 org.apache.hivemind.impl.StrictErrorHandler.error(StrictErrorHandler.
 java:39)
 at
 org.apache.hivemind.impl.ErrorLogImpl.error(ErrorLogImpl.java:40)
 at
 org.apache.tapestry.services.impl.InfrastructureImpl.buildMapFromCont
 ributions(InfrastructureImpl.java:345)
 
 Maybe it's just been a while since I went digging in hivemind, but I
 thought this would work. I'll try overridding the DojoAjaxResponeBuilder
 configuration just to see if it fixes the primary issue.
 
 Jeremy
 
 
 
 
 
 
 
 Jessek wrote:
 
 The DojoAjaxResponseBuilder handler currently gets configured with the
 names of pages representing exceptions in order to detect an exception
 page and properly render the response so it is presented properly for
 ajax requests.
 
 This configuration currently is done via hivemind :
 
 http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.services.DojoAjaxResponseContributor.html
 
 This could possibly be a bug on my part but I'm not sure? Either way
 your feedback would be greatly appreciated, hopefully I can use your
 issues to enhance the 4.0-4.1 upgrade guide.
 
 On 1/11/07, Jeremy F. Kassis [EMAIL PROTECTED] wrote:

 I just noticed something that seems related. The browser reports a
 syntax
 error in dojo/src/browser_debug.js:

 missing } after function body
 browser_debug.js (line 17)
 document.write(script
 type='text/javascript'dojo.hostenv._global_omit_module_check =
 false;/script);dojo.hostenv._loadedUrisListStart = 0;if
 (!willCallAgain)
 {dj_eval = old_dj_eval;dojo.hostenv.loadUri = dojo.hostenv.oldLoadUri;}}

 Since this file comes from the official Tapestry 4.1.1 release, I'd
 assume
 that others have experienced the same problem, but I don't see any
 mention
 of it in these forums.






 Jeremy F. Kassis wrote:
 
  Hi again,
 
  Still working out some issues migrating from Tap 4.0.2 to Tap 4.1.1.
 
  One of my XHR Ajax requests is returning an exception. Here is the XHR
  response:
 
  ?xml version=1.0 encoding=UTF-8?!DOCTYPE html PUBLIC
 -//W3C//DTD
  XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; [
  !ENTITY nbsp '#160;'
  ]
  ajax-responseresponse id=bumpq:PageErrorPage type=exception
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  http://www.w3.org/TR/html4/loose.dtd;
 
  !-- Application: bumpq --
  !-- Page: bumpq:PageErrorPage --
  !-- Generated: Thu Jan 11 00:42:47 PST 2007 --
  html
  head
  meta name=generator content=Tapestry 

Re: XHR Exception Not Rendering to Browser

2007-01-11 Thread Jeremy F. Kassis

Note for the update guide:

If you are using a custom Exception Page, make sure you check out the
changes made to the default exception page. In particular, your exception
page won't render correctly after an XHR request unless it renders with an
empty or null DOCTYPE.

Jeremy



Jeremy F. Kassis wrote:
 
 OK. I think I've got this mostly figured out.
 
 As it turned out, I had already configured the exceptionPageName using the
 tapestry.InfrastructureOverrides configuration point. When I was on Tap
 4.0.2, it looked like this:
 
   contribution configuration-id=tapestry.InfrastructureOverrides
   property name=exceptionPageName value=PageErrorPage' /
   /contribution
 
 Also in Tap 4.0.2, I had done some funky stuff with
 PageSpecificationResolver and ComponentSpecificationResolver so that the
 application could resolve PageErrorPage without the library prefix.
 
 When I went to Tap 4.1.1, I started moving everything toward a stock
 configuration, including the specification resolvers, to get the basics
 working right. So I also changed the tapestry.InfrastructureOverrides
 configuration point to look like this:
 
   contribution configuration-id=tapestry.InfrastructureOverrides
   property name=exceptionPageName value=bumpq:PageErrorPage' 
 /
   /contribution
 
 At that point, the basic XHR capability was working, but the exceptions
 weren't coming up. So it seems that the core.js machinery has trouble
 recognizing and presenting error pages with a library prefix. Not a major
 deal, but perhaps a bug.
 
 Many thanks for your help Jessek!
 
 jeremy
 
 
 
 
 
 
 Jeremy F. Kassis wrote:
 
 Hi Jessek!
 
 This sounds right on.
 
 Since a few service points, including DojoAjaxResponseBuilder get the
 exceptionPageName from the Infrastructure service point, I tried to add a
 contribution to the Infrastructure service point configuration as
 follows:
 
   contribution configuration-id=tapestry.Infrastructure
 property name=exceptionPageName value=bumpq:Exception/
   /contribution  
 
 But Hivemind doesn't seem to like that. I'm getting this exception...
 
 - Allocate exception for servlet bumpq
 org.apache.hivemind.ApplicationRuntimeException: Error at
 jar:file:/C:/Documents
 %20and%20Settings/Jeremy/My%20Documents/eclipse%20workspace/bumpq/context/WEB-IN
 F/lib/tapestry-framework-4.1.1.jar!/META-INF/tapestry.error.xml, line
 110, colum
 n 59: Infrastructure contribution for property 'exceptionPageName' (mode
 'null')
  conflicts with a prior contribution (at context:/WEB-INF/hivemodule.xml,
 line 5
 2, column 65) and has been ignored.
 [jar:file:/C:/Documents%20and%20Settings/Jer
 emy/My%20Documents/eclipse%20workspace/bumpq/context/WEB-INF/lib/tapestry-framew
 ork-4.1.1.jar!/META-INF/tapestry.error.xml, line 110, column 59]
 at
 org.apache.hivemind.impl.StrictErrorHandler.error(StrictErrorHandler.
 java:39)
 at
 org.apache.hivemind.impl.ErrorLogImpl.error(ErrorLogImpl.java:40)
 at
 org.apache.tapestry.services.impl.InfrastructureImpl.buildMapFromCont
 ributions(InfrastructureImpl.java:345)
 
 Maybe it's just been a while since I went digging in hivemind, but I
 thought this would work. I'll try overridding the DojoAjaxResponeBuilder
 configuration just to see if it fixes the primary issue.
 
 Jeremy
 
 
 
 
 
 
 
 Jessek wrote:
 
 The DojoAjaxResponseBuilder handler currently gets configured with the
 names of pages representing exceptions in order to detect an exception
 page and properly render the response so it is presented properly for
 ajax requests.
 
 This configuration currently is done via hivemind :
 
 http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.services.DojoAjaxResponseContributor.html
 
 This could possibly be a bug on my part but I'm not sure? Either way
 your feedback would be greatly appreciated, hopefully I can use your
 issues to enhance the 4.0-4.1 upgrade guide.
 
 On 1/11/07, Jeremy F. Kassis [EMAIL PROTECTED] wrote:

 I just noticed something that seems related. The browser reports a
 syntax
 error in dojo/src/browser_debug.js:

 missing } after function body
 browser_debug.js (line 17)
 document.write(script
 type='text/javascript'dojo.hostenv._global_omit_module_check =
 false;/script);dojo.hostenv._loadedUrisListStart = 0;if
 (!willCallAgain)
 {dj_eval = old_dj_eval;dojo.hostenv.loadUri =
 dojo.hostenv.oldLoadUri;}}

 Since this file comes from the official Tapestry 4.1.1 release, I'd
 assume
 that others have experienced the same problem, but I don't see any
 mention
 of it in these forums.






 Jeremy F. Kassis wrote:
 
  Hi again,
 
  Still working out some issues migrating from Tap 4.0.2 to Tap 4.1.1.
 
  One of my XHR Ajax requests is returning an exception. Here is the
 XHR
  response:
 
  ?xml version=1.0 encoding=UTF-8?!DOCTYPE html PUBLIC
 -//W3C//DTD
  XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; [
  !ENTITY nbsp '#160;'
  ]
 

download/export a file: to reset response buffer: Committed

2007-01-11 Thread Hsin-Tang Pai
Hi,
I tried to a EngineService to download/export a file
(application/octet-stream).
Because THE file is from FTP site, I cannot get actual link form
getLink() method.
So I tried to do directly download as following:

Call Page:
@InjectPage(DownloadOutput)
public abstract DownloadOutput getDownloadOutput();

public void CallPage(IRequestCycle cycle) {
 DownloadOutput results = getDownloadOutput();
 results.activate(fileInputStream, file.getName(),
(int)file.length());
}

DownloadOutput page:
public void activate(FileInputStream fis, String fileName, int
fileLength)

 FileInputStream fis = new FileInputStream(file);
 in = new BufferedInputStream(fis);

 WebResponse response =
getPage().getRequestCycle().getInfrastructure().getResponse();
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 int c;
 while ( ( c = fis.read() ) != -1 ) {
 baos.write( c );
 }
 fis.close();
 outputStrem = response.getOutputStream(new
ContentType(application/octet-stream));
 response.setDateHeader(max-age, 0);
 response.setHeader(Content-transfer-encoding, binary);
 response.setHeader(Content-disposition, attachment; filename=
 + fileName);
 response.setContentLength(fileLength);
 response.setHeader(Connection, keep-alive);
 response.setHeader(Expires, 60);
 response.setHeader(Cache-Control, public, post-check=0,
pre-check=0);

 outputStrem.write(baos.toByteArray());
 outputStrem.flush();
 outputStrem.close();
 in.close();
 in = null;
 
 getRequestCycle().activate(this);
}

And I got Error:
[java] 17:24:38,888 ERROR ServletWebResponse:132 - Unable to reset
response buffer: Committed
[java] java.lang.IllegalStateException: Committed
[java] at
org.mortbay.jetty.servlet.ServletHttpResponse.resetBuffer(ServletHttpRes
ponse.jav
a:212)
[java] at
org.mortbay.jetty.servlet.ServletHttpResponse.reset(ServletHttpResponse.
java:221)

[java] at
org.apache.tapestry.web.ServletWebResponse.reset(ServletWebResponse.java
:128)
[java] at
org.apache.tapestry.web.ServletWebResponse.getPrintWriter(ServletWebResp
onse.java
:90)
[java] at
$WebResponse_1100e16f32a.getPrintWriter($WebResponse_1100e16f32a.java)
[java] at
$WebResponse_1100e16f1fe.getPrintWriter($WebResponse_1100e16f1fe.java)
[java] at
org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(Re
sponseRen
dererImpl.java:67)
[java] at
$ResponseRenderer_1100e16f21a.renderResponse($ResponseRenderer_1100e16f2
1a.java)
[java] at
org.apache.tapestry.error.ExceptionPresenterImpl.presentException(Except
ionPresen
terImpl.java:46)
[java] at
$ExceptionPresenter_1100e16f208.presentException($ExceptionPresenter_110
0e16f208.
java)
[java] at
org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(Abstract
Engine.ja
va:121)
[java] at
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:28
0)
[java] at
org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeE
ngineTerm
inator.java:60)
[java] at
$WebRequestServicer_1100e16f262.service($WebRequestServicer_1100e16f262.
java)
[java] at
org.apache.tapestry.services.impl.DisableCachingFilter.service(DisableCa
chingFilt
er.java:4Cool
[java] at
$WebRequestServicerFilter_1100e16f264.service($WebRequestServicerFilter_
1100e16f2
64.java)
[java] at
$WebRequestServicer_1100e16f266.service($WebRequestServicer_1100e16f266.
java)
[java] at
$WebRequestServicer_1100e16f25e.service($WebRequestServicer_1100e16f25e.
java)...

I cannot find any support documents on the web. I even don't know what
if that mean.
Please Help

Thank you very much