Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String getProcPropertiesString(HttpServletRequest request,
- String procName) throws SIEIProxyServletException {
- String propertiesSource = request.getHeader("X-Processor-Props");
- if (propertiesSource == null) {
- log.debug("Processor properties are not specified");
- return "";
- }
- String[] procsProps = propertiesSource.split("^");
- if (procsProps == null)
- return "";
- // TODO: Make it with regex:
- // \[Processor=([A-Za-z0-9_]+)\|(""([^""]+)"":""([^""]+)""\,?)+\]
- Pattern pattern = Pattern.compile(
- "\\[Processor=([A-Za-z0-9_]+)\\|(.)+\\]",
- Pattern.CASE_INSENSITIVE);
- for (String propLine : procsProps) {
- Matcher matcher = pattern.matcher(propLine);
- String processorName = null;
- String processorProps = null;
- boolean foundMatch = matcher.find();
- if (foundMatch && matcher.groupCount() == 2) {
- processorName = matcher.group(1);
- }
- if (processorName != null && procName.equals(processorName)) {
- CharSequence start = "[Processor=" + processorName + "|";
- CharSequence whitespace = "";
- processorProps = propLine.replace(start, whitespace);
- return processorProps.substring(0, processorProps.length() - 1);
- }
- }
- return "";
- }
Add Comment
Please, Sign In to add comment