Examples of ThemeMgtServiceClient


Examples of org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient

            return false;
        }

        try {
            ThemeMgtServiceClient client =
                    new ThemeMgtServiceClient(cookie, serverURL, configurationContext);

            String parentPath = null;
            Map<String, ArrayList<java.lang.String>> formFieldsMap = getFormFieldsMap();
            if (formFieldsMap.get("path") != null) {
                parentPath = formFieldsMap.get("path").get(0);
            }
            String resourceName = null;
            if (formFieldsMap.get("filename") != null) {
                resourceName = formFieldsMap.get("filename").get(0);
            }
            String mediaType = null;
            if (formFieldsMap.get("mediaType") != null) {
                mediaType = formFieldsMap.get("mediaType").get(0);
            }
            String description = null;
            if (formFieldsMap.get("description") != null) {
                description = formFieldsMap.get("description").get(0);
            }
            String symlinkLocation = null;
            if (formFieldsMap.get("symlinkLocation") != null) {
                symlinkLocation = formFieldsMap.get("symlinkLocation").get(0);
            }
            String redirectWith = null;
            if (formFieldsMap.get("redirectWith") != null) {
                redirectWith = formFieldsMap.get("redirectWith").get(0);
            }
            /*
            // currently chroot will not work with multitenancy
            IServerAdmin adminClient =
                    (IServerAdmin) CarbonUIUtil.
                            getServerProxy(new ServerAdminClient(configurationContext,
                                    serverURL, cookie, session), IServerAdmin.class, session);
            ServerData data = adminClient.getServerData();
            String chroot = "";
            if (data.getRegistryType().equals("remote") && data.getRemoteRegistryChroot() != null &&
                    !data.getRemoteRegistryChroot().equals(RegistryConstants.PATH_SEPARATOR)) {
                chroot = data.getRemoteRegistryChroot();
                if (!chroot.startsWith(RegistryConstants.PATH_SEPARATOR)) {
                    chroot = RegistryConstants.PATH_SEPARATOR + chroot;
                }
                if (chroot.endsWith(RegistryConstants.PATH_SEPARATOR)) {
                    chroot = chroot.substring(0, chroot.length() - RegistryConstants.PATH_SEPARATOR.length());
                }
            }
            if (symlinkLocation != null) {
                symlinkLocation = chroot + symlinkLocation;
            }
            */

            FileItemData fileItemData = fileItemsMap.get("upload").get(0);

            if ((fileItemData == null) || (fileItemData.getFileItem().getSize() == 0)) {
                String msg = "Failed add resource. Resource content is empty.";
                log.error(msg);

                CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
                response.sendRedirect(
                        "../" + webContext + "/admin/error.jsp");

                return false;
            }
            DataHandler dataHandler = scaleImage(fileItemData.getDataHandler(), 48, 119);

            client.addResource(
                    calculatePath(parentPath, resourceName), mediaType, description, dataHandler,
                    symlinkLocation, redirectWith);

            response.setContentType("text/html; charset=utf-8");
            String msg = "The logo has been successfully updated.";
View Full Code Here

Examples of org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        try {
            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
            String path = request.getParameter("path");
            String viewImage = request.getParameter("viewImage");
            if (path == null) {
                String msg = "Could not get the resource content. Path is not specified.";
                log.error(msg);
                response.setStatus(400);
                return;
            }

            ContentDownloadBean bean = client.getContentDownloadBean(path);

            InputStream contentStream = null;
            if (bean.getContent() != null) {
                contentStream = bean.getContent().getInputStream();
            } else {
View Full Code Here

Examples of org.wso2.carbon.theme.mgt.ui.clients.ThemeMgtServiceClient

            return false;
        }

        try {
            ThemeMgtServiceClient client =
                    new ThemeMgtServiceClient(cookie, serverURL, configurationContext);

            String parentPath = null;
            if (formFieldsMap.get("path") != null) {
                parentPath = formFieldsMap.get("path").get(0);
            }
            String resourceName = null;
            if (formFieldsMap.get("filename") != null) {
                resourceName = formFieldsMap.get("filename").get(0);
            }
            String mediaType = null;
            if (formFieldsMap.get("mediaType") != null) {
                mediaType = formFieldsMap.get("mediaType").get(0);
            }
            String description = null;
            if (formFieldsMap.get("description") != null) {
                description = formFieldsMap.get("description").get(0);
            }
            String symlinkLocation = null;
            if (formFieldsMap.get("symlinkLocation") != null) {
                symlinkLocation = formFieldsMap.get("symlinkLocation").get(0);
            }
            String redirectWith = null;
            if (formFieldsMap.get("redirectWith") != null) {
                redirectWith = formFieldsMap.get("redirectWith").get(0);
            }
            /*
            // currently chroot will not work with multitenancy
            IServerAdmin adminClient =
                    (IServerAdmin) CarbonUIUtil.
                            getServerProxy(new ServerAdminClient(configurationContext,
                                    serverURL, cookie, session), IServerAdmin.class, session);
            ServerData data = adminClient.getServerData();
            String chroot = "";
            if (data.getRegistryType().equals("remote") && data.getRemoteRegistryChroot() != null &&
                    !data.getRemoteRegistryChroot().equals(RegistryConstants.PATH_SEPARATOR)) {
                chroot = data.getRemoteRegistryChroot();
                if (!chroot.startsWith(RegistryConstants.PATH_SEPARATOR)) {
                    chroot = RegistryConstants.PATH_SEPARATOR + chroot;
                }
                if (chroot.endsWith(RegistryConstants.PATH_SEPARATOR)) {
                    chroot = chroot.substring(0, chroot.length() - RegistryConstants.PATH_SEPARATOR.length());
                }
            }
            if (symlinkLocation != null) {
                symlinkLocation = chroot + symlinkLocation;
            }
            */

            FileItemData fileItemData = fileItemsMap.get("upload").get(0);

            if ((fileItemData == null) || (fileItemData.getFileItem().getSize() == 0)) {
                String msg = "Failed add resource. Resource content is empty.";
                log.error(msg);

                CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request);
                response.sendRedirect(
                        "../" + webContext + "/admin/error.jsp");

                return false;
            }
            DataHandler dataHandler = scaleImage(fileItemData.getDataHandler(), 48, 119, 100);

            client.addResource(
                    calcualtePath(parentPath, resourceName), mediaType, description, dataHandler,
                    symlinkLocation, redirectWith);

            response.setContentType("text/html; charset=utf-8");
            String msg = "The logo has been successfully updated.";
View Full Code Here

Examples of org.wso2.carbon.theme.mgt.ui.clients.ThemeMgtServiceClient

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        try {
            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
            String path = request.getParameter("path");
            String viewImage = request.getParameter("viewImage");
            if (path == null) {
                String msg = "Could not get the resource content. Path is not specified.";
                log.error(msg);
                response.setStatus(400);
                return;
            }

            ContentDownloadBean bean = client.getContentDownloadBean(path);

            InputStream contentStream = null;
            if (bean.getContent() != null) {
                contentStream = bean.getContent().getInputStream();
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.