Java Code Examples for org.apache.cxf.common.util.StringUtils#isEmpty()

The following examples show how to use org.apache.cxf.common.util.StringUtils#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTokenService.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Client getClientFromTLSCertificates(SecurityContext sc,
                                              TLSSessionInfo tlsSessionInfo,
                                              MultivaluedMap<String, String> params) {
    Client client = null;
    if (OAuthUtils.isMutualTls(sc, tlsSessionInfo)) {
        X509Certificate cert = OAuthUtils.getRootTLSCertificate(tlsSessionInfo);
        String subjectDn = OAuthUtils.getSubjectDnFromTLSCertificates(cert);
        if (!StringUtils.isEmpty(subjectDn)) {
            client = getClient(subjectDn, params);
            validateClientAuthenticationMethod(client, OAuthConstants.TOKEN_ENDPOINT_AUTH_TLS);
            // The certificates must be registered with the client and match TLS certificates
            // in case of the binding where Client's clientId is a subject distinguished name
            compareTlsCertificates(tlsSessionInfo, client.getApplicationCertificates());
            OAuthUtils.setCertificateThumbprintConfirmation(getMessageContext(), cert);
        }
    }
    return client;
}
 
Example 2
Source File: ServiceImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
public <T> T getPort(EndpointReferenceType endpointReference, Class<T> type,
                     WebServiceFeature... features) {
    endpointReference = EndpointReferenceUtils.resolve(endpointReference, bus);
    QName serviceQName = EndpointReferenceUtils.getServiceName(endpointReference, bus);
    String portName = EndpointReferenceUtils.getPortName(endpointReference);

    QName portQName = null;
    if (portName != null && serviceQName != null) {
        String ns = serviceQName.getNamespaceURI();
        if (StringUtils.isEmpty(ns)) {
            //hack to workaround a xalan bug
            for (QName qn : portInfos.keySet()) {
                if (portName.equals(qn.getLocalPart())) {
                    ns = qn.getNamespaceURI();
                }
            }
        }
        if (StringUtils.isEmpty(ns) && serviceName != null) {
            ns = serviceName.getNamespaceURI();
        }
        portQName = new QName(ns, portName);
    }

    return createPort(portQName, endpointReference, type, features);
}
 
Example 3
Source File: OSGIBusListener.java    From cxf with Apache License 2.0 6 votes vote down vote up
private boolean isExcluded(ServiceReference<?> ref) {
    String o = (String)ref.getProperty(SERVICE_PROPERTY_RESTRICTED);
    if (!StringUtils.isEmpty(o)) {
        // if the service's restricted-regex is set, the service is excluded when the app not matching that regex
        BundleContext app = bus.getExtension(BundleContext.class);
        try {
            if (app != null && !app.getBundle().getSymbolicName().matches(o)) {
                return true;
            }
        } catch (IllegalArgumentException e) {
            // ignore
        }
    }
    // if the excludes-regex is set, the service is excluded when matching that regex.
    return extensionBundlesExcludesPattern != null
        && extensionBundlesExcludesPattern.matcher(ref.getBundle().getSymbolicName()).matches();
}
 
Example 4
Source File: DefaultHTTPResponseValidator.java    From cloud-sfsf-benefits-ext with Apache License 2.0 5 votes vote down vote up
private void validateContentType(SimpleHttpResponse httpResponse) throws InvalidResponseException {
    if (StringUtils.isEmpty(httpResponse.getContentType())) {
        throw new InvalidResponseException(String.format("Response content type not found when requesting path [%s]", httpResponse.getRequestPath()));
    }
    if (!httpResponse.getContentType().contains(MediaType.APPLICATION_JSON) && !httpResponse.getContentType().contains(MediaType.APPLICATION_XML)) {
        throw new InvalidResponseException(String.format("Invalid response content type [%s] when requesting path [%s]",
                httpResponse.getContentType(), httpResponse.getRequestPath()));
    }
}
 
Example 5
Source File: ServerFactoryBeanDefinitionParser.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public String getId(Element elem, ParserContext context) {
    String id = super.getId(elem, context);
    if (StringUtils.isEmpty(id)) {
        id = cls.getName() + "--" + context.getDefaultActivation();
    }
    return id;
}
 
Example 6
Source File: WadlGenerator.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addProvidedDocs(StringBuilder sb, String text) {
    if (!StringUtils.isEmpty(text)) {
        sb.append("<doc>");
        sb.append(xmlEncodeIfNeeded(text));
        sb.append("</doc>");
    }
}
 
Example 7
Source File: JDKBugHacks.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static boolean skipHack(final String key, String def) {
    String cname = null;
    try {
        cname = AccessController.doPrivileged(new PrivilegedAction<String>() {
            public String run() {
                return System.getProperty(key);
            }
        });
        if (StringUtils.isEmpty(cname)) {
            InputStream ins = Thread.currentThread().getContextClassLoader()
                .getResourceAsStream("META-INF/cxf/" + key);
            if (ins == null) {
                ins = ClassLoader.getSystemResourceAsStream("META-INF/cxf/" + key);
            }
            if (ins != null) {
                try (BufferedReader din = new BufferedReader(new InputStreamReader(ins))) {
                    cname = din.readLine();
                    if (cname != null) {
                        cname = cname.trim();
                    }
                }
            }
        }
    } catch (Throwable t) {
        //ignore
    }
    if (StringUtils.isEmpty(cname)) {
        cname = def;
    }
    return Boolean.parseBoolean(cname);
}
 
Example 8
Source File: JaxWsImplementorInfo.java    From cxf with Apache License 2.0 5 votes vote down vote up
public String getWsdlLocation() {
    for (WebService service : wsAnnotations) {
        if (!StringUtils.isEmpty(service.wsdlLocation())) {
            return service.wsdlLocation();
        }
    }

    if (null != wsProviderAnnotation
        && !StringUtils.isEmpty(wsProviderAnnotation.wsdlLocation())) {
        return wsProviderAnnotation.wsdlLocation();
    }
    return null;
}
 
Example 9
Source File: BusDefinitionParser.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void setBus(Bus bb) {
    if (bus == bb) {
        return;
    }
    if (properties != null) {
        bb.setProperties(properties);
        properties = null;
    }
    if (!getInInterceptors().isEmpty()) {
        bb.getInInterceptors().addAll(getInInterceptors());
    }
    if (!getOutInterceptors().isEmpty()) {
        bb.getOutInterceptors().addAll(getOutInterceptors());
    }
    if (!getInFaultInterceptors().isEmpty()) {
        bb.getInFaultInterceptors().addAll(getInFaultInterceptors());
    }
    if (!getOutFaultInterceptors().isEmpty()) {
        bb.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
    }
    if (!StringUtils.isEmpty(id)) {
        bb.setId(id);
    }
    if (features != null) {
        bb.setFeatures(features);
        features = null;
    }
    bus = bb;
}
 
Example 10
Source File: SP12Constants.java    From steady with Apache License 2.0 5 votes vote down vote up
public IncludeTokenType getInclusionFromAttributeValue(String value) {
    
    if (INCLUDE_ALWAYS.equals(value)) {
        return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
    } else if (INCLUDE_ALWAYS_TO_RECIPIENT.equals(value)) {
        return IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT;
    } else if (INCLUDE_ALWAYS_TO_INITIATOR.equals(value)) { 
        return IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_INITIATOR;
    } else if (INCLUDE_NEVER.equals(value)) {
        return IncludeTokenType.INCLUDE_TOKEN_NEVER;
    } else if (INCLUDE_ONCE.equals(value)) {
        return IncludeTokenType.INCLUDE_TOKEN_ONCE;
    }   
    return StringUtils.isEmpty(value) ? IncludeTokenType.INCLUDE_TOKEN_ALWAYS : null;
}
 
Example 11
Source File: Soap12FaultSoapPayloadConverter.java    From syndesis with Apache License 2.0 5 votes vote down vote up
private static String getLangCode() {
    String code = Locale.getDefault().getLanguage();
    if (StringUtils.isEmpty(code)) {
        return "en";
    }
    return code;
}
 
Example 12
Source File: SAAJUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static void setFaultCode(SOAPFault f, QName code) throws SOAPException {
    if (f.getNamespaceURI().equals(Soap12.SOAP_NAMESPACE)) {
        try {
            f.setFaultCode(code);
        } catch (SOAPException ex) {
            f.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            f.appendFaultSubcode(code);
        }
    } else {
        try {
            f.setFaultCode(code);
        } catch (Throwable t) {
            int count = 1;
            String pfx = "fc1";
            while (!StringUtils.isEmpty(f.getNamespaceURI(pfx))) {
                count++;
                pfx = "fc" + count;
            }
            if (code.getNamespaceURI() != null && !"".equals(code.getNamespaceURI())) {
                f.addNamespaceDeclaration(pfx, code.getNamespaceURI());
            } else {
                f.addNamespaceDeclaration(pfx, f.getNamespaceURI());
            }
            f.setFaultCode(pfx + ":" + code.getLocalPart());
        }
    }
}
 
Example 13
Source File: AnnotationHandlerChainBuilder.java    From cxf with Apache License 2.0 4 votes vote down vote up
private HandlerChainAnnotation findHandlerChainAnnotation(Class<?> clz, boolean searchSEI) {
    if (clz == null) {
        return null;
    }
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Checking for HandlerChain annotation on " + clz.getName());
    }
    HandlerChainAnnotation hcAnn = null;
    HandlerChain ann = clz.getAnnotation(HandlerChain.class);
    if (ann == null) {
        if (searchSEI) {
            /* HandlerChain annotation can be specified on the SEI
             * but the implementation bean might not implement the SEI.
             */
            WebService ws = clz.getAnnotation(WebService.class);
            if (ws != null && !StringUtils.isEmpty(ws.endpointInterface())) {
                String seiClassName = ws.endpointInterface().trim();
                Class<?> seiClass = null;
                try {
                    seiClass = ClassLoaderUtils.loadClass(seiClassName, clz);
                } catch (ClassNotFoundException e) {
                    throw new WebServiceException(BUNDLE.getString("SEI_LOAD_FAILURE_EXC"), e);
                }

                // check SEI class and its interfaces for HandlerChain annotation
                hcAnn = findHandlerChainAnnotation(seiClass, false);
            }
        }
        if (hcAnn == null) {
            // check interfaces for HandlerChain annotation
            for (Class<?> iface : clz.getInterfaces()) {
                if (LOG.isLoggable(Level.FINE)) {
                    LOG.fine("Checking for HandlerChain annotation on " + iface.getName());
                }
                ann = iface.getAnnotation(HandlerChain.class);
                if (ann != null) {
                    hcAnn = new HandlerChainAnnotation(ann, iface);
                    break;
                }
            }
            if (hcAnn == null) {
                hcAnn = findHandlerChainAnnotation(clz.getSuperclass(), false);
            }
        }
    } else {
        hcAnn = new HandlerChainAnnotation(ann, clz);
    }

    return hcAnn;
}
 
Example 14
Source File: JaxWsImplementorInfo.java    From cxf with Apache License 2.0 4 votes vote down vote up
private String getDefaultNamespace(Class<?> clazz) {
    String pkg = PackageUtils.getNamespace(PackageUtils.getPackageName(clazz));
    return StringUtils.isEmpty(pkg) ? "http://unknown.namespace/" : pkg;
}
 
Example 15
Source File: OSGiBusListenerTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static boolean isExcluded(String aname, String sname, String rst, String exc) {
    if (!StringUtils.isEmpty(rst) && !aname.matches(rst)) {
        return true;
    }
    return exc != null && sname.matches(exc);
}
 
Example 16
Source File: AbstractBindingBuilder.java    From steady with Apache License 2.0 4 votes vote down vote up
protected WSSecUsernameToken addUsernameToken(UsernameToken token) {
    AssertionInfo info = null;
    Collection<AssertionInfo> ais = aim.getAssertionInfo(token.getName());
    for (AssertionInfo ai : ais) {
        if (ai.getAssertion() == token) {
            info = ai;
            if (!isRequestor()) {
                info.setAsserted(true);
                return null;
            }
        }
    }
    
    String userName = (String)message.getContextualProperty(SecurityConstants.USERNAME);
    if (!StringUtils.isEmpty(userName)) {
        WSSecUsernameToken utBuilder = new WSSecUsernameToken(wssConfig);
        // If NoPassword property is set we don't need to set the password
        if (token.isNoPassword()) {
            utBuilder.setUserInfo(userName, null);
            utBuilder.setPasswordType(null);
        } else {
            String password = (String)message.getContextualProperty(SecurityConstants.PASSWORD);
            if (StringUtils.isEmpty(password)) {
                password = getPassword(userName, token, WSPasswordCallback.USERNAME_TOKEN);
            }
        
            if (!StringUtils.isEmpty(password)) {
                // If the password is available then build the token
                if (token.isHashPassword()) {
                    utBuilder.setPasswordType(WSConstants.PASSWORD_DIGEST);  
                } else {
                    utBuilder.setPasswordType(WSConstants.PASSWORD_TEXT);
                }
                utBuilder.setUserInfo(userName, password);
            } else {
                policyNotAsserted(token, "No password available");
                return null;
            }
        }
        
        if (token.isRequireCreated() && !token.isHashPassword()) {
            utBuilder.addCreated();
        }
        if (token.isRequireNonce() && !token.isHashPassword()) {
            utBuilder.addNonce();
        }
        
        info.setAsserted(true);
        return utBuilder;
    } else {
        policyNotAsserted(token, "No username available");
        return null;
    }
}
 
Example 17
Source File: AbstractBindingBuilder.java    From steady with Apache License 2.0 4 votes vote down vote up
protected WSSecUsernameToken addUsernameToken(UsernameToken token) {
    AssertionInfo info = null;
    Collection<AssertionInfo> ais = aim.getAssertionInfo(token.getName());
    for (AssertionInfo ai : ais) {
        if (ai.getAssertion() == token) {
            info = ai;
            if (!isRequestor()) {
                info.setAsserted(true);
                return null;
            }
        }
    }
    
    String userName = (String)message.getContextualProperty(SecurityConstants.USERNAME);
    if (!StringUtils.isEmpty(userName)) {
        WSSecUsernameToken utBuilder = new WSSecUsernameToken(wssConfig);
        // If NoPassword property is set we don't need to set the password
        if (token.isNoPassword()) {
            utBuilder.setUserInfo(userName, null);
            utBuilder.setPasswordType(null);
        } else {
            String password = (String)message.getContextualProperty(SecurityConstants.PASSWORD);
            if (StringUtils.isEmpty(password)) {
                password = getPassword(userName, token, WSPasswordCallback.USERNAME_TOKEN);
            }
        
            if (!StringUtils.isEmpty(password)) {
                // If the password is available then build the token
                if (token.isHashPassword()) {
                    utBuilder.setPasswordType(WSConstants.PASSWORD_DIGEST);  
                } else {
                    utBuilder.setPasswordType(WSConstants.PASSWORD_TEXT);
                }
                utBuilder.setUserInfo(userName, password);
            } else {
                policyNotAsserted(token, "No password available");
                return null;
            }
        }
        
        if (token.isRequireCreated() && !token.isHashPassword()) {
            utBuilder.addCreated();
        }
        if (token.isRequireNonce() && !token.isHashPassword()) {
            utBuilder.addNonce();
        }
        
        info.setAsserted(true);
        return utBuilder;
    } else {
        policyNotAsserted(token, "No username available");
        return null;
    }
}
 
Example 18
Source File: FaultProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void processFault(JavaMethod method, FaultInfo faultMessage) throws ToolException {
    JavaModel model = method.getInterface().getJavaModel();

    String name = NameUtil.mangleNameToClassName(faultMessage.getName().getLocalPart());
    String namespace = faultMessage.getName().getNamespaceURI();
    String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
    if (namespace.equals(method.getInterface().getNamespace())) {
        packageName = method.getInterface().getPackageName();
    }


    JAXWSBinding jaxwsBinding = faultMessage.getExtensor(JAXWSBinding.class);
    if (jaxwsBinding != null) {
        if (jaxwsBinding.getPackage() != null) {
            packageName = jaxwsBinding.getPackage();
        }
        if (jaxwsBinding.getJaxwsClass() != null
            && jaxwsBinding.getJaxwsClass().getClassName() != null) {
            name = jaxwsBinding.getJaxwsClass().getClassName();
            if (name.contains(".")) {
                packageName = name.substring(0, name.lastIndexOf('.'));
                name = name.substring(name.lastIndexOf('.') + 1);
            }
        }
    }

    while (isNameCollision(packageName, name)) {
        name = name + "_Exception";
    }

    String fullClassName = packageName + "." + name;
    collector.addExceptionClassName(packageName, name, fullClassName);

    boolean samePackage = method.getInterface().getPackageName().equals(packageName);
    method.addException(new JavaException(faultMessage.getName().getLocalPart(),
                                          samePackage ? name : fullClassName, namespace));

    List<MessagePartInfo> faultParts = faultMessage.getMessageParts();

    JavaExceptionClass expClass = new JavaExceptionClass(model);
    expClass.setName(name);
    expClass.setNamespace(namespace);
    expClass.setPackageName(packageName);

    for (MessagePartInfo part : faultParts) {
        String fName = null;
        String fNamespace = null;

        if (part.getElementQName() != null) {
            fNamespace = part.getElementQName().getNamespaceURI();
            //fNamespace = part.getConcreteName().getNamespaceURI();
            fName = part.getConcreteName().getLocalPart();
        } else {
            fNamespace = part.getTypeQName().getNamespaceURI();
            fName = part.getConcreteName().getLocalPart();
        }

        if (StringUtils.isEmpty(fNamespace)) {
            fNamespace = namespace;
        }

        String fType = ProcessorUtil.getType(part, context, false);

        //REVISIT - custom JAXB package names
        String fPackageName = method.getInterface().getPackageName();


        JavaField fField = new JavaField(fName, fType, fNamespace);
        fField.setQName(ProcessorUtil.getElementName(part));

        if (!method.getInterface().getPackageName().equals(fPackageName)) {
            fField.setClassName(ProcessorUtil.getFullClzName(part, context, false));
        }
        if (!fType.equals(ProcessorUtil.resolvePartType(part))) {
            fField.setClassName(ProcessorUtil.getType(part, context, true));
        }

        expClass.addField(fField);
    }
    model.addExceptionClass(packageName + "." + name, expClass);
    expClass.setClassJavaDoc(faultMessage.getDocumentation());
}
 
Example 19
Source File: WrapperBeanAnnotator.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void annotate(final JavaAnnotatable clz) {
    WrapperBeanClass beanClass = null;
    if (clz instanceof WrapperBeanClass) {
        beanClass = (WrapperBeanClass) clz;
    } else {
        throw new RuntimeException("WrapperBeanAnnotator expect JavaClass as input");
    }

    JAnnotation xmlRootElement = new JAnnotation(XmlRootElement.class);
    xmlRootElement.addElement(new JAnnotationElement("name",
                                                     beanClass.getElementName().getLocalPart()));
    xmlRootElement.addElement(new JAnnotationElement("namespace",
                                                     beanClass.getElementName().getNamespaceURI()));

    JAnnotation xmlAccessorType = new JAnnotation(XmlAccessorType.class);
    xmlAccessorType.addElement(new JAnnotationElement(null, XmlAccessType.FIELD));

    XmlType tp = null;
    if (sourceClass != null) {
        tp = sourceClass.getAnnotation(XmlType.class);
    }
    JAnnotation xmlType = new JAnnotation(XmlType.class);
    if (tp == null) {
        xmlType.addElement(new JAnnotationElement("name",
                                              beanClass.getElementName().getLocalPart()));
        xmlType.addElement(new JAnnotationElement("namespace",
                                              beanClass.getElementName().getNamespaceURI()));
    } else {
        if (!"##default".equals(tp.name())) {
            xmlType.addElement(new JAnnotationElement("name",
                                                      tp.name()));
        }
        if (!"##default".equals(tp.namespace())) {
            xmlType.addElement(new JAnnotationElement("namespace",
                                                      tp.namespace()));
        }
        if (!StringUtils.isEmpty(tp.factoryMethod())) {
            xmlType.addElement(new JAnnotationElement("factoryMethod",
                                                      tp.factoryMethod()));
        }
        if (tp.propOrder().length != 1
            || !StringUtils.isEmpty(tp.propOrder()[0])) {
            xmlType.addElement(new JAnnotationElement("propOrder",
                                                  tp.propOrder()));
        }

    }
    List<String> props = new ArrayList<>();
    for (JavaField f : beanClass.getFields()) {
        props.add(f.getParaName());
    }
    if (props.size() > 1) {
        xmlType.addElement(new JAnnotationElement("propOrder",
                                                  props));
    }

    // Revisit: why annotation is string?
    beanClass.addAnnotation(xmlRootElement);
    beanClass.addAnnotation(xmlAccessorType);
    beanClass.addAnnotation(xmlType);
}
 
Example 20
Source File: OAuthJSONProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void writeTokenIntrospection(TokenIntrospection obj, OutputStream os) throws IOException {
    StringBuilder sb = new StringBuilder();
    sb.append('{');
    appendJsonPair(sb, "active", obj.isActive(), false);
    if (obj.isActive()) {
        if (obj.getClientId() != null) {
            sb.append(',');
            appendJsonPair(sb, OAuthConstants.CLIENT_ID, obj.getClientId());
        }
        if (obj.getUsername() != null) {
            sb.append(',');
            appendJsonPair(sb, "username", obj.getUsername());
        }
        if (obj.getTokenType() != null) {
            sb.append(',');
            appendJsonPair(sb, OAuthConstants.ACCESS_TOKEN_TYPE, obj.getTokenType());
        }
        if (obj.getScope() != null) {
            sb.append(',');
            appendJsonPair(sb, OAuthConstants.SCOPE, obj.getScope());
        }
        if (!StringUtils.isEmpty(obj.getAud())) {
            sb.append(',');
            if (obj.getAud().size() == 1) {
                appendJsonPair(sb, "aud", obj.getAud().get(0));
            } else {
                StringBuilder arr = new StringBuilder();
                arr.append('[');
                List<String> auds = obj.getAud();
                for (int i = 0; i < auds.size(); i++) {
                    if (i > 0) {
                        arr.append(',');
                    }
                    arr.append('"').append(auds.get(i)).append('"');
                }
                arr.append(']');
                appendJsonPair(sb, "aud", arr.toString(), false);

            }
        }
        if (obj.getIss() != null) {
            sb.append(',');
            appendJsonPair(sb, "iss", obj.getIss());
        }
        sb.append(',');
        appendJsonPair(sb, "iat", obj.getIat(), false);
        if (obj.getExp() != null) {
            sb.append(',');
            appendJsonPair(sb, "exp", obj.getExp(), false);
        }
        if (obj.getNbf() != null) {
            sb.append(',');
            appendJsonPair(sb, "nbf", obj.getNbf(), false);
        }
        if (!obj.getExtensions().isEmpty()) {
            for (Map.Entry<String, String> entry : obj.getExtensions().entrySet()) {
                sb.append(',');
                if (JoseConstants.HEADER_X509_THUMBPRINT_SHA256.equals(entry.getKey())) {
                    StringBuilder cnfObj = new StringBuilder();
                    cnfObj.append('{');
                    appendJsonPair(cnfObj, entry.getKey(), entry.getValue());
                    cnfObj.append('}');
                    appendJsonPair(sb, JwtConstants.CLAIM_CONFIRMATION, cnfObj.toString(), false);
                } else {
                    appendJsonPair(sb, entry.getKey(), entry.getValue());
                }
            }
        }
    }
    sb.append('}');
    String result = sb.toString();
    os.write(result.getBytes(StandardCharsets.UTF_8));
    os.flush();

}