Re: R: R: Error : request.getReader()

2007-01-30 Thread Craig McClanahan

On 1/29/07, Marcello Savino [EMAIL PROTECTED] wrote:


The reason i need the request body is that the action i should take is to
analyze the html generated. (ie.: syntax checking, finding img without alt
attributes, reading meta-information ...).
More: this job must be done server side (no jscript or other client-side
stuff are allowed in my application).
Thanks



Marcello,

To accomplish this goal,  it seems to me you should be caring about the
*response*, not the *request*, right?  After all, it is the response that
contains the markup that was generated by the server.  The request will only
contain the request parameters for this form, in the standard format defined
by the HTML specification.

If my assumption is correct, you should look at technologies that use a
Servlet Filter to be able to capture a copy the rendered output, in addition
to sending it to the browser.  Using a Filter has the advantage of being
something you can add without modifying the actual code that creates the
HTML output, and then removed when you are finished with your testing.  As
to details of the technology, the SiteMesh[1] package has to do exactly what
you are talking about ... buffer up the generated response, and then do
something with it.  SiteMesh is about transforming the generated output,
which you are likely not interested in ... but examining the source code of
the filter that SiteMesh uses should give you a big head start on figuring
out how to implement something like this.

Craig

[1] http://www.opensymphony.com/sitemesh/

Marcello Savino

ALDEBRA S.p.A.
tel.  0461302441



Re: R: R: Error : request.getReader()

2007-01-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marcello,

Marcello Savino wrote:
 The reason i need the request body is that the action i should take
 is to analyze the html generated. (ie.: syntax checking, finding img
 without alt attributes, reading meta-information ...). More: this job
 must be done server side (no jscript or other client-side stuff are
 allowed in my application).

HTTP requests should not contain any HTML at all, so I'm not sure what
you were expecting to read from the request.

I'm starting to think that Dave Newton was on the right track, although
it seemed like a hideous hack ;)

So, correct me if I'm wrong, but it sounds like you want to put some
server-side checks /outside/ your HTML-generating code in order to
perform some quality-assurance on the outgoing HTML code.

I think this is best done with a filter.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFv4B89CaO5/Lv0PARAm0DAKDD/MaKU+ZhVKsK7hziU8nSRVHSmQCgmrsQ
vElcEzZcruaNNlTifc9gOqI=
=b4U+
-END PGP SIGNATURE-

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



RE: R: R: Error : request.getReader()

2007-01-30 Thread Dave Newton
From: Christopher Schultz
 I'm starting to think that Dave Newton was on the right track,
 although it seemed like a hideous hack ;)

Pretty much any time I'm on the right track it's a hideous hack. I start
off meaning well then it all goes cow's legs up.

 I think this is best done with a filter.

+1 to Chris and Craig.

Dave


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



R: R: Error : request.getReader()

2007-01-29 Thread Marcello Savino
The reason i need the request body is that the action i should take is to 
analyze the html generated. (ie.: syntax checking, finding img without alt 
attributes, reading meta-information ...).
More: this job must be done server side (no jscript or other client-side stuff 
are allowed in my application).
Thanks


Marcello Savino
ALDEBRA S.p.A. 
tel.  0461302441

-Messaggio originale-
Da: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Inviato: venerdì 26 gennaio 2007 19.59
A: Struts Users Mailing List
Oggetto: Re: R: Error : request.getReader()

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marcello,

Marcello Savino wrote:
 You got it !
 More: i need to access the request body after the form was submited. 
 The only way i know is in the action subclass, but Struts process the 
 parameter before invoking the appropriate method in action subclass.
 If somoebody knows a trick to get request before struts process it, 
 without interfer with the rest of process. .

Maybe if you can explain /why/ you need the request body, we can help you out 
with it. I definitely have a potential solution, but I want to know what you 
need to do, first.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFuk9f9CaO5/Lv0PARAqcLAKCPHf2oIcr0cqneUoPfM/lSn3uk+QCfRi7L
yyJsJFxf8QXtMGUgZXy/K3k=
=cR6t
-END PGP SIGNATURE-

-
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]



R: Error : request.getReader()

2007-01-26 Thread Marcello Savino
Dave Newton wrote: 
[...] he just wants access to the request body *after* the parameters
have been processed. 
That's the only reason that request.getReader would throw an exception.
[...]

[Marcello]
You got it !
More: i need to access the request body after the form was submited. The
only way i know is in the action subclass, but Struts process the
parameter before invoking the appropriate method in action subclass.
If somoebody knows a trick to get request before struts process it,
without interfer with the rest of process. .
Anyway thank everybody for the answers

Marcello

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



RE: Error : request.getReader()

2007-01-26 Thread Dave Newton
From: Marcello Savino
 Dave Newton wrote:
 [...] he just wants access to the request body *after* the parameters
 have been processed.
 That's the only reason that request.getReader would throw an
 exception.
 [...]
 
 [Marcello]
 You got it !

Actually it was Chris that got it, I was still stupid until he said that
:)

You may want to consider doing something in a custom request processor.

Dave


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



R: Error : request.getReader()

2007-01-26 Thread Marcello Savino
 


Dave Newton wrote:
Actually it was Chris that got it, I was still stupid until he said
that
:)
You may want to consider doing something in a custom request processor.

Marcello Savino:
Not so stupid as i am, if you think i'm still looking for a solution
...
Before you suggest me to re-write Struts ;-) ..
The proccessing of the request i need must be implemented in a large
struts existing application... Maybe the filter is a good idea,  i have
to study how to implement it, where to put it.
Thanks again

Marcello



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



RE: Error : request.getReader()

2007-01-26 Thread Dave Newton
From: Marcello Savino
 Before you suggest me to re-write Struts ;-) ..
 The proccessing of the request i need must be implemented in a large
 struts existing application... Maybe the filter is a good idea,  i
 have to study how to implement it, where to put it.

The request processor is designed to be customized and has several hooks
ready-made for adding functionality and is pretty straight-forward.

Just an idea.

Dave

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



Error : request.getReader()

2007-01-25 Thread Marcello Savino
 
In an Action subclass the execution of request.getReader() throw en
IllegaStateException.
I found that this is the normal behavior in the servlet, but i need to
do this in all my Action subclass. Any idea to get a turnaround to solve
this problem ?
Any help will be appreciated
Thanks in advance

Marcello



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



Re: Error : request.getReader()

2007-01-25 Thread Dave Newton
--- Marcello Savino wrote:
 In an Action subclass the execution of
 request.getReader() throw en
 IllegaStateException.

Why not just write a *really* simple custom tag that
does whatever it is you think you want to do with the
output?

Dave



 

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

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



Re: Error : request.getReader()

2007-01-25 Thread Dave Newton
Bollocks.

--- Marcello Savino wrote:
 In an Action subclass the execution of
 request.getReader() throw en
 IllegaStateException.

Why not just create a custom tag that does whatever it
is you think you need to do, wrap it around your
entire page contents, then getting the body becomes as
simple as getBodyContent() and you're done with it?

Dave



 

Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

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



R: Error : request.getReader()

2007-01-25 Thread Marcello Savino
I really don't undestand what you mean.
Can you explain with a little example ?
Thanks in advance 


Marcello Savino
ALDEBRA S.p.A. 
tel.  0461302441

-Messaggio originale-
Da: Dave Newton [mailto:[EMAIL PROTECTED] 
Inviato: giovedì 25 gennaio 2007 13.11
A: Struts Users Mailing List
Oggetto: Re: Error : request.getReader()

Bollocks.

--- Marcello Savino wrote:
 In an Action subclass the execution of request.getReader() throw en 
 IllegaStateException.

Why not just create a custom tag that does whatever it is you think you need to 
do, wrap it around your entire page contents, then getting the body becomes as 
simple as getBodyContent() and you're done with it?

Dave



 

Now that's room service!  Choose from over 150,000 hotels in 45,000 
destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

-
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]



[OT] RE: Error : request.getReader()

2007-01-25 Thread Dave Newton
From: Marcello Savino
 I really don't undestand what you mean.
 Can you explain with a little example ?

http://www.phptr.com/articles/article.asp?p=26119seqNum=7rl=1

http://java.sun.com/developer/Books/javaserverpages/cservletsjsp/index.h
tml has a link (PDF) to the chapter about creating custom tags which
might also help.

In a nutshell, look at the tag's doAfterBody method (this is from the
first link):

public class FilterTag extends BodyTagSupport {
 public int doAfterBody() {
  BodyContent body = getBodyContent();
  String filteredBody =
   ServletUtilities.filter(body.getString());
//...etc.

body.getString() gives you the rendered contents of the tag's body.

Dave

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



R: [OT] RE: Error : request.getReader()

2007-01-25 Thread Marcello Savino
I've read what you suggested but the problem is that i need a submit tag in 
other words, i need to process the request content after the user press a 
specific button (the others are handled in a LookupDispatchAction subclass).
I think i need some more info to built this kind of tag. Do you know where i 
can get more information to obtain the result ?

Thanks


Marcello Savino
ALDEBRA S.p.A. 
tel.  0461302441

-Messaggio originale-
Da: Dave Newton [mailto:[EMAIL PROTECTED] 
Inviato: giovedì 25 gennaio 2007 15.49
A: Struts Users Mailing List
Oggetto: [OT] RE: Error : request.getReader()

From: Marcello Savino
 I really don't undestand what you mean.
 Can you explain with a little example ?

http://www.phptr.com/articles/article.asp?p=26119seqNum=7rl=1

http://java.sun.com/developer/Books/javaserverpages/cservletsjsp/index.h
tml has a link (PDF) to the chapter about creating custom tags which might also 
help.

In a nutshell, look at the tag's doAfterBody method (this is from the first 
link):

public class FilterTag extends BodyTagSupport {  public int doAfterBody() {
  BodyContent body = getBodyContent();
  String filteredBody =
   ServletUtilities.filter(body.getString());
//...etc.

body.getString() gives you the rendered contents of the tag's body.

Dave

-
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]



R: [OT] RE: Error : request.getReader()

2007-01-25 Thread Marcello Savino
Very interesting approach, thanks  a lot


Marcello Savino
ALDEBRA S.p.A. 
tel.  0461302441

-Messaggio originale-
Da: Dave Newton [mailto:[EMAIL PROTECTED] 
Inviato: giovedì 25 gennaio 2007 15.49
A: Struts Users Mailing List
Oggetto: [OT] RE: Error : request.getReader()

From: Marcello Savino
 I really don't undestand what you mean.
 Can you explain with a little example ?

http://www.phptr.com/articles/article.asp?p=26119seqNum=7rl=1

http://java.sun.com/developer/Books/javaserverpages/cservletsjsp/index.h
tml has a link (PDF) to the chapter about creating custom tags which might also 
help.

In a nutshell, look at the tag's doAfterBody method (this is from the first 
link):

public class FilterTag extends BodyTagSupport {  public int doAfterBody() {
  BodyContent body = getBodyContent();
  String filteredBody =
   ServletUtilities.filter(body.getString());
//...etc.

body.getString() gives you the rendered contents of the tag's body.

Dave

-
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: [OT] RE: Error : request.getReader()

2007-01-25 Thread Dave Newton
From: Marcello Savino
 I've read what you suggested but the problem is that i need a submit
 tag in other words, i need to process the request content after the
 user press a specific button (the others are handled in a
 LookupDispatchAction subclass).

...you want to submit a form and have access to the body of the page
you've submitted from?!

Maybe you could use JavaScript to get the innerHTML of a page-spanning
DIV or something, but... your requirements still puzzle me. I can't help
but think this is being approached in the wrong way.

Dave


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



RE: Error : request.getReader()

2007-01-25 Thread Dave Newton
From: Marcello Savino
 Up again with more details, please help!

Okay, what if you re-rendered the action you submitted from but gave it
a StringWriter? This is sick and wrong.

What *specifically* are you attempting to do?

Dave


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



Error : request.getReader()

2007-01-25 Thread Marcello Savino

Up again with more details, please help!

In an Action subclass the execution of request.getReader() throw an
IllegaStateException.
I found that this is the normal behavior in the servlet, but i need to
do this in all my LookupDispatchAction subclass. Any idea to get a
turnaround to solve this problem ?
1) I can't use javascripts
2) I need to take desired action after the user act on a specific sumbit
button (the other are handled by a LookupDispatchAction subclass to take
the desired action)

Any help will be appreciated
Thanks in advance

Marcello



-
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: Error : request.getReader()

2007-01-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave,

Dave Newton wrote:
 From: Marcello Savino
 Up again with more details, please help!
 
 Okay, what if you re-rendered the action you submitted from but gave it
 a StringWriter? This is sick and wrong.
 
 What *specifically* are you attempting to do?

I think you might be missing what he's trying to do. I think he just
wants access to the request body *after* the parameters have been
processed. That's the only reason that request.getReader would throw an
exception.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFuRas9CaO5/Lv0PARAhnIAKC8XGpYjFTXQNrQMJJpFQZpsp43dgCgqhLQ
kN7kygBS0I5Gagw4U/rfddk=
=VVpH
-END PGP SIGNATURE-

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



Re: Error : request.getReader()

2007-01-25 Thread Dave Newton
--- Christopher Schultz wrote:
 I think you might be missing what he's trying to do.

I'm pretty sure I am ;)

You mean the HTML body after Action execution?!

I'm still not sure how this can be done on the server
side without resorting to minor treachery; it seems
like driving the site w/ HttpUnit or HttpClient or...
etc. would be a better idea.

Dave



 

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

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



Re: Error : request.getReader()

2007-01-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave,

Dave Newton wrote:
 --- Christopher Schultz wrote:
 I think you might be missing what he's trying to do.
 
 I'm pretty sure I am ;)
 
 You mean the HTML body after Action execution?!

No. The /request/ body after form processing (i.e. at the top of the
Action code, which gets executed /after/ the request body has been read
by struts to populate the form bean.

 I'm still not sure how this can be done on the server
 side without resorting to minor treachery; it seems
 like driving the site w/ HttpUnit or HttpClient or...
 etc. would be a better idea.

Yeah, I think you're thinking of capturing the page body. He originally
asked about the request body (which is the only reason to call
request.getReader in the first place).

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFuTmB9CaO5/Lv0PARAldCAJ0RmL4F5esJ1jXXODds5IKVCjx7LACfc68x
+IDLXwCfv8HdHudjhA2pdUk=
=Lxfb
-END PGP SIGNATURE-

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



Re: Error : request.getReader()

2007-01-25 Thread Dave Newton
--- Christopher Schultz wrote:
 No. The /request/ body after form processing (i.e.
 at the top of the Action code, which gets executed 
 /after/ the request body has been read
 by struts to populate the form bean.

Oo.

How is that going to help him see if it meets
accessibility requirements? (I don't know anything
about accessibility stuff, obviously :)

d.



 

Never Miss an Email
Stay connected with Yahoo! Mail on your mobile.  Get started!
http://mobile.yahoo.com/services?promote=mail

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