Package org.ogce.xregistry.utils.XRegClientConstants

Examples of org.ogce.xregistry.utils.XRegClientConstants.DocType


        return ServiceConstants.ERROR_STATUS;
      }
        ApplicationGlobalContext context = (ApplicationGlobalContext)facesContext.getExternalContext().getSessionMap().get("applicationGlobalContext");
          StringBuffer resultsAsStr = new StringBuffer();
          resultsAsStr.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
      DocType type = XRegClientConstants.DocType.valueOf(doctype);
            switch (type) {
            case AppDesc:
              String [] splitNames = objectName.split("#");
            if(splitNames != null && splitNames.length == 2){
              resultsAsStr.append(context.getRegService().getAppDesc(splitNames[0], splitNames[1]));
View Full Code Here


                    name1 = name.substring(0, index);
                    name2 = name.substring(index + 1);
                }

                String resultsAsStr;
                DocType type = XRegClientConstants.DocType.valueOf(docTypeStr);
                switch (type) {
                case AppDesc:
                    System.out.println(name1 + " " + name2);
                    resultsAsStr = context.getRegService().getAppDesc(name1, name2);
                    break;
                case ServiceDesc:
                    resultsAsStr = context.getRegService().getServiceMap(name1);
                    break;
                case HostDesc:
                    resultsAsStr = context.getRegService().getHostDesc(name1);
                    break;
                default:
                    throw new ServletException("Unknown document Type");
                }
                System.out.println("I got it" + resultsAsStr);
                response.setContentType("text/xml");
               // response.getWriter().write(resultsAsStr);
            } else {
                boolean isMultipart = ServletFileUpload
                        .isMultipartContent(new ServletRequestContext(request));
                if (isMultipart) {
                    DiskFileItemFactory factory = new DiskFileItemFactory();
                    // Set factory constraints
                    factory.setSizeThreshold(0);
                    File tempDir = new File("/tmp/fileupload" + System.currentTimeMillis());
                    if (!tempDir.exists()) {
                        tempDir.mkdir();
                    }
                    factory.setRepository(tempDir);

                    // Create a new file upload handler
                    ServletFileUpload upload = new ServletFileUpload(factory);

                    // Set overall request size constraint
                    // upload.setSizeMax(yourMaxRequestSize);

                    // Parse the request
                    List items = upload.parseRequest(request);
                    FileItem file = null;
                    for (int i = 0; i < items.size(); i++) {
                        FileItem item = (FileItem) items.get(i);
                        System.out.println(item.getFieldName() + " = " + item.getString() + " "
                                + item.getName());
                        if (!item.isFormField()) {
                            file = item;
                        } else if ("docType".equals(item.getFieldName())) {
                            docTypeStr = item.getString();
                        }
                    }

                    if (docTypeStr != null && file != null) {
                        DocType type = XRegClientConstants.DocType.valueOf(docTypeStr);
                        switch (type) {
                        case AppDesc:
                            context.getRegService().registerAppDesc(file.getString());
                            break;
                        case ServiceDesc:
View Full Code Here

TOP

Related Classes of org.ogce.xregistry.utils.XRegClientConstants.DocType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.