Index: src/main/java/org/glassfish/config/support/DefaultConfigUpgrade.java =================================================================== --- src/main/java/org/glassfish/config/support/DefaultConfigUpgrade.java (revision 51493) +++ src/main/java/org/glassfish/config/support/DefaultConfigUpgrade.java (working copy) @@ -1667,10 +1667,22 @@ p.setName(val); } } - createHttp(p); - createSsl(p); - createHttpRedirect(p); - createPortUnification(p); + while (true) { + if (parser.next() == START_ELEMENT) { + if (parser.getLocalName().equals("http") && p != null) { + createHttp(p); + createSsl(p); + break; + } else if (parser.getLocalName().equals("http-redirect") && p != null) { + createHttpRedirect(p); + break; + } else if (parser.getLocalName().equals("port-unification") && p != null) { + createPortUnification(p); + break; + } + } + } + } } } catch (TransactionFailure ex) { @@ -1685,33 +1697,28 @@ /* (1 example with most attributes)*/ private void createHttp(Protocol p) throws PropertyVetoException { - while (true) { - try { - if (parser.next() == START_ELEMENT) { - if (parser.getLocalName().equals("http") && p != null) { - Http h = p.createChild(Http.class); - p.setHttp(h); - for (int i = 0; i < parser.getAttributeCount(); i++) { - String attr = parser.getAttributeLocalName(i); - String val = parser.getAttributeValue(i); - if (attr.equals("default-virtual-server")) { - h.setDefaultVirtualServer(val); - } - if (attr.equals("max-connections")) { - h.setMaxConnections(val); - } - } - createFileCache(h); - break; + try { + if (parser.getLocalName().equals("http") && p != null) { + Http h = p.createChild(Http.class); + p.setHttp(h); + for (int i = 0; i < parser.getAttributeCount(); i++) { + String attr = parser.getAttributeLocalName(i); + String val = parser.getAttributeValue(i); + if (attr.equals("default-virtual-server")) { + h.setDefaultVirtualServer(val); } + if (attr.equals("encoded-slash-enabled")) { + h.setEncodedSlashEnabled(val); + } + if (attr.equals("max-connections")) { + h.setMaxConnections(val); + } } - } catch (TransactionFailure ex) { - Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( - Level.SEVERE, "Failure creating Http config object", ex); - } catch (XMLStreamException ex) { - Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( - Level.SEVERE, "Problem parsing http element in domain.xml template", ex); + createFileCache(h); } + } catch (TransactionFailure ex) { + Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( + Level.SEVERE, "Failure creating Http config object", ex); } } @@ -1763,6 +1770,9 @@ if (attr.equals("cert-nickname")) { ssl.setCertNickname(val); } + if (attr.equals("client-auth")) { + ssl.setClientAuth(val); + } } break; } @@ -1779,29 +1789,19 @@ /* */ private void createHttpRedirect(Protocol p) throws PropertyVetoException { - while (!(parser.getEventType() == END_ELEMENT && parser.getLocalName().equals("protocol"))) { - try { - if (parser.next() == START_ELEMENT) { - if (parser.getLocalName().equals("http-direct") && p != null) { - HttpRedirect hr = p.createChild(HttpRedirect.class); - p.setHttpRedirect(hr); - for (int i = 0; i < parser.getAttributeCount(); i++) { - String attr = parser.getAttributeLocalName(i); - String val = parser.getAttributeValue(i); - if (attr.equals("secure")) { - hr.setSecure(val); - } - } - break; - } + try { + HttpRedirect hr = p.createChild(HttpRedirect.class); + p.setHttpRedirect(hr); + for (int i = 0; i < parser.getAttributeCount(); i++) { + String attr = parser.getAttributeLocalName(i); + String val = parser.getAttributeValue(i); + if (attr.equals("secure")) { + hr.setSecure(val); } - } catch (TransactionFailure ex) { - Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( - Level.SEVERE, "Failure creating HttpRedirect config object", ex); - } catch (XMLStreamException ex) { - Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( - Level.SEVERE, "Problem parsing http-redirect element in domain.xml template", ex); } + } catch (TransactionFailure ex) { + Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( + Level.SEVERE, "Failure creating HttpRedirect config object", ex); } } @@ -1810,36 +1810,25 @@ * * */ private void createPortUnification(Protocol p) throws PropertyVetoException { - while (true) { - try { - if (parser.next() == START_ELEMENT) { - if (parser.getLocalName().equals("port-unification") && p != null) { - PortUnification pu = p.createChild(PortUnification.class); - p.setPortUnification(pu); - - createProtocolFinder(pu); - break; - } - } - } catch (TransactionFailure ex) { - Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( - Level.SEVERE, "Failure creating PortUnification config object", ex); - } catch (XMLStreamException ex) { - Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( - Level.SEVERE, "Problem parsing port-unification element in domain.xml template", ex); - } + try { + PortUnification pu = p.createChild(PortUnification.class); + p.setPortUnification(pu); + + createProtocolFinder(pu); + } catch (TransactionFailure ex) { + Logger.getLogger(DefaultConfigUpgrade.class.getName()).log( + Level.SEVERE, "Failure creating PortUnification config object", ex); } } private void createProtocolFinder(PortUnification pu) throws PropertyVetoException { - while (true) { + while (!(parser.getEventType() == END_ELEMENT && parser.getLocalName().equals("port-unification"))) { try { if (parser.next() == START_ELEMENT) { if (parser.getLocalName().equals("protocol-finder") && pu != null) { ProtocolFinder pf = pu.createChild(ProtocolFinder.class); - List pfList = new ArrayList(); + List pfList = pu.getProtocolFinder(); pfList.add(pf); - pu.setProtocolFinder(pfList); for (int i = 0; i < parser.getAttributeCount(); i++) { String attr = parser.getAttributeLocalName(i); String val = parser.getAttributeValue(i); @@ -1853,7 +1842,6 @@ pf.setClassname(val); } } - break; } } } catch (TransactionFailure ex) {