Re: Setting URLConnection User-Agent String

2011-10-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Warren,

Resurrecting an old thread: I hadn't noticed your reply back in March.

On 3/1/2011 5:46 AM, warrell harries wrote:
 It doesn't make any difference - it's plain old HTTP despite the
 jargon :)

Of course.

 If you have already seen this 
 http://www.mail-archive.com/users@cocoon.apache.org/msg34182.html
 
 then investigate the original Generator code at 
 /cocoon-2.1.11/src/blocks/proxy/java/org/apache/cocoon/generation/WebServiceProxyGenerator.java

  It could be that this will be sufficient for your requirements.

So, I'm using a simple XML-over-HTTP request as my generator, like this:

map:part src=http://host/service.xml; /

I'm using the default set of Cocoon generators with default=file, or
org.apache.cocoon.generation.FileGenerator. The request is definitely
using an HTTP connection, as this URL is not otherwise reachable (and
it's showing up in our request logs, too).

But, it's not a web service. Maybe that's not relevant, but I thought
I'd point it out as you directed me towards WebServiceProxyGenerator.java.

I took a look at how WSPG works, and it's a relatively straightforward
use of commons-httpclient, which has an addUserAgentRequestHeader
method available.

The question is how to get the setting from the sitemap into the
object that actually makes the connection.

Is the setup(..., Parameters par) method the right place to do such
things? If so, a simple patch like this:

if(par.isParameter(user-agent))
  this.httpClient.getParams(HttpParam.USER_AGENT,
par.getParameter(user-agent));

Would this be the right place to put such code, and how does one
configure parameters to map:generator? Using attributes like
map:generator ... user-agent=MyUserAgent / or using sub-elements?

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

iEYEARECAAYFAk6LKO4ACgkQ9CaO5/Lv0PBT2gCfVAgtjQSTjPi24/7q3YX1KTbf
q7wAn3ZmyoSa+qWrMICb8PSY398UGOwh
=KKRy
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



Cocoon3 newbie help

2011-10-04 Thread Marzia Forli
I am a xml processing newbie, who have to read-transform-write some pretty big 
xml files, and in my journey to the jaxp land I stumbled upon this wonderful 
library... Here I ask for some kind advice regarding the my problem. For my 
case let's imagine that we have a pretty big pom.xml and I would have to do the 
following:
1) if under the tag 'repositories/repository/name' in the body is present 
string 'snapshots' then rewrite the 'url' element stripping out the tags and 
make it uppercase...
2) given the dependencies/dependency/groupId element if there is one dependency 
with groupId = 'org.apache.cocoon.sax' then i have to get and rewrite all 
dependencies elements
to make it simple if I found a desired element then I have to operate on 
containing element rewriting it... Transformations I have to do a without the 
xslt.
Maybe what I am asking seems trivial or plain stupid but I am not an expert 
just learning... Is this library right for this task and if yes what would be 
the right approach to handle this. Many many thanks


-
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org