|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.weborganic.bastille.pageseeder.PSConnection
public final class PSConnection
Wraps an HTTP connection to PageSeeder.
Nested Class Summary | |
---|---|
static class |
PSConnection.Type
The type of connection. |
Method Summary | |
---|---|
void |
addXMLPart(String part)
Add a part to the request (write the contents directly to the stream). |
void |
addXMLPart(String part,
Map<String,String> headers)
Add a part to the request (write the contents directly to the stream). |
void |
closeOutput()
Closes the output stream when writing to the connection. |
HttpURLConnection |
connection()
Returns the underlying HTTP connection. |
void |
disconnect()
Deprecated. There is no need to call this method; the socket will be recycled. |
String |
getContentType()
Returns the content type of the underlying HTTP connection. |
int |
getResponseCode()
Returns the response code of the underlying HTTP connection. |
String |
getResponseMessage()
Returns the response message of the underlying HTTP connection. |
boolean |
process(XMLWriter xml)
Process the specified PageSeeder connection. |
boolean |
process(XMLWriter xml,
PSHandler handler)
Process the specified PageSeeder connection. |
boolean |
process(XMLWriter xml,
Templates templates)
Process the specified PageSeeder connection. |
boolean |
process(XMLWriter xml,
Templates templates,
Map<String,String> parameters)
Process the specified PageSeeder connection. |
PSResource |
resource()
Returns the PageSeeder resource corresponding to the URL. |
PSConnection.Type |
type()
Returns the type of connection. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void addXMLPart(String part) throws IOException
part
- The encoding to specify in the Part's header
IOException
- Should any error occur while writing the part on the outputpublic void addXMLPart(String part, Map<String,String> headers) throws IOException
part
- The encoding to specify in the Part's headerheaders
- A list of headers added to this XML Part ('content-type' header is ignored)
IOException
- Should any error occur while writingpublic void closeOutput() throws IOException
This method does nothing if the output stream hasn't been created.
IOException
- If thrown by the close method.public int getResponseCode() throws IOException
IOException
- If thrown by the underlying HTTP connection.HttpURLConnection.getResponseCode()
public String getResponseMessage() throws IOException
IOException
- If thrown by the underlying HTTP connection.HttpURLConnection.getResponseMessage()
public String getContentType() throws IOException
IOException
- If thrown by the underlying HTTP connection.URLConnection.getContentType()
@Deprecated public void disconnect()
HttpURLConnection.disconnect()
public HttpURLConnection connection()
This method can be useful to perform additional operations on the connection which are not provided by this class.
public PSResource resource()
public PSConnection.Type type()
public boolean process(XMLWriter xml) throws IOException
If the handler is not specified, the xml writer receives a copy of the PageSeeder XML.
xml
- the XML to copy from PageSeeder
true
if the request was processed without errors;
false
otherwise.
IOException
- If an error occurs when trying to write the XML.public boolean process(XMLWriter xml, PSHandler handler) throws IOException
If the handler is not specified, the xml writer receives a copy of the PageSeeder XML.
xml
- the XML to copy from PageSeederhandler
- the handler for the XML (can be used to rewrite the XML)
true
if the request was processed without errors;
false
otherwise.
IOException
- If an error occurs when trying to write the XML.public boolean process(XMLWriter xml, Templates templates) throws IOException
Templates can be specified to transform the XML.
xml
- The XML to copy from PageSeedertemplates
- A set of templates to process the XML (optional)
true
if the request was processed without errors;
false
otherwise.
IOException
- If an error occurs when trying to write the XML.public boolean process(XMLWriter xml, Templates templates, Map<String,String> parameters) throws IOException
Templates can be specified to transform the XML.
xml
- The XML to copy from PageSeedertemplates
- A set of templates to process the XML (optional)parameters
- Parameters to send to the XSLT transformer (optional)
true
if the request was processed without errors;
false
otherwise.
IOException
- If an error occurs when trying to write the XML.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |