01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.transport.mail;
20:
21: import org.apache.axis2.addressing.EndpointReference;
22:
23: /*
24: *
25: */
26:
27: public class MailToInfo {
28: private String emailAddress;
29: private String contentDescription;
30: private boolean xServicePath;
31:
32: public MailToInfo(String eprAddress) {
33: //URl validation according to rfc : http://www.ietf.org/rfc/rfc2368.txt
34:
35: int mailToIndex = eprAddress.indexOf(Constants.MAILTO + ":");
36: if (mailToIndex > -1) {
37: eprAddress = eprAddress.substring(mailToIndex + 7);
38: }
39: int index = eprAddress.indexOf('?');
40:
41: if (index > -1) {
42: emailAddress = eprAddress.substring(0, index);
43: } else {
44: emailAddress = eprAddress;
45: }
46:
47: if (eprAddress.indexOf(Constants.X_SERVICE_PATH) > -1) {
48: index = eprAddress.indexOf('=');
49: if (index > -1) {
50: xServicePath = true;
51: contentDescription = eprAddress.substring(index + 1);
52: }
53: } else {
54: contentDescription = eprAddress.substring(index + 1);
55:
56: }
57: }
58:
59: public MailToInfo(EndpointReference epr) {
60: this (epr.getAddress());
61: }
62:
63: public String getEmailAddress() {
64: return emailAddress;
65: }
66:
67: public void setEmailAddress(String emailAddress) {
68: this .emailAddress = emailAddress;
69: }
70:
71: public String getContentDescription() {
72: return contentDescription;
73: }
74:
75: public void setContentDescription(String contentDescription) {
76: this .contentDescription = contentDescription;
77: }
78:
79: public boolean isxServicePath() {
80: return xServicePath;
81: }
82:
83: public void setxServicePath(boolean xServicePath) {
84: this.xServicePath = xServicePath;
85: }
86:
87: }
|