Problem with XTile component

2007-07-31 Thread Dave Kallstrom
I am having problem getting the XTile component to correctly send data back
to the server. Whenever a user types in a string with an ampersand in it the
text after the ampersand as well as the ampersand itself is being cut off.
For example this  that is being sent back to the server as this. I
believe there was a change made to the XTile component to replace the
homegrown regular expression uri encoder to use the javascript encodeURI()
function. Could this be the problem? I am certain this was working in
previous releases of tapestry. We are currently on 4.1.2
Any help would be appreciated.

-- 
Dave Kallstrom


Tap 5 FormSupport Exception

2007-02-14 Thread Dave Kallstrom

I hope this user list is ready for tap5 questions if not please disregard.
I am working on my first tap5 hello world page and am having a little
trouble with form submission.
I copied the code right of the tap5 page and I am getting the following
error.

No object of type org.apache.tapestry.services.FormSupport is available
from the Environment. Available types are org.apache.tapestry.MarkupWriter,
org.apache.tapestry.ValidationDecorator, org.apache.tapestry.dom.Document,
org.apache.tapestry.services.Heartbeat,
org.apache.tapestry.services.PageRenderSupport.

I am assuming I need to provide PageRenderSupport but could not find
documentation on how to do so.

Any help would be appreciated.

--
Dave Kallstrom


Re: Tap 5 FormSupport Exception

2007-02-14 Thread Dave Kallstrom

This is what I have
form t:id=form
   t:comp type=Errors/

   label t:type=Label for=userName/:
   input t:type=TextField t:id=userName
t:validate=required,minlength=3 size=30/
   br/
   label t:type=Label for=password/:
   input t:id=password t:validate=required,minlength=3
size=30/
   br/
   input type=submit value=Login/
   /form

On 2/14/07, DJ Gredler [EMAIL PROTECTED] wrote:


I think I got this error when I tried to use an input component (Select or
TextField or something) without a containing Form component.

On 2/14/07, Dave Kallstrom [EMAIL PROTECTED] wrote:

 I hope this user list is ready for tap5 questions if not please
disregard.
 I am working on my first tap5 hello world page and am having a little
 trouble with form submission.
 I copied the code right of the tap5 page and I am getting the following
 error.

 No object of type org.apache.tapestry.services.FormSupport is available
 from the Environment. Available types are
org.apache.tapestry.MarkupWriter
 ,
 org.apache.tapestry.ValidationDecorator,
org.apache.tapestry.dom.Document,
 org.apache.tapestry.services.Heartbeat,
 org.apache.tapestry.services.PageRenderSupport.

 I am assuming I need to provide PageRenderSupport but could not find
 documentation on how to do so.

 Any help would be appreciated.

 --
 Dave Kallstrom






--
Dave Kallstrom


Re: Tap 5 FormSupport Exception

2007-02-14 Thread Dave Kallstrom

Interesting though when I take away the form component I get the same error

On 2/14/07, Dave Kallstrom [EMAIL PROTECTED] wrote:


This is what I have
 form t:id=form
t:comp type=Errors/

label t:type=Label for=userName/:
input t:type=TextField t:id=userName
t:validate=required,minlength=3 size=30/
br/
label t:type=Label for=password/:
input t:id=password t:validate=required,minlength=3
size=30/
br/
input type=submit value=Login/
/form

On 2/14/07, DJ Gredler [EMAIL PROTECTED] wrote:

 I think I got this error when I tried to use an input component (Select
 or
 TextField or something) without a containing Form component.

 On 2/14/07, Dave Kallstrom [EMAIL PROTECTED] wrote:
 
  I hope this user list is ready for tap5 questions if not please
 disregard.
  I am working on my first tap5 hello world page and am having a little
  trouble with form submission.
  I copied the code right of the tap5 page and I am getting the
 following
  error.
 
  No object of type org.apache.tapestry.services.FormSupport is
 available
  from the Environment. Available types are
 org.apache.tapestry.MarkupWriter
  ,
  org.apache.tapestry.ValidationDecorator ,
 org.apache.tapestry.dom.Document,
  org.apache.tapestry.services.Heartbeat,
  org.apache.tapestry.services.PageRenderSupport.
 
  I am assuming I need to provide PageRenderSupport but could not find
  documentation on how to do so.
 
  Any help would be appreciated.
 
  --
  Dave Kallstrom
 




--
Dave Kallstrom





--
Dave Kallstrom


Re: Tap 5 FormSupport Exception

2007-02-14 Thread Dave Kallstrom

Even more interesting when I comment out all of the html I get the same
error. It must be complaining about my .java file. I suppose tap is not
finding the html template.

On 2/14/07, Dave Kallstrom [EMAIL PROTECTED] wrote:


Interesting though when I take away the form component I get the same
error

On 2/14/07, Dave Kallstrom [EMAIL PROTECTED]  wrote:

 This is what I have
  form t:id=form
 t:comp type=Errors/

 label t:type=Label for=userName/:
 input t:type=TextField t:id=userName
 t:validate=required,minlength=3 size=30/
 br/
 label t:type=Label for=password/:
 input t:id=password t:validate=required,minlength=3
 size=30/
 br/
 input type=submit value=Login/
 /form

 On 2/14/07, DJ Gredler [EMAIL PROTECTED] wrote:
 
  I think I got this error when I tried to use an input component
  (Select or
  TextField or something) without a containing Form component.
 
  On 2/14/07, Dave Kallstrom [EMAIL PROTECTED]  wrote:
  
   I hope this user list is ready for tap5 questions if not please
  disregard.
   I am working on my first tap5 hello world page and am having a
  little
   trouble with form submission.
   I copied the code right of the tap5 page and I am getting the
  following
   error.
  
   No object of type org.apache.tapestry.services.FormSupport is
  available
   from the Environment. Available types are
  org.apache.tapestry.MarkupWriter
   ,
   org.apache.tapestry.ValidationDecorator ,
  org.apache.tapestry.dom.Document,
   org.apache.tapestry.services.Heartbeat,
   org.apache.tapestry.services.PageRenderSupport.
  
   I am assuming I need to provide PageRenderSupport but could not find
 
   documentation on how to do so.
  
   Any help would be appreciated.
  
   --
   Dave Kallstrom
  
 



 --
 Dave Kallstrom




--
Dave Kallstrom





--
Dave Kallstrom


Re: Tap 5 FormSupport Exception

2007-02-14 Thread Dave Kallstrom

Okay now it's fixed. Had leftover html in my Home.html page without
surrounding form component. Oops. So now I have tap5 form with validation
running.

On 2/14/07, Dave Kallstrom [EMAIL PROTECTED] wrote:


Even more interesting when I comment out all of the html I get the same
error. It must be complaining about my .java file. I suppose tap is not
finding the html template.

On 2/14/07, Dave Kallstrom [EMAIL PROTECTED] wrote:

 Interesting though when I take away the form component I get the same
 error

 On 2/14/07, Dave Kallstrom  [EMAIL PROTECTED]  wrote:
 
  This is what I have
   form t:id=form
  t:comp type=Errors/
 
  label t:type=Label for=userName/:
  input t:type=TextField t:id=userName
  t:validate=required,minlength=3 size=30/
  br/
  label t:type=Label for=password/:
  input t:id=password t:validate=required,minlength=3
  size=30/
  br/
  input type=submit value=Login/
  /form
 
  On 2/14/07, DJ Gredler [EMAIL PROTECTED] wrote:
  
   I think I got this error when I tried to use an input component
   (Select or
   TextField or something) without a containing Form component.
  
   On 2/14/07, Dave Kallstrom [EMAIL PROTECTED]  wrote:
   
I hope this user list is ready for tap5 questions if not please
   disregard.
I am working on my first tap5 hello world page and am having a
   little
trouble with form submission.
I copied the code right of the tap5 page and I am getting the
   following
error.
   
No object of type org.apache.tapestry.services.FormSupport is
   available
from the Environment. Available types are
   org.apache.tapestry.MarkupWriter
,
org.apache.tapestry.ValidationDecorator ,
   org.apache.tapestry.dom.Document,
org.apache.tapestry.services.Heartbeat,
org.apache.tapestry.services.PageRenderSupport.
   
I am assuming I need to provide PageRenderSupport but could not
   find
documentation on how to do so.
   
Any help would be appreciated.
   
--
Dave Kallstrom
   
  
 
 
 
  --
  Dave Kallstrom




 --
 Dave Kallstrom




--
Dave Kallstrom





--
Dave Kallstrom


ServletContext

2006-12-28 Thread Dave Kallstrom

I need to generate a url to a servlet running inside the same container as
tapestry. The problem is that I don't know how to get the host name and port
that tapestry is running on.
For example if my tapestry app is located at www.mysite.com/app and my
servlet mapping is url-pattern/wspreviews/*/url-pattern how can I
dynamically construct a url to this servlet?
I have the ServletContext that tapestry is running in. but I don't see
anyway to generate a url from that to a different servlet.

--
Dave Kallstrom


Re: Html Email Messages

2006-12-13 Thread Dave Kallstrom

getRequestGlobals is injected into our BasePage as in the following...
@InjectObject(service:tapestry.globals.RequestGlobals)
   public abstract RequestGlobals getRequestGlobals();
the getRequestGlobals() is just a convenience method for returning
requestGlobals from the underlying page.
And attached is the EmailResponseBuilder as an example of how to implement
ResponseBuilder. I too tried extending the DefaultResponseBuilder but could
not get that to work.

On 12/13/06, explido [EMAIL PROTECTED] wrote:



i'm concerned with the same problem and have tried to examine your
solution
without getting it to work.

My first problem seems to imagine the EmailResponseBuilder class. I
derived
the EmailResponseBuilder from the DefaultResponseBuilder overriding
renderResponse, render and getWriter without success. Your
constructor
carries the cycle, how is this uses inside the EmailResponseBuilder?

My second Problem is your getRequestGlobals(IRequestCycle cycle) method.
Where do you get it from?
I've tried with the following injection:

   @InjectObject(service:tapestry.globals.RequestGlobals)
public abstract RequestGlobals getRequestGlobals();

... but there is no way to store the ResponseBuilder like you do.

where is the magic? can you give me a some advice? thx.

Marco
--
View this message in context:
http://www.nabble.com/Html-Email-Messages-tf2776596.html#a7857759
Sent from the Tapestry - User mailing list archive at Nabble.com.


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





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

Re: Html Email Messages

2006-12-13 Thread Dave Kallstrom

getRequestGlobals(IRequestCycle cycle) simply calls cycle.getPage() to
return the our base paqe which has RequestGlobals injected into it. And if
you look at RequestGlobals you'll see the method void store(ResponseBuilder
builder) and like I mentioned earlier extending DefaultResponseBuilder did
not work for me. Which is why I created EmailResponseBuilder which is almost
identical to DefaultResponseBuilder.

On 12/13/06, explido [EMAIL PROTECTED] wrote:



hi Dave,

that's just the same injection i've done, but i can't do calls like

getRequestGlobals(cycle).store(builder);

i can not pass a cycle and can not store a ResponseBuilder since
getRequestGlobals().store() does only accept
an IRequestCycle

Instead i've tried:

innerCycle.setResponseBuilder(rb);

but still no fun.

... my implementation of EMailResponseBuilder looks like this:

public class EMailResponseBuilder extends DefaultResponseBuilder {
IMarkupWriter _writer;
AssetFactory _assetFactory;

private final static Log LOG =
LogFactory.getLog(EMailResponseBuilder.class);

public EMailResponseBuilder() {
this(null);
}

public EMailResponseBuilder(IMarkupWriter writer) {
super(writer);
_writer = writer;
}

@Override
public IMarkupWriter getWriter() {
if (_writer == null)
return NullWriter.getSharedInstance();
return _writer;
}

@Override
public IMarkupWriter getWriter(String id, String type) {
if (_writer == null)
return NullWriter.getSharedInstance();
return _writer;
}

@Override
public void render(IMarkupWriter writer, IRender render,
IRequestCycle
cycle) {
if (writer == null)
render.render(_writer, cycle);
else
render.render(writer, cycle);
}

@Override
public void renderResponse(IRequestCycle cycle) throws IOException
{
if (_writer == null) {
IPage page = cycle.getPage();
ContentType contentType =
page.getResponseContentType();
String encoding = contentType.getParameter
(ENCODING_KEY);
if (encoding == null)
{
encoding = cycle.getEngine
().getOutputEncoding();
contentType.setParameter(ENCODING_KEY,
encoding);
}

MarkupFilter filter = new AsciiMarkupFilter();
CharArrayWriter charArrayWriter = new
CharArrayWriter();
PrintWriter printWriter = new
PrintWriter(charArrayWriter);
_writer = new MarkupWriterImpl(text/html,
printWriter, filter);
}
// render response
cycle.renderPage(this);
_writer.close();
}
}






Dave Kallstrom wrote:

 getRequestGlobals is injected into our BasePage as in the following...
 @InjectObject(service:tapestry.globals.RequestGlobals)
 public abstract RequestGlobals getRequestGlobals();
 the getRequestGlobals() is just a convenience method for returning
 requestGlobals from the underlying page.
 And attached is the EmailResponseBuilder as an example of how to
implement
 ResponseBuilder. I too tried extending the DefaultResponseBuilder but
 could
 not get that to work.

 On 12/13/06, explido [EMAIL PROTECTED] wrote:


 i'm concerned with the same problem and have tried to examine your
 solution
 without getting it to work.

 My first problem seems to imagine the EmailResponseBuilder class. I
 derived
 the EmailResponseBuilder from the DefaultResponseBuilder overriding
 renderResponse, render and getWriter without success. Your
 constructor
 carries the cycle, how is this uses inside the EmailResponseBuilder?

 My second Problem is your getRequestGlobals(IRequestCycle cycle)
method.
 Where do you get it from?
 I've tried with the following injection:

@InjectObject(service:tapestry.globals.RequestGlobals)
 public abstract RequestGlobals getRequestGlobals();

 ... but there is no way to store the ResponseBuilder like you do.

 where is the magic? can you give me a some advice? thx.

 Marco
 --
 View this message in context:
 http://www.nabble.com/Html-Email-Messages-tf2776596.html#a7857759
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




 --
 Dave Kallstrom

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


--
View this message in context:
http

Re: Html Email Messages

2006-12-11 Thread Dave Kallstrom

So I'll answer my own question in case anyone else is trying to render html
emal with Tap 4.1
The underlying problem was not swapping out the DefaultResponseBuilder from
RequestGlobals and also having to implement ResponseBuilder.
Here is a snippet of code.
   ResponseBuilder defaultBuilder =
getRequestGlobals(cycle).getResponseBuilder();
   IEngine engine = cycle.getEngine();
   RequestCycleFactory factory = getRequestCycleFactory(cycle);

   IRequestCycle inner = factory.newRequestCycle(engine);
   String[] subjectAndBody = new String[2];
   BaseHTMLMessagePage sendPage = (BaseHTMLMessagePage)
getHtmlPage(inner);

   ByteArrayOutputStream out = new ByteArrayOutputStream();
   IMarkupWriter writer = new MarkupWriterImpl(text/html, new
PrintWriter(out), new AsciiMarkupFilter());
   ResponseBuilder builder = new EmailResponseBuilder(writer,
engine.getInfrastructure().getAssetFactory(), false, cycle);

   getRequestGlobals(cycle).store(builder);

   inner.activate(sendPage);
   inner.renderPage(builder);
   writer.flush();
   subjectAndBody[0] = sendPage.getSubject();
   subjectAndBody[1] = out.toString();
   inner.cleanup();

Notice the storing of the EmailResponseBuilder in requestGlobals and then
replacing it with the original DefaultResponseBuilder.
I'm not sure if all of this was necessary but it's the only way I could get
it to work. I will investigate using hivemind to wire up the
EmailResponseBuilder and also the HtmlEmailPage. But for now this is how I
got it to work.

On 12/7/06, Sam Gendler [EMAIL PROTECTED] wrote:


I don't know 4.1, but if you provide a Response and replace the
outputstream, you'll likely get what you want.  You'll just have to
ensure the headers don't get sent, but I believe that is a method you
can overload in the Response.

--sam


On 12/7/06, Dave Kallstrom [EMAIL PROTECTED] wrote:
 In tapestry versions prior to 4.1 we rendered email message using
tapestry
 with the following code.

 BaseHTMLMessagePage sendPage = (BaseHTMLMessagePage) getHtmlPage(inner);
 ByteArrayOutputStream out = new ByteArrayOutputStream();
 IMarkupWriter writer = new MarkupWriterImpl(text/html, new
 PrintWriter(out), new AsciiMarkupFilter());
 inner.activate(sendPage);
 inner.renderPage(writer);
 writer.flush();
 subjectAndBody[0] = sendPage.getSubject();
 subjectAndBody[1] = out.toString();
 inner.cleanup();
 getRequestGlobals(cycle).store(cycle);

 After recently upgrading to 4.1 this method no longer works.
 RequestCycle.renderPage no longer takes an IMarkupWriter but requires a
 ResponseBuilder. I've tried the DefaultResponseBuilder which seems to
want
 to write to the WebResponse instead of the IMarkupWriter that I send it.
My
 question is how best to make this work again? Do I need to implement a
new
 ResponseBuilder somehow or extend the DefaultResponseBuilder? Or is
there a
 better way to render tapestry pages for html email?
 --
 Dave Kallstrom



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





--
Dave Kallstrom


Html Email Messages

2006-12-07 Thread Dave Kallstrom

In tapestry versions prior to 4.1 we rendered email message using tapestry
with the following code.

BaseHTMLMessagePage sendPage = (BaseHTMLMessagePage) getHtmlPage(inner);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IMarkupWriter writer = new MarkupWriterImpl(text/html, new
PrintWriter(out), new AsciiMarkupFilter());
inner.activate(sendPage);
inner.renderPage(writer);
writer.flush();
subjectAndBody[0] = sendPage.getSubject();
subjectAndBody[1] = out.toString();
inner.cleanup();
getRequestGlobals(cycle).store(cycle);

After recently upgrading to 4.1 this method no longer works.
RequestCycle.renderPage no longer takes an IMarkupWriter but requires a
ResponseBuilder. I've tried the DefaultResponseBuilder which seems to want
to write to the WebResponse instead of the IMarkupWriter that I send it. My
question is how best to make this work again? Do I need to implement a new
ResponseBuilder somehow or extend the DefaultResponseBuilder? Or is there a
better way to render tapestry pages for html email?
--
Dave Kallstrom