Subversion Repositories XServices

Rev

Rev 86 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 86 Rev 87
Line 13... Line 13...
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
package net.brutex.xservices.ws.impl;
16
package net.brutex.xservices.ws.impl;
Line 17... Line -...
17
 
-
 
18
 
-
 
19
 
17
 
20
import java.util.regex.Matcher;
18
import java.util.regex.Matcher;
Line 21... Line 19...
21
import java.util.regex.Pattern;
19
import java.util.regex.Pattern;
Line 33... Line 31...
33
 * 
31
 * 
34
 */
32
 */
35
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.StringService", serviceName = StringService.SERVICE_NAME)
33
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.StringService", serviceName = StringService.SERVICE_NAME)
36
public class StringServiceImpl implements StringService {
34
public class StringServiceImpl implements StringService {
Line 37... Line 35...
37
 
35
 
38
	public StringReplaceType replaceRegEx(String res, String search, String replace,
36
	public StringReplaceType replaceRegEx(String res, String search,
39
			String flags) throws XServicesFault {
37
			String replace, String flags) throws XServicesFault {
40
		
38
		try {
41
		int allflags = 0;
39
			int allflags = 0;
42
		if(flags.contains("i")) {
40
			if (flags.contains("i")) {
43
			allflags = allflags + Pattern.CASE_INSENSITIVE;
41
				allflags = allflags + Pattern.CASE_INSENSITIVE;
44
		}
42
			}
Line 49... Line 47...
49
			count++;
47
				count++;
50
		}
48
			}
51
		if(flags.contains("g")) {
49
			if (flags.contains("g")) {
52
			return new StringReplaceType(matcher.replaceAll(replace), count);	
50
				return new StringReplaceType(matcher.replaceAll(replace), count);
53
		} else {
51
			} else {
-
 
52
				if (count > 1)
54
			if(count>1) count = 1;
53
					count = 1;
55
			return new StringReplaceType(matcher.replaceFirst(replace), count);
54
				return new StringReplaceType(matcher.replaceFirst(replace),
-
 
55
						count);
56
		}
56
			}
57
		
-
 
-
 
57
		} catch (Exception e) {
-
 
58
			throw new XServicesFault(e);
58
	}
59
		}
Line -... Line 60...
-
 
60
 
Line 59... Line 61...
59
 
61
	}