// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package org.apache.oltu.oauth2.client; import java.io.IOException; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.oltu.oauth2.client.request.OAuthClientRequest; import org.apache.oltu.oauth2.client.response.OAuthClientResponse; import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; import org.apache.oltu.oauth2.common.exception.OAuthProblemException; import org.apache.oltu.oauth2.common.exception.OAuthSystemException; import org.apache.oltu.oauth2.common.utils.OAuthUtils; // Referenced classes of package org.apache.oltu.oauth2.client: // HttpClient public class URLConnectionClient implements HttpClient { public URLConnectionClient() { } public OAuthClientResponse execute(OAuthClientRequest oauthclientrequest, Map map, String s, Class class1) throws OAuthSystemException, OAuthProblemException { Object obj; URLConnection urlconnection; int i; obj = null; java.util.Map.Entry entry; try { urlconnection = (new URL(oauthclientrequest.getLocationUri())).openConnection(); } // Misplaced declaration of an exception variable catch (OAuthClientRequest oauthclientrequest) { throw new OAuthSystemException(oauthclientrequest); } i = -1; if (!(urlconnection instanceof HttpURLConnection)) goto _L2; else goto _L1 _L1: obj = (HttpURLConnection)urlconnection; if (map == null) { break MISSING_BLOCK_LABEL_120; } if (!map.isEmpty()) { for (map = map.entrySet().iterator(); map.hasNext(); ((HttpURLConnection) (obj)).addRequestProperty((String)entry.getKey(), (String)entry.getValue())) { entry = (java.util.Map.Entry)map.next(); } } if (oauthclientrequest.getHeaders() != null) { java.util.Map.Entry entry1; for (map = oauthclientrequest.getHeaders().entrySet().iterator(); map.hasNext(); ((HttpURLConnection) (obj)).addRequestProperty((String)entry1.getKey(), (String)entry1.getValue())) { entry1 = (java.util.Map.Entry)map.next(); } } if (OAuthUtils.isEmpty(s)) goto _L4; else goto _L3 _L3: ((HttpURLConnection) (obj)).setRequestMethod(s); if (s.equals("POST")) { ((HttpURLConnection) (obj)).setDoOutput(true); map = new PrintWriter(((HttpURLConnection) (obj)).getOutputStream()); map.print(oauthclientrequest.getBody()); map.flush(); map.close(); } _L5: ((HttpURLConnection) (obj)).connect(); i = ((HttpURLConnection) (obj)).getResponseCode(); if (i != 400 && i != 401) { break MISSING_BLOCK_LABEL_312; } oauthclientrequest = ((HttpURLConnection) (obj)).getErrorStream(); _L6: obj = OAuthUtils.saveStreamAsString(oauthclientrequest); _L2: return OAuthClientResponseFactory.createCustomResponse(((String) (obj)), urlconnection.getContentType(), i, class1); _L4: ((HttpURLConnection) (obj)).setRequestMethod("GET"); goto _L5 oauthclientrequest = ((HttpURLConnection) (obj)).getInputStream(); goto _L6 } public void shutdown() { } }