struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: newbie alert: forward to a php script
Date Wed, 18 Apr 2007 21:12:44 GMT
I'm not really clear on what you're trying to achieve, but it sounds 
like you just need to read the HTTP response from the request you make 
through HttpClient. Since you're making that request from your action 
and, therefore, will have the response available there too, you don't 
need to 'direct it to an action'; you're already in an action.

If you're still having trouble, try describing the overall problem 
you're trying to solve.

L.

Chris Pat wrote:
> Hi Laurie
> Thank you for continuing to help my naivete.  I saw two problems: one I didnt know how
to format and send a forward out of the struts framework, two the response will only come
back on the port and without any context so I cant direct it to an Action(possibly even the
same as the pre-processing) to receive and post-process the response.  Am I able to do any
of these natively within Struts?  I have the first part working with HttpClient, but working
out the second half of the php script getting the response and sending it to my Action.  Again
thank you.
> 
> Laurie Harper <laurie@holoweb.net> wrote: I'm still not clear why you need the
PHP script at all; why not call out 
> to the remote server directly from your Java webapp? That would seem to 
> be a simpler route.
> 
> However, if you really do need the PHP script in there something like 
> HttpClient, as suggested by another poster, would probably be the 
> easiest way to build and submit the HTTP request.
> 
> L.
> 
> Chris Pat wrote:
>> Hi Laurie
>> Thanks.  All I need is to send a HTTP Post request to  the php script with the parameters
that the Action received, but having done some processing in the Action.  At this point I
dont care if the client sees the results of the php output.  I dont see how to generate something
like a RequestDisptacher from within an Action even if I just send the client to a success
page at the end.
>>
>> My design problem is that I am trying to talk to a cc processor using struts code.
 Right now the only way I can send the post to the cc processor and receive the response on
the same port is with a php script.  So I thought of splitting it up and using curl to send
to the cc processor after processing it in an Action, receiving it in the php scrip and forwarding
it to another Action for post processing.  I have to get around the fact that the cc processor
will only send back a response on the same port that the port as the request, obviously without
a nicely formatted context/servlet syntax.  I believe this will work, if I can only get a
post sent to the php script which will be a url outside of the Struts framework.  I am sure
this massively violative MVC and probably not scalable, but I just have to get it done.  Thanks
for even the slightest insight, even if saying it is utterly st
>  up
>>  id, grin.
>>
>> Laurie Harper  wrote: Chris Pat wrote:
>>> Hello
>>> Is it possible to have an Action that processes some data and then posts to a
url completely out of control of the framework?  I want to process and write to a db first
and then using the same parameters and any added session variables post to a php script, initially
running on localhost but eventually on a completely different url.  Can someone help me understand
how or why not.  I really need to do it even if it is not to the spec.  Thank you.
>> Post to? Sure, you can create an HTTP POST request to any URL. But I 
>> suspect that's not quite what you mean. If you mean /forward/ to, as in 
>> dispatch to, a PHP script, it's not so straight forward.
>>
>> I seem to recall seeing mention on this list in the past of some sort of 
>> Java-PHP bridge, which may be what you're looking for. Search the 
>> archives (or Google) for 'Java PHP bridge' and see if that turns 
>> anything useful up. Alternatively, re-post with clarification of exactly 
>> what you want to achieve; maybe someone will be able to give a more 
>> specific solution.
>>
>> L.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message