|
Carrot2 v3.6.0-SNAPSHOT
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.util.resource.URLResourceWithParams
public class URLResourceWithParams
A IResource implementation that allows URLs to be parameterized. The attribute
place holders are of format: ${attribute} and will be replaced before the
contents is fetched from the URL when the open(Map) method is used.
| Constructor Summary | |
|---|---|
URLResourceWithParams(URL url)
Creates an instance with the provided url; |
|
| Method Summary | |
|---|---|
static boolean |
containsAttributePlaceholder(String urlTemplate,
String attributePlaceholderName)
Returns true if the urlTemplate contains the
attributePlaceholderName. |
boolean |
equals(Object obj)
|
static String |
formatAttributePlaceholder(String attributePlaceholderName)
Returns attribute place holder based on the attribute name. |
URL |
getUrl()
|
int |
hashCode()
|
InputStream |
open()
Opens the underlying URL without attribute substitution. |
InputStream |
open(Map<String,Object> attributes)
Opens the underlying URL substituting attribute place holders beforehand. |
static String |
substituteAttributes(String parameterizedURL,
Map<String,Object> attributes)
Performs attribute substitution. |
String |
toString()
|
static URLResourceWithParams |
valueOf(String string)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public URLResourceWithParams(URL url)
url;
| Method Detail |
|---|
public InputStream open()
throws IOException
open in interface IResourceIOException
public InputStream open(Map<String,Object> attributes)
throws IOException
attributes - values of attributes to be replaced in the corresponding place
holders. If a place holder is of form: ${attributeX}, it
will be replaced by the value found (if any) in the attributes map under
the attributeX key.
IOException
public static String substituteAttributes(String parameterizedURL,
Map<String,Object> attributes)
public static boolean containsAttributePlaceholder(String urlTemplate,
String attributePlaceholderName)
true if the urlTemplate contains the
attributePlaceholderName.
public static String formatAttributePlaceholder(String attributePlaceholderName)
public String toString()
toString in class Objectpublic final boolean equals(Object obj)
equals in class Objectpublic final int hashCode()
hashCode in class Objectpublic URL getUrl()
public static URLResourceWithParams valueOf(String string)
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||