Http redirection method
im making a program that connects to a certain web site, the pages in that website redirect me several times (each one is a sql validation, so i need to go through everyone of this pages).
The thing is i have read that, once u give a URL object a value, later you cant assign that same URL object another value. So i was thinking of making a method, something like this (took away all the try/catch for simplicity reading):
private InputStream conectar(String nuevaURL){
URL newURL = null;
URLConnection newConnection = null;
newURL = new URL(nuevaURL);
newConnection = newURL.openConnection();
return newConnection.getInputStream();
}This method would return an InputStream so in the caller i would use a BufferedReader to process the information from the URL, parse the new redirection URL and call again this method to receive the new content from the new URL.
The thing is i dont know if this is valid cause of the variables scope, so every time it gets in here it can assign a new url to the newURL variable. Also i dont know if i should close the BufferedReader every time i finish processing each of the contents URL and before calling this method to fetch the new content.
Any help is greatly appreciated :)
KodiaK
Well, if you want the new URL that the redirection provides, it's easiest to grab it from the connection as an HTTP header. (the header's name is "Location") I don't know if it's possible to grab headers via the input stream, and even if it were it would seem like a real pain.
But actually, HttpURLConnection provides setFollowRedirects and getFollowRedirects methods. You shouldn't have to handle this yourself at all.
If you were to write something to follow redirects by hand, I'd suggest using recursion. Something like this (using pseudo-code where I can't recall the exact API):
private InputStream conectar(String nuevaURL) {
URL newURL = new URL(nuevaURL);
HttpURLConnection huc = newURL.getConnection();
if (huc.getStatus() > 299 && huc.getStatus() < 400) {
String nextURL = huc.getHeader("Location");
return conectar(nextURL);
return huc.getInputStream();
}But like I said, just use the redirect-following functionality already in the API.
Similar Messages
-
I am getting the following error message shown below. Wondering if i could get some help on how to resolve this issue.
My understanding is that the only way to resolve this issue is to install an Exchange 2010 or 2013 server in your on-premises organization and configure that as a hybrid server. Once you configure your Autodiscover record to point to the Office 365
hostname as shown in "domains", this should no longer be an issue.
Ed Crowley MVP "There are seldom good technological solutions to behavioral problems." -
Server load balancing on Local Director implementing HTTP redirection
Hi, got an interesting problem when implementing the HTTP redirection method of session persistance or stickiness when balancing a couple of web servers on a Local Director 416. The session persistance works fine but it looks like one of the two servers is getting all the traffic rather than balancing accross the two. The servers are equally spec'd and when it comes to the predictor setting for the virtual, I'm just using the defaults i.e. leastconns/roundrobin. Is there a better predictor setting to use?? Any input would be appreciated.
Rgds
Adam LacobaThe loaded argument has worked well. Take note that this requires a value to be set with the weight command. It gives a specific amount of traffic to one, and then moves to the other.
-
Posting from one jsp to another gives HTTP 405 "method not allowed"
I have a servlet filter that authenticates all requests for resources in my web app. This works fine when HTTP GET requests are being used, but I notice I get a HTTP 405 "Method not allowed" when a HTTP POST is issued. Even a simple JSP page that posts to another JSP page fails with this error. If I remove the filter, everything works OK.
The filter doesn't do anything exceptional (that I can see), other than do a redirect to use SSL if the request isn't being called on that.
Thanks for any help.If you've got access to the filter code - check that it doesn't contain any conditional checking on HttpServletRequest.getMethod() or alike.
If the only thing you need to do is to ensure the use of SSL, why don't you declare a security-constraint in you web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Ensure encryption</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
- J�rgen L�kke - -
Hi,
How to configure the ACE to redirect a https request to different url.
For example
Clients requesting https://www.mycompany.com shall be redirected to https://www1.mycompany.com.
Please let me know.Thanks in AdvanceHi Gilles,
I am having the certificate and the key.
Please check the config and confirm whether this looks fine or not.
I am using GSS to resolve www.mycompany.com and www1.mycompany.com
probe http Server1
interval 15
passdetect interval 60
request method head url /keepAlive.html
expect status 200 202
open 10
parameter-map type ssl PARAMMAP_SSL_TERMINATION
cipher RSA_WITH_3DES_EDE_CBC_SHA
cipher RSA_WITH_AES_128_CBC_SHA priority 2
cipher RSA_WITH_AES_256_CBC_SHA priority 3
rserver redirect HTTPS-REDIRECT
conn-limit max 4000000 min 4000000
webhost-redirection https://www1.mycompany.com.au 301
inservice
serverfarm host SFARM_HTTPS
rserver Server1_http 80
inservice
serverfarm redirect https-redirect
rserver HTTPS-REDIRECT
inservice
ssl-proxy service SSL_PSERVICE
key MYKEY.PEM
cert ACE-SP2.CER
ssl advanced-options PARAMMAP_SSL_TERMINATION
class-map type http loadbalance match-any HTTPS1
2 match http header Host header-value "www[.]mycompany[.]com"
class-map type http loadbalance match-any HTTPS2
2 match http header Host header-value "www1[.]mycompany[.]com"
policy-map type loadbalance first-match HTTPS
class HTTPS1
serverfarm https-redirect
class HTTP2
serverfarm SFARM_HTTPS
class class-default
serverfarm SFARM_HTTPS
policy-map multi-match HTTPS-PM
class HTTPS-RED
loadbalance vip inservice
loadbalance policy HTTPS
loadbalance vip icmp-reply active
ssl-proxy server SSL_PSERVICE
Also let me know know if there is any another way to configure the redirection other than matching host header.
Thanks in Advance -
SharePoint public facing site does not open in sharepoint designer after giving http redirect in IIS
I have a public facing sharepoint site
We gave http redirect in IIS due to which I am unable to open the site in SharePoint Designer and gives error message site not found in webserver.
If i revert back the settings (remove the http redirect link) i m able to open the site in designer.Please let me know how can I resolve the issue in opening site in SharePoint designer after http redirect setting done in IISLooks like an AAM issue. What URL of the site you are trying to open with designer and what are your AAM settings?
Ronald Bruinsma - Independent SharePoint Consultant - iDocs.info - The Netherlands
Ronald I got the same issue here is my info:
sharepoint site: http://<servername>/sites/mycompany
<ServerIP>
Default
http://servername
<Servername>
Default
http://servername
http://contoso.mycompany.com
Extranet
http://contoso.mycompany.com
In IIS webapp 80. http redirect:
redirect requests to this destination is checked: http://contoso.mycompany.com/sites/mycompany
can you help me? thanks -
I am having a problem getting into the App Store on my iPhone since the recent update, I have a 4s and it appears the feature tab is not working. When I try to go into the feature tab in the App Store I get a message "too many HTTP redirects" ?... Does anyone now hoe to fix this issue, the other tabs are working okay and everything is working on my iPad ?
Look at iOS Troubleshooting Wi-Fi networks and connections http://support.apple.com/kb/TS1398
iPad: Issues connecting to Wi-Fi networks http://support.apple.com/kb/ts3304
iOS: Recommended settings for Wi-Fi routers and access points http://support.apple.com/kb/HT4199
Additional things to try.
Try this first. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
Change the channel on your wireless router (Auto is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
How to Quickly Fix iPad 3 Wi-Fi Reception Problems
http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
If none of the above suggestions work, look at this link.
iPad Wi-Fi Problems: Comprehensive List of Fixes
http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
Fix iPad Wifi Connection and Signal Issues http://www.youtube.com/watch?v=uwWtIG5jUxE
Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
Unable to Connect After iOS Update - saw this solution on another post.
https://discussions.apple.com/thread/4010130
Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
~~~~~~~~~~~~~~~
If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
Cheers, Tom -
How are you supposed to REPORT THE PROBLEM when it DOESN'T EVEN WORK!!
I clicked it as I got a receipt for something that HAS NOT EVEN BEEN BOUGHT ! (It's funny how apple try to charge me twice for something when I work nightshift and my phones switched off!)
and all that happened was it came up saying "too many HTTP redirects" .
And it won't let me report it ! XGo here:
http://www.apple.com/support/itunes/contact/
and follow the instructions to report your issue to the iTunes Store.
Regards. -
I purchased 2 packages of gems for skylanders and only received 1 package. Got email receipts and tried to report problem with link in email on my ipad2 and it keeps coming up with to many https redirects. Can anyone help? Just want my gems :).
Contact iTunes Customer Service and request assistance
Use this Link > Apple Support iTunes Store Contact -
How do I get rid of (to many HTTP redirects) from my App Store
Every time I go to categories or top 25 I cannot get in it keeps saying to many HTTP redirect how can I fix this
It did not start until I had my phone reset. And I try resetting my phone again and it won't even reset nowClearing the History and Cookies on Safari then closing safari from the background has helped me with this issue
Go to Settings then click on Safari. Once there, clear the cookies and data. Then go into safari app then clear the history. Once you do that, close safari from the background by double clicking the home button, hold the app then hit the red - to close. -
Every time I open the app store on my iPod touch, it says 'too many http redirects' whenever I click on the Categories and Top 25 tabs. I tried force quitting the app store, that didn't work. I tried closing all windows in Safari and force quitting safari, also didn't work. I reset the network settings, that didn't work either. When I reset all settings, it appeared to work. The tabs were different (it had a Genius tab), but it worked. However, immediately after force quitting the app store (I force quit a lot to keep as much RAM clear as possible), the same thing happened again. Does anyone know a permanent, Apple-supported solution to this problem? And please do not say restoring it. I don't want to start from scratch just to potentially experience the same problem.
See:
to many HTTP redirects: Apple Support Communities
However, it seems to be an Apple/network problem beyond your control -
I need to know how to force a https redirect in Adobe Muse if this can't be done please tell me so I don't waste any more time... please
Protocol usage and redirects are a server-side thing. This has nothing to do with designing the web page and thus nothing with Muse, either.
Mylenium -
How to call HTTP Post Method URL in SOA 10g
Hi,
I have a requirement where i need to call a HTTP Post Method, I have a URL, if i hit it in the browser, i am getting the response details. I know there is a HTTP Binding Adapter in 11g, but we are on 10g. Can anyone please let me know whether we can do it in 10g and how ?
Thanks Always
NYou will need to write the WSDL by yourself. Just make sure you have the end point detail, operation name(if required) and the schema available to write the WSDL.
-
How to call HTTP POST method in SOA 10g
Hi,
I have a requirement where i need to call a HTTP Post Method, I have a URL, if i hit it in the browser, i am getting the response details. I know there is a HTTP Binding Adapter in 11g, but we are on 10g. Can anyone please let me know whether we can do it in 10g and how. ?
Thanks Always
NLook at 10g samples under tutorials/702.bindings.
-
Setting HTTPS redirect in NetWeaver CE 7.1 EhP1
I would like to redirect all HTTP requests such that users will always use HTTPS access. I found an OSS note 973644 that explains the steps for non CE environments. Does anyone know how to setup HTTPS redirect on NetWeaver CE 7.1 Ehp1?
Regards,
AsifHi Lee,
I think I know how to solve this. I have just solved a similar problem with my PI 7.1 EHP1. Deployment in JSPM of various software components all failed like this example:
JSPM log:
Deploy status is 'Aborted'
Client path '
pi71\sapmnt\trans\EPS\in\SAPXIAF04_7-20002649.SCA'
Description:'1. ERROR CODE DPL.DS.5089 Exception during generating components of sap.com/com.sap.aii.af.app application in webservices_container container.
-> com.sap.engine.services.webservices.espbase.configuration.BindingData.getConfigurationType()I'.
Default Trace:
Caused by: java.lang.NoSuchMethodError: com.sap.engine.services.webservices.espbase.configuration.BindingData.getConfigurationType()I
at com.sap.engine.services.webservices.server.deploy.WSBaseAbstractDProcess.getBindingDataId
After that most of the browser based admin apps, such as NetWeaver Administrator ( /nwa ), would refuse to start.
But finally after several tests, searching on SDN+SMP and restore to backup version I found the solution in [SAP Note 1328776|http://service.sap.com/sap/support/notes/1328776] which describes a similar problem: Update to the newest version of ENGINEAPI 7.11. Today this is ENGINEAPI04P_4-20002603.SCA.
You may also want to make sure that you are running the newest version of the Configuration Wizard, so you should check/update LMTOOLS, LMCTC and LMCFG*, currently LMTOOLS04P_3-20002705.SCA, LMCTC04P_1-20002694.SCA and LMCFG04P_4-20002729.SCA.
I hope this proves to be useful.
regards
Mauri
Maybe you are looking for
-
On an older Mac I got this message while trying to burn a CD for the car: "The attempt to burn a disc failed. The burn failed because of a medium write error." What does this mean? And how do I work around it?
-
Check preinstall mode of patch
How to we check patch#aaaaaaaa applied in preinstall mode? Which table to view to check? thanks
-
Can I use ARD to 'push' System Prefs LANGUAGE &TEXT to network
Can I utiise ARD to 'push' System Prefs LANGUAGE &TEXT to all macs on our network? How would this be achieved? Currently whenever a user logs into a workstation for the first time, their Language & Text prefs change from English language and UK Regio
-
Ringtone creation sign in loop
Ok, I have tried everything I can think of to create a ringtone in iTunes. Everytime I click the bell and chose create ringtone iTunes asks me to sign-in. I sign-in and it asks again and again. My password and user name are correct. I downloaded the
-
How do you get the Data Access tab to show up with the Swing and AWT components? I am trying to create applets that access databases other then Oracle and am having difficulty getting it connected. I do create a connection, but can't access it? null