Sure it's simple, do this in your service layer, maybe in a new thread up to 
the implementation. And of course implement better error handling.   
  private String createQueryString() {        StringBuilder sb = new 
StringBuilder();        sb.append("var1=");        
sb.append(URLEncoder.encode(value1, "UTF-8"));
        return sb.toString();    }


private String makeRequest(String urlToCall, query) throws IOException {
        String response = null;
        try {            URL urlCall = new URL(urlToCall);            
HttpURLConnection con = (HttpURLConnection) urlCall.openConnection();           
 con.setDoInput(true);            con.setDoOutput(true);            
con.setUseCaches(false);            con.setRequestMethod("POST");            
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");    
        DataOutputStream printout = new 
DataOutputStream(con.getOutputStream());            printout.writeBytes(query); 
           printout.flush();            printout.close();
            BufferedReader bufferedReader = new BufferedReader(new 
InputStreamReader(con.getInputStream()));            String str;            
StringBuffer bf = new StringBuffer();
            while (null != ((str = bufferedReader.readLine()))) {               
 bf.append(str);
            }
            bufferedReader.close();
            response = bf.toString();            logger.finest("got response " 
+ response);
        } catch (MalformedURLException ex1) {            
logger.severe(ex1.getMessage());        }
        return response;    }








Date: Tue, 10 Nov 2009 17:08:25 -0500
From: [email protected]
To: [email protected]
Subject: Re: [Stripes-users] RedirectResolution using POST





Re: [Stripes-users] RedirectResolution using POST


Jocke,



I personally would like to hear more about this solution and possibly see some 
code samples.



Generally speaking, I have found that many applications do not really correctly 
implement GET and POST. Many leverage POST to circumvent GET limitations or 
prevent information from being written to logs.



The use of mod_rewrite + mod_proxy is really just masking the problem and 
working around the specification, but I like the solution better than a “form 
shell” that auto submits (for reasons of accessibility, though those can be 
worked around by providing a button when Javascript is disabled...).



A controller solution is very intriguing as, while another specification 
workaround, it is hidden from the view and the protocol layers preserving the 
data being passed around.



Regards,

TIm





On 11/10/09 2:15 AM, "Jocke Eriksson" <[email protected]> wrote:



I would go with the URL Connection class, this will give you the possibility to 
implement failover when

needed. 



> Date: Mon, 9 Nov 2009 19:54:48 +0100

> From: [email protected]

> To: [email protected]

> Subject: [Stripes-users] RedirectResolution using POST

> 

> Hi,

> 

> I'm integrating with an online payments service and would love to POST 

> to their URL instead of GETting it. Is it possible to do so using 

> RedirectResolution or some other means?

> 

> Best regards,

> Grzegorz

> 

> 

> ------------------------------------------------------------------------------

> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 

> trial. Simplify your report design, integration and deployment - and focus on 

> what you do best, core application coding. Discover what's new with

> Crystal Reports now.  http://p.sf.net/sfu/bobj-july

> _______________________________________________

> Stripes-users mailing list

> [email protected]

> https://lists.sourceforge.net/lists/listinfo/stripes-users

       

Hitta kärleken! Klicka här Hitta en dator som passar dig! 
<http://windows.microsoft.com/shop> 

------------------------------------------------------------------------------

Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 

trial. Simplify your report design, integration and deployment - and focus on 

what you do best, core application coding. Discover what's new with

Crystal Reports now.  http://p.sf.net/sfu/bobj-july



-- 

Timothy Stone   |   Application Developer Technical Lead

Barclaycard   |    Business Technology Group, Strategic Development

125 S. West Street   |   Wilmington, DE    |   19801

USA   |   www.barclaycardus.com

+1 302 255 8044 direct |   +1 410 441 9450 cell

 

COMPANY CONFIDENTIAL

 

P Before printing this e-mail, or any other document, ask yourself whether you 
need a hard copy


 

_______________________________________________________

Barclays
www.barclaycardus.com
_______________________________________________________

This e-mail and any files transmitted with it may contain confidential and/or 
proprietary information. It is intended solely for the use of the individual or 
entity who is the intended recipient. Unauthorized use of this information is 
prohibited. If you have received this in error, please contact the sender by 
replying to this message and delete this material from any system it may be on. 
                                         
_________________________________________________________________
Nya Windows 7 - Hitta en dator som passar dig! Mer information. 
http://windows.microsoft.com/shop
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to