|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
davmail.AbstractConnection
davmail.caldav.CaldavConnection
public class CaldavConnection
Handle a caldav connection.
| Nested Class Summary | |
|---|---|
protected static class |
CaldavConnection.CaldavRequest
|
protected class |
CaldavConnection.CaldavResponse
Caldav response wrapper, content sent in chunked mode to avoid timeout |
protected class |
CaldavConnection.ChunkedResponse
Http chunked response. |
| Nested classes/interfaces inherited from class davmail.AbstractConnection |
|---|
AbstractConnection.LineReaderInputStream, AbstractConnection.State |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected boolean |
closed
|
static BitSet |
ical_allowed_abs_path
custom url encode path set for iCal 5 |
protected static int |
MAX_KEEP_ALIVE_TIME
Maximum keep alive time in seconds |
protected org.apache.log4j.Logger |
wireLogger
|
| Fields inherited from class davmail.AbstractConnection |
|---|
client, in, os, password, session, state, userName |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
CaldavConnection(Socket clientSocket)
Initialize the streams and start the thread. |
|
| Method Summary | |
|---|---|
protected void |
appendEventsResponses(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
List<ExchangeSession.Event> events)
|
void |
appendFolderOrItem(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
ExchangeSession.Folder folder,
String subFolder)
Append folder object to Caldav response. |
void |
appendInbox(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
String subFolder)
Append calendar inbox object to Caldav response. |
protected void |
appendItemResponse(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
ExchangeSession.Item item)
|
void |
appendOutbox(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
String subFolder)
Append calendar outbox object to Caldav response. |
protected HashMap<String,String> |
buildEtagHeader(String etag)
|
protected void |
decodeCredentials(String authorization)
Decode HTTP credentials |
protected String |
getContent(String contentLength)
|
protected String |
getEventFileNameFromPath(String path)
|
protected void |
handleFolderOrItem(CaldavConnection.CaldavRequest request)
|
protected void |
handlePrincipals(CaldavConnection.CaldavRequest request)
|
void |
handleRequest(String command,
String path,
Map<String,String> headers,
String body)
Handle caldav request. |
protected Map<String,String> |
parseHeaders()
|
void |
patchCalendar(CaldavConnection.CaldavRequest request)
Fake PROPPATCH response for request. |
void |
reportItems(CaldavConnection.CaldavRequest request)
Report items listed in request. |
void |
run()
|
void |
sendChunkedHttpResponse(int status,
String contentType)
Send Http response with given status in chunked mode. |
void |
sendDirectory(CaldavConnection.CaldavRequest request)
Send caldav response for /directory/ request. |
void |
sendErr(Exception e)
Send Http error response for exception |
void |
sendErr(int status,
String message)
Send Http error status and message. |
void |
sendFolderOrItem(CaldavConnection.CaldavRequest request)
Send calendar response for request. |
void |
sendFreeBusy(String body)
Send free busy response for body request. |
void |
sendGetRoot()
Send simple html response to GET /. |
void |
sendHttpResponse(int status)
Send Http response with given status. |
void |
sendHttpResponse(int status,
Map<String,String> headers)
Send Http response with given status and headers. |
void |
sendHttpResponse(int status,
Map<String,String> headers,
String contentType,
byte[] content,
boolean keepAlive)
Send Http response with given status, headers, content type and content. |
void |
sendHttpResponse(int status,
Map<String,String> headers,
String contentType,
String content,
boolean keepAlive)
Send Http response with given status, headers, content type and content. |
void |
sendInbox(CaldavConnection.CaldavRequest request)
Send inbox response for request. |
void |
sendOptions()
Send OPTIONS response. |
void |
sendOutbox(CaldavConnection.CaldavRequest request)
Send outbox response for request. |
void |
sendPrincipal(CaldavConnection.CaldavRequest request,
String prefix,
String principal)
Send Caldav principal response. |
void |
sendPrincipalsFolder(CaldavConnection.CaldavRequest request)
Send principals folder. |
void |
sendRoot(CaldavConnection.CaldavRequest request)
Send caldav response for / request. |
void |
sendUnauthorized()
Send 401 Unauthorized response. |
void |
sendUnsupported(CaldavConnection.CaldavRequest request)
Send 400 bad response for unsupported request. |
void |
sendUserRoot(CaldavConnection.CaldavRequest request)
Send user response for request. |
void |
sendWellKnown()
Send caldav response for /.well-known/ request. |
protected void |
setSocketTimeout(String keepAliveValue)
|
| Methods inherited from class davmail.AbstractConnection |
|---|
base64Decode, base64Encode, close, readClient, sendClient, sendClient, sendClient, sendClient |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int MAX_KEEP_ALIVE_TIME
protected final org.apache.log4j.Logger wireLogger
protected boolean closed
public static final BitSet ical_allowed_abs_path
| Constructor Detail |
|---|
public CaldavConnection(Socket clientSocket)
clientSocket - Caldav client socket| Method Detail |
|---|
protected Map<String,String> parseHeaders()
throws IOException
IOException
protected String getContent(String contentLength)
throws IOException
IOException
protected void setSocketTimeout(String keepAliveValue)
throws IOException
IOExceptionpublic void run()
run in interface Runnablerun in class Thread
public void handleRequest(String command,
String path,
Map<String,String> headers,
String body)
throws IOException
command - Http commandpath - request pathheaders - Http headers mapbody - request body
IOException - on error
protected void handlePrincipals(CaldavConnection.CaldavRequest request)
throws IOException
IOException
protected void handleFolderOrItem(CaldavConnection.CaldavRequest request)
throws IOException
IOExceptionprotected HashMap<String,String> buildEtagHeader(String etag)
protected void appendEventsResponses(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
List<ExchangeSession.Event> events)
throws IOException
IOException
protected void appendItemResponse(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
ExchangeSession.Item item)
throws IOException
IOException
public void appendFolderOrItem(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
ExchangeSession.Folder folder,
String subFolder)
throws IOException
response - Caldav responserequest - Caldav requestfolder - folder objectsubFolder - calendar folder path relative to request path
IOException - on error
public void appendInbox(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
String subFolder)
throws IOException
response - Caldav responserequest - Caldav requestsubFolder - inbox folder path relative to request path
IOException - on error
public void appendOutbox(CaldavConnection.CaldavResponse response,
CaldavConnection.CaldavRequest request,
String subFolder)
throws IOException
response - Caldav responserequest - Caldav requestsubFolder - outbox folder path relative to request path
IOException - on error
public void sendGetRoot()
throws IOException
IOException - on error
public void sendInbox(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendOutbox(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendFolderOrItem(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void patchCalendar(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on errorprotected String getEventFileNameFromPath(String path)
public void reportItems(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendPrincipalsFolder(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendUserRoot(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendRoot(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendDirectory(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendWellKnown()
throws IOException
IOException - on error
public void sendPrincipal(CaldavConnection.CaldavRequest request,
String prefix,
String principal)
throws IOException
request - Caldav requestprefix - principal prefix (users or public)principal - principal name (email address for users)
IOException - on error
public void sendFreeBusy(String body)
throws IOException
body - request body
IOException - on error
public void sendErr(Exception e)
throws IOException
e - exception
IOException - on error
public void sendUnsupported(CaldavConnection.CaldavRequest request)
throws IOException
request - Caldav request
IOException - on error
public void sendErr(int status,
String message)
throws IOException
status - Http statusmessage - error messagee
IOException - on error
public void sendOptions()
throws IOException
IOException - on error
public void sendUnauthorized()
throws IOException
IOException - on error
public void sendHttpResponse(int status)
throws IOException
status - Http status
IOException - on error
public void sendHttpResponse(int status,
Map<String,String> headers)
throws IOException
status - Http statusheaders - Http headers
IOException - on error
public void sendChunkedHttpResponse(int status,
String contentType)
throws IOException
status - Http statuscontentType - MIME content type
IOException - on error
public void sendHttpResponse(int status,
Map<String,String> headers,
String contentType,
String content,
boolean keepAlive)
throws IOException
status - Http statusheaders - Http headerscontentType - MIME content typecontent - response body as stringkeepAlive - keep connection open
IOException - on error
public void sendHttpResponse(int status,
Map<String,String> headers,
String contentType,
byte[] content,
boolean keepAlive)
throws IOException
status - Http statusheaders - Http headerscontentType - MIME content typecontent - response body as byte arraykeepAlive - keep connection open
IOException - on error
protected void decodeCredentials(String authorization)
throws IOException
authorization - http authorization header value
IOException - if invalid credentials
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||