org.apache.droids.protocol.http
Class Http
java.lang.Object
org.apache.droids.helper.Loggable
org.apache.droids.protocol.HttpBase
org.apache.droids.protocol.http.Http
- All Implemented Interfaces:
- Protocol
public class Http
- extends HttpBase
- implements Protocol
Simple implementation for http protocol. Using standard
HttpURLConnection
to make the connection. If you need more control
you should look into the http-client implementation of the protocol.
Fields inherited from class org.apache.droids.helper.Loggable |
log |
Constructor Summary |
Http()
|
Method Summary |
boolean |
isAllowed(String location)
Some protocols (like http) offer a mechanism to evaluate whether the client
can request a given url (in http this is the robots.txt configuration) |
boolean |
isForceAllow()
You can force that a site is allowed (ignoring the robots.txt). |
InputStream |
openStream(String url)
Return the stream represent of the url |
void |
setForceAllow(boolean forceAllow)
You can force that a site is allowed (ignoring the robot.txt). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Http
public Http()
openStream
public InputStream openStream(String url)
throws IOException
- Description copied from interface:
Protocol
- Return the stream represent of the url
- Specified by:
openStream
in interface Protocol
- Parameters:
url
- url of the stream we want to open
- Returns:
- the stream of the given url
- Throws:
IOException
isAllowed
public boolean isAllowed(String location)
throws MalformedURLException
- Description copied from interface:
Protocol
- Some protocols (like http) offer a mechanism to evaluate whether the client
can request a given url (in http this is the robots.txt configuration)
- Specified by:
isAllowed
in interface Protocol
- Parameters:
location
- the url to evaluate
- Returns:
- true if we can request the url. false if we are forbidden.
- Throws:
MalformedURLException
isForceAllow
public boolean isForceAllow()
- You can force that a site is allowed (ignoring the robots.txt). This should
only be used on server that you control and where you have the permission
to ignore the robots.txt.
- Returns:
true
if you are rude and ignore robots.txt.
false
if you are playing nice.
setForceAllow
public void setForceAllow(boolean forceAllow)
- You can force that a site is allowed (ignoring the robot.txt). This should
only be used on server that you control and where you have the permission
to ignore the robots.txt.
- Parameters:
forceAllow
- if you want to force an allow and ignore the robot.txt set
to true
. If you want to obey the rules and
be polite set to false
.
Copyright © 2008 The Apache Software Foundation