Tapestrz 5: screencast #3

2007-02-01 Thread Jiří Mareš


Hi,

I just saw the last screecast about tapestry 5 and I would like to ask 
about usign ${currentTime} construct in the page template for outputing 
the properties. How it is with the escaping < > & characters (due to 
XSS)? Have I any control about escaping or have I to do it on my own ...


Thanks
--
Jiri­ Mares (mailto:[EMAIL PROTECTED])

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



Re: [poll] how do people feel about me changing that validation dialog in 4.1.1 ?

2006-12-22 Thread Jiří Mareš

Hi,

for me is important to divide the part of error checking from the error 
presentation. Why?? For me is important to
present the client and server side error the same way not to be able 
distinguish these 2 methods.

The server side validation goes directly this way, the validation engine only 
finds the errors and the presentation is
on the developer, with javascript this should be the same.

Jirka

Dennis Sinelnikov napsal(a):
> 
> Jesse -- I took a look at the links you sent and agree with Alex.
> Flexibility is nice to have, +1 for configurable :)
> 
> Thanks,
> Dennis
> 
> Norbert Sándor wrote:
>> I can't help too much because in my apps I used server side validation
>> only, so I don't know how the client side validation currently works.
>> But if I would use it, then what I'd like is a very easy way to plug
>> in my own solution - which is the exact same copy of what my server
>> side implementation does. So my users could see the same visual
>> presentation of the error message regardsless of it was generated on
>> the client or server side.
>>
>> Regards:
>> Norbi
>>
>> Jesse Kuhnert írta:
>>> If you are using Tapestry 4.1.1 or greater then you have probably run
>>> into the new client side validation modal dialog popup:
>>>
>>> http://tapestry.apache.org/tapestry4.1/usersguide/clientside-validation.html
>>>
>>>
>>> I've decided that I should probably follow some of my own advice and
>>> would like to "fix" this as described here:
>>>
>>> http://www.humanized.com/weblog/2006/09/11/monolog_boxes_and_transparent_messages/
>>>
>>>
>>> Ironically I had already created a Dojo widget to do the exact same
>>> thing before this blog entry even came out but never really thought to
>>> apply the same kind of idea to validation..(this is also the kind of
>>> non-intrusive validation that tacos does by default):
>>>
>>> http://archive.dojotoolkit.org/nightly/tests/widget/test_Toaster.html
>>>
>>> Not sure which release this belongs in but I've got all kinds of
>>> usability/humane/etc plans for validation that I'm going to want to
>>> try applying at some point. I'd really rather just completely remove
>>> this dialog but want to see how people feel about it first.
>>>
>>> I can always just make this a configurable option where you opt-in and
>>> choose which kind of client side validation "theme" you'd like, but
>>> I'm not as convinced that more options here will necessarily be
>>> helping people.
>>>
>>> What do you think/feel ?
>>>
>>
>> -
>> 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]
> 
> 

-- 
Jiří Mareš (mailto:[EMAIL PROTECTED])
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic

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



Re: reading a file in web root in a Tapestry fashion

2006-12-21 Thread Jiří Mareš

Hi,

the rules are quite simple, there have to be only one service of the type ... 
otherwise you have to specify what service
do you want to ...

Jirka

Cyrille37 napsal(a):
> 
> Ron Piterman a écrit :
>> yes, thats it - BTW, you don't need an explicit set-service.
>> just exposte a setter in your implementation class, and hivemind will
>> autowire it:
>>
>> public void setServletContext( ServletContext ctx) {...}
>>   
> heuu...
> I do not really understand.
> Do you mean Hivemind will do that automatically ?
> What are rules ?
> Do you know the documentation about that ?
> 
> Thanks a lot
> Cyrille
>> Cheers,
>> Ron
>>
>>
>> Cyrille37 wrote:
>>  
>>> Ron Piterman a écrit :
>>>
>>>> On which class do you need to access the resource?
>>>> 
>>> I've resolved the case with Hivemind.
>>> I pass to the ObjectFactory the ServletContext to get a root path and
>>> the relative filename.
>>>
>>>>> interface="games.hangman.service.HangmanFactory">
>>>
>>>
>>>>> service-id="tapestry.globals.ServletContext"/>
>>>
>>>
>>>
>>>
>>>  
>>>
>>>
>>>
>>>
>>>
>>>
>>> I would have liked only the Hivemind's contribution entry, but to pass
>>> parameters to the instance I've understood that we have to use a
>>> Factory. So two Hivemind's entries.
>>>
>>> Perhaps it could be lighter with the Hivemind's "Lightweight Instance
>>> Initialization"
>>> http://hivemind.apache.org/instance-initialization.html
>>> But I do not understand how it works ...
>>>
>>> I would have liked something simple as:
>>>
>>>>> class="games.hangman.service.Hangman" >
>>>   >> ref="tapestry.globals.ServletContext" />
>>>   >> value="WordsList.txt" />
>>>
>>>
>>> Cyrille
>>>
>>>
>>>> Cheers,
>>>> Ron
>>>>
>>>>
>>>>
>>>> Cyrille37 wrote:
>>>>  
>>>>  
>>>>> Hello,
>>>>> Sure it is a beginner question, but I'm a beginner :o)
>>>>>
>>>>> I would like to read a file which is located in the web root
>>>>> folder, and
>>>>> put it in a String.
>>>>> I had a look around the Internet and found some tricks :
>>>>>
>>>>> A la "Servlet" :
>>>>> ServletContext theApplicationsServletContext = (ServletContext)
>>>>> this.getExternalContext().getContext();
>>>>> String realPath =
>>>>> theApplicationsServletContext.getRealPath("/resources/images");
>>>>> File file = new File(realPath + File.separatorChar + justFileName);
>>>>>
>>>>> A la "Rife" :
>>>>> import com.uwyn.rife.tools.FileUtils;
>>>>> URL resource =
>>>>> getClass().getClassLoader().getResource("model/WordList.txt");
>>>>> final String wordlist = FileUtils.readString(resource);
>>>>>
>>>>> Please could you tell me what are methods and usages with Tapestry ?
>>>>>
>>>>> Thanks
>>>>> cyrille
>>>>> 
>>>
>>   
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
Jiří Mareš (mailto:[EMAIL PROTECTED])
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic

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



Re: DISabling the back button

2006-11-29 Thread Jiří Mareš

Hi,

the header forcing browser not cache the page are:

Pragma: No-cache
Cache-Control: no-cache,no-store,max-age=0
Expires: 1

Jirka

PS: It makes problems with downloading file (attachments) in IE via HTTPS, so 
you have change header for attachemnt
downloding for IE to:

Cache-Control: max-age=0
Expires: 1


>> 2. After a logout. We don't want our users to be able to use the back
>> button
>> to see the
>>   last page, from which he clicked the "Log out" link. We know that going
>> somewhere
>>   from that brought back page would lead the user to the login page, but
>> none the less,
>>   it would be bad enough, especially if it is done from a public
>> terminal.
> Hello,
> 
> I've made a lot of search about this subject, but I did not find a
> functionnal solution.
> I've try many headers about cache expriation and so on, but no solution.
> For example when I click the Back button on FireFox, it show me the page
> and there is no access on the server, it is only a cache version of the
> page.
> 
> If you find http headers which make impossible for the webBrowser to go
> back without talking with the server I'll give you all my love ! ;-)
> It's a hard subject.

-- 
Jiří Mareš (mailto:[EMAIL PROTECTED])
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic

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



Re: Outputing a file to user (correctly getting ahold of the getOutputStream method)

2006-11-10 Thread Jiří Mareš

Hi,

it is not much difficult: First the URL to servise is 
http://your.server/your.app.context/app?service=pdf_report&pdf=xx

where the pdf_report is the name of the service and attribute pdf specified 
what report to return (you can use any
attributes you want and need).

Then you create the service:

public class PdfReportServise implements IEngineService {
   protected HttpServletResponse response;
   protected LinkFactory linkFactory;

   public void setResponse(HttpServletResponse response) {
  this.response = response;
   }

   public void setLinkFactory(LinkFactory linkFactory) {
  this.linkFactory = linkFactory;
   }

   public String getName() {
  return "pdf_service";
   }

   public void service(IRequestCycle cycle) throws IOException {
  ... first parse you parameters ...
  ... generate the report or open the file with report ...
  response.setHeader(...); eg. Content-Disposition ...
  response.setContentType("application/pdf");
  try {
 OutputStream os = response.getOutputStream();
 ... write your data ...
  } catch (IOException e) {
 throw new ApplicationRuntimeException(e);
  }
   }

   public ILink getLink(boolean post, Object parameter) {
  Map params = new HasMap();
  params.put("param1", (String) ((Object[]) parameter)[0]);
  ... put all parameters ...
  return linkFactory.constructLink(this, post, params, false); //the last 
false means not to add jsessionid, true
means add if appropriate
   }

}

Then you can use in template:

Get the report

and in page specification:


   
 


I hope i didn't miss anythink ...


Jirka
To add the service into application add to your hivemind.xml (If you have none 
create it in META-INF directory):


   
  

  
   
   
  
   


Ender Shorty napsal(a):
> Hello all,
> 
> I've searched around the forums attempting to discover a way to output a
> file to the user.  What I'm trying to do is after creating a pdf file with
> JasperReports i'd like to output it to the user.  I use Tapestry 4.02.  It
> looks like the old way was to do something like this...
> 
> Make a method like the following a a listener, such as from a DirectLink or
> whatever.
> 
> (The Document is just a class that holds the file information you want to
> send to the user.)
> 
> public void downloadAction(IRequestCycle cycle)
> {
>try
>{
>HttpServletResponse response =
>cycle.getRequestContext().getResponse();
> 
> 
>byte[] data = new byte[1024];
>FileInputStream in = document.getFileInputstream();
> 
> 
>response.setHeader("Content-disposition",
>  "inline; filename=" +
>   document.getFileName());
>response.setContentType(document.getMimeType());
>response.setContentLength(new Long(document.getSize()).intValue());
>ServletOutputStream out = response.getOutputStream();
> 
>int bytesRead = 0;
>while ((bytesRead = in.read(data)) > -1)
>{
>out.write(data, 0 , bytesRead);
>}
>in.close();
>response.flushBuffer();
>}
>catch (IOException e)
>{
>e.printStackTrace();
>}
> }
> 
> Now it output's a pdf file correctly, and everything seems to work
> fine, but looking at the log, i get serveral of these:
> javax.servlet.ServletException: getOutputStream() has already been
> called for this response
> 
> Apparently the new correct way is to create a service.  Does anyone
> have an example of outputing a file with a service?
> Thank you very much for any assistance.
> 

-- 
Jiří Mareš (mailto:[EMAIL PROTECTED])
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic

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



Re: How can I pass a component as a parameter to my custom component

2006-10-24 Thread Jiří Mareš

Hi,

In component-specification:


  ...
  
  ...


Then in component template can be component referenced e.g.:



And when you use the component and wants to pass the component as parameter:



Jirka

> I am working with tap 4.0, in tomcat 5.5.14 with jdk 1.5.
> 
> I would like to create my own component. This component should receive a
> parameter (not required) that specify another component (in this case is a
> submit button component), I would like to use the container defined
> component in the custom component, but I don't know how to do this. I'll
> try
> to explain this more carefully with an example:
> 
> containerPage.page
> ...
> 
>listener:onSubmit
>
>
> 
> 
> 
> 
> 
> 
> 
> componentPage.jwc (here is my biggest doubt!)
> ...
> 
> 
> 
>
> 
> ...
> 
> componentPage.html
> ...
> 
> ...
> 
> The componentPage.html should show the button passed as a parameter from
> the
> containerPage.page ... this parameter will call the onSubmit of the class
> containerPage.
> 
> Any one has done this ??? There is an easy and clean way to do this ?
> 
> Thanks in advance.
> 

-- 
Jiří Mareš (mailto:[EMAIL PROTECTED])
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic

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