Package org.apache.axis2.jaxws.sample.mtom1

Examples of org.apache.axis2.jaxws.sample.mtom1.ObjectFactory


     * "include" all methods.
     */
    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled1() throws Exception {

        com.opensymphony.xwork2.config.Configuration originalConfiguration = configurationManager.getConfiguration();
        ObjectFactory originalObjectFactory = ObjectFactory.getObjectFactory();

        try {
            // used to determined if the form action needs js validation
            configurationManager.setConfiguration(new com.opensymphony.xwork2.config.impl.DefaultConfiguration() {
                public RuntimeConfiguration getRuntimeConfiguration() {
                    return new RuntimeConfiguration() {
                        public ActionConfig getActionConfig(String namespace, String name) {
                            ActionConfig actionConfig = new ActionConfig() {
                                public List getInterceptors() {
                                    List interceptors = new ArrayList();

                                    ValidationInterceptor validationInterceptor = new ValidationInterceptor();
                                    validationInterceptor.setIncludeMethods("*");

                                    InterceptorMapping interceptorMapping = new InterceptorMapping();
                                    interceptorMapping.setName("validation");
                                    interceptorMapping.setInterceptor(validationInterceptor);
                                    interceptors.add(interceptorMapping);

                                    return interceptors;
                                }
                            };
                            return actionConfig;
                        }

                        public Map getActionConfigs() {
                            return null;
                        }
                    };
                }
            });

            // used by form tag to get "actionClass" parameter
            ObjectFactory.setObjectFactory(new ObjectFactory() {
                public Class getClassInstance(String className) throws ClassNotFoundException {
                    if (DefaultActionMapper.class.getName().equals(className)) {
                        return DefaultActionMapper.class;
                    }
                    return ActionSupport.class;
View Full Code Here


     * "excludes" all methods.
     */
    public void testFormWithCustomOnsubmitEnabledWithValidateEnabled2() throws Exception {

        com.opensymphony.xwork2.config.Configuration originalConfiguration = configurationManager.getConfiguration();
        ObjectFactory originalObjectFactory = ObjectFactory.getObjectFactory();

        try {
            // used to determined if the form action needs js validation
            configurationManager.setConfiguration(new com.opensymphony.xwork2.config.impl.DefaultConfiguration() {
                public RuntimeConfiguration getRuntimeConfiguration() {
                    return new RuntimeConfiguration() {
                        public ActionConfig getActionConfig(String namespace, String name) {
                            ActionConfig actionConfig = new ActionConfig() {
                                public List getInterceptors() {
                                    List interceptors = new ArrayList();

                                    ValidationInterceptor validationInterceptor = new ValidationInterceptor();
                                    validationInterceptor.setExcludeMethods("*");

                                    InterceptorMapping interceptorMapping = new InterceptorMapping();
                                    interceptorMapping.setName("validation");
                                    interceptorMapping.setInterceptor(validationInterceptor);
                                    interceptors.add(interceptorMapping);

                                    return interceptors;
                                }
                            };
                            return actionConfig;
                        }

                        public Map getActionConfigs() {
                            return null;
                        }
                    };
                }
            });

            // used by form tag to get "actionClass" parameter
            ObjectFactory.setObjectFactory(new ObjectFactory() {
                public Class getClassInstance(String className) throws ClassNotFoundException {
                    if (DefaultActionMapper.class.getName().equals(className)) {
                        return DefaultActionMapper.class;
                    }
                    return ActionSupport.class;
View Full Code Here

            }

            try {
                Class clazz = ClassLoaderUtil.loadClass(className,
                        Jsr168Dispatcher.class);
                ObjectFactory objectFactory = (ObjectFactory) clazz
                        .newInstance();
                if (objectFactory instanceof ObjectFactoryInitializable) {
                    ((ObjectFactoryInitializable) objectFactory)
                            .init(ServletContextHolderListener
                                    .getServletContext());
View Full Code Here

    /**
     * Cleans up thread local variables
     */
    public void cleanup() {
        ObjectFactory objectFactory = ObjectFactory.getObjectFactory();
        if (objectFactory == null) {
            LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed");
        }
        if (objectFactory instanceof ObjectFactoryDestroyable) {
            try {
View Full Code Here

                        +"use the full class name: "+className);
            }

            try {
                Class clazz = ClassLoaderUtil.loadClass(className, Dispatcher.class);
                ObjectFactory objectFactory = (ObjectFactory) clazz.newInstance();
                if (servletContext != null) {
                    if (objectFactory instanceof ObjectFactoryInitializable) {
                        ((ObjectFactoryInitializable) objectFactory).init(servletContext);
                    }
                }
View Full Code Here

       
        Map<String, PackageConfig> packageConfigs = new HashMap<String, PackageConfig>();
        packageConfigs.put("test", packageConfig);
       
        Mock mockContainer = new Mock(Container.class);
        mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
        DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
        container.inject(factory);
        mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), factory);

        Mock mockConfiguration = new Mock(Configuration.class);
View Full Code Here

       
        SOAPBinding binding = (SOAPBinding)dispatch.getBinding();
        binding.setMTOMEnabled(true);
       
        Image image = ImageIO.read (new File(imageResourceDir+File.separator+"test.jpg"));
        ImageDepot imageDepot = new ObjectFactory().createImageDepot();
        imageDepot.setImageData(image);
        setText(imageDepot);
       
        //Create a request bean with imagedepot bean as value
        ObjectFactory factory = new ObjectFactory();
        Invoke request = factory.createInvoke();
View Full Code Here

       
        SOAPBinding binding = (SOAPBinding)dispatch.getBinding();
        binding.setMTOMEnabled(false)// Disabling MTOM optimization on client, but server will respond with optimized MTOM
       
        Image image = ImageIO.read (new File(imageResourceDir+File.separator+"test.jpg"));
        ImageDepot imageDepot = new ObjectFactory().createImageDepot();
        imageDepot.setImageData(image);
        setText(imageDepot);
       
        //Create a request bean with imagedepot bean as value
        ObjectFactory factory = new ObjectFactory();
        Invoke request = factory.createInvoke();
View Full Code Here

       
        JAXBContext jbc = JAXBContext.newInstance("org.apache.axis2.jaxws.sample.mtom1");
        Dispatch<Object> dispatch = svc.createDispatch(QNAME_PORT, jbc, Service.Mode.PAYLOAD);
       
        Image image = ImageIO.read (new File(imageResourceDir+File.separator+"test.jpg"));
        ImageDepot imageDepot = new ObjectFactory().createImageDepot();
        imageDepot.setImageData(image);
        setText(imageDepot);
       
        //Create a request bean with imagedepot bean as value
        ObjectFactory factory = new ObjectFactory();
        Invoke request = factory.createInvoke();
View Full Code Here

       
        SOAPBinding binding = (SOAPBinding)dispatch.getBinding();
        binding.setMTOMEnabled(true);
       
        Image image = ImageIO.read (new File(imageResourceDir+File.separator+"test.jpg"));
        ImageDepot imageDepot = new ObjectFactory().createImageDepot();
        imageDepot.setImageData(image);
        setText(imageDepot);
       
        //Create a request bean with imagedepot bean as value
        ObjectFactory factory = new ObjectFactory();
        Invoke request = factory.createInvoke();
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.sample.mtom1.ObjectFactory

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.