Coder Social home page Coder Social logo

dgradecak / alfresco-mvc Goto Github PK

View Code? Open in Web Editor NEW
22.0 8.0 9.0 619 KB

Glue between SpringMVC @Controllers and Alfresco

License: Apache License 2.0

Java 100.00%
alfresco content-management content-management-system spring-mvc springmvc annotations webscript spring amp alfresco-mvc

alfresco-mvc's People

Contributors

dgradecak avatar lorelj2 avatar todorinskiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfresco-mvc's Issues

Not working on alfresco 23.1.0 due to Jakarta migraion

In alfresco version 23.1.0 Alfresco Content Services have migrated to Jakarta, alfresco-mvc needs to migrate from javax dependencies to jakarta in order to work with alfresco versions > 7.X

From the Alfresco Community Edition 23.1 Release Notes:

Jakarta Migration

As a part of Jakarta Migration number of javax API used by Alfresco Content Services was replaced by Jakarta EE equivalents.

Table below shown list of changes:

javax.xml.bind:jaxb-api > jakarta.xml.bind-api
com.sun.xml.bind:jaxb-impl > org.glassfish.jaxb:jaxb-runtime
com.sun.xml.bind:jaxb-core > org.glassfish.jaxb:jaxb-core
javax.xml.soap:saaj-api. > jakarta.xml.soap-api
javax.transaction > jakarta.transaction-api
javax.mail > jakarta.mail-api
javax.activation-api > jakarta.activation-api
javax.jms-api > jakarta.jms-api
javax.json > jakarta.json-api
org.glassfish:jakarta.json > org.eclipse.parsson:parsson
javax.servlet:servlet-api > jakarta.servlet-api
javax.xml.ws:jaxws-api > jakarta.xml.ws-api
javax.annotation-api > jakarta.annotation-api

ObjectMapper in DispatcherWebscript

as the object mapper (jackson 2) is used to encode json in case of unhandled exceptions, we have an issue with older versions of Alfresco, where only jackson 1 is used. Since we rely on jackson 2 we better simply encode the json string into a java string directly.

However, Alfresco 5 includes jackson 2 also and therfore we might have the same approach for older Alfresco versions.

Error when starting up in 5.1 MT environment

Hi!

We're using version 4.0.0 of alfresco-mvc

When upgrading from Alfresco 4.2.5.4 to 5.1 (enterprise) we encountered a error:
"org.alfresco.error.AlfrescoRuntimeException: 03200119 Keystores are invalid"
...
Caused by: org.springframework.jdbc.BadSqlGrammarException:

Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: relation "alf_content_url_encryption" does not exist

Full log is available at https://gist.github.com/jancalve/cec73487f215bec71d81ea9a93a27f82

What happens - from what we can see - is that when the dispatcherWebScript has started up, it emits a refresh event to the Alfresco ContextLoader.configureAndRefreshWebApplicationContext which then attempts to load the keystore and results in the exception.

One of the patches in Alfresco 5.1 is to add a new table - alf_content_url_encryption - which is used when loading the keystore.
I believe this is a timing issue..

In DispatcherWebscript, the WebAplicationContext is initialized via InitializingBean, which happens before any patches are applied to the system and database.

We've manually worked around the problem by executing the Alfresco patch which creates the alf_content_url_encryption table.

Possibly the fix is to initialize the dispatcherWebScript at a later stage so upgrade patches can complete - do you have any ideas?

// JC

alfresco-mvc and multi-tenancy

Hi,

We use (version 1) of alfresco-mvc, and we have a rather largish install with a couple of hundred tenants. What we see is that when a tenant is accessed for the first time, alfresco-mvc more or less blocks alfresco while wireing up our beans. We have some five beans which all seem to be scanning the classpath for components and wireing themselves up.

All in all, this causes us to have to run a warmup-script, accessing all our tenants on a restart, and this script currently runs for about an hour.

I would appreciate any pointers to how we can speed this up.

Couldnt Get Sample Working

Hi,
I am trying to use your project to learn simplify one of the projects i am working on;

@Configuration @EnableWebAlfrescoMvc @ComponentScan(basePackageClasses = {UserContext.class}) public class RestServletContext implements WebMvcConfigurer { }

and

`
@configuration
@EnableAlfrescoMvcRest(@AlfrescoDispatcherWebscript(
servletContext = RestServletContext.class))
public class PlatformModule {

}
`

in a module created with alfresco archetype "org.alfresco.maven.archetype:alfresco-allinone-archetype" i am trying to add few Controllers in a module, i havent tried deploying it yet tried writing Junit test

`
@ExtendWith(SpringExtension.class)

@ContextHierarchy({@ContextConfiguration(locations = "/test-restjsonmodule.xml"),
@ContextConfiguration(classes = RestServletContext.class)})

class UserControllerTest {

@Autowired
private DispatcherWebscript dispatcherWebscript;

/**

/**

@test
void test() {
DispatcherServlet dispatcherServlet = dispatcherWebscript.getDispatcherServlet()
.getWebApplicationContext().getBean(DispatcherServlet.class);
Assertions.assertNotNull(dispatcherServlet);
}

}
`

and getting

java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:97)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$6(ClassBasedTestDescriptor.java:350)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:355)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$7(ClassBasedTestDescriptor.java:350)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:349)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$4(ClassBasedTestDescriptor.java:270)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:269)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$2(ClassBasedTestDescriptor.java:259)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$3(ClassBasedTestDescriptor.java:258)
at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:101)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:100)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:111)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:111)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:79)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:84)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'resourceHandlerMapping' threw exception; nested exception is java.lang.IllegalStateException: No ServletContext set
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:275)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:243)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 69 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'resourceHandlerMapping' threw exception; nested exception is java.lang.IllegalStateException: No ServletContext set
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
... 87 more
Caused by: java.lang.IllegalStateException: No ServletContext set
at org.springframework.util.Assert.state(Assert.java:73)
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.resourceHandlerMapping(WebMvcConfigurationSupport.java:486)
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$c81a9faa.CGLIB$resourceHandlerMapping$28()
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$c81a9faa$$FastClassBySpringCGLIB$$bded409a.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$c81a9faa.resourceHandlerMapping()
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 88 more

Can you kindly help me get started.

webscript context mapping

when generating HATEOAS links

Link.of(ServletUriComponentsBuilder.fromCurrentServletMapping().path("/objects/id/list").build().toUriString(), "list");			
Link.of(ServletUriComponentsBuilder.fromCurrentContextPath().path("/objects/id/list").build().toUriString(), "lista");			
Link.of(ServletUriComponentsBuilder.fromCurrentRequestUri().path("/objects/id/list").build().toUriString(), "listv");
Link.of(ServletUriComponentsBuilder.fromCurrentRequest().path("/objects/id/list").build().toUriString(), "listn");

the links are generated with the missing alfresco webscript root context

  "links": [
    {
      "rel": "list",
      "href": "http://localhost:9090/objects/id/list"
    },
    {
      "rel": "lista",
      "href": "http://localhost:9090/objects/id/list"
    },
    {
      "rel": "listv",
      "href": "http://localhost:9090/sites/efectaaaf/libraries/documentLibrary/objects/id/list"
    },
    {
      "rel": "listn",
      "href": "http://localhost:9090/sites/efectaaaf/libraries/documentLibrary/objects/id/list"
    }
  ]

providing a similar feature with a new class "WebscriptUriComponentsBuilder" seems reasonable

having multiple descriptors with different transaction value fails

having different values for the transaction for multiple web script descriptors result in an error when calling endpoints that requires read and write transaction with an exception :
ERROR [extensions.webscripts.AbstractRuntime] [http-nio-8080-exec-11] Exception from executeScript: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.alfresco.service.transaction.ReadOnlyServerException: 03260118 Access Denied. The system is currently in read-only mode. java.io.IOException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.alfresco.service.transaction.ReadOnlyServerException: 03260118 Access Denied. The system is currently in read-only mode. at com.gradecak.alfresco.mvc.webscript.DispatcherWebscript.execute(DispatcherWebscript.java:125) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:506) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:685) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:721) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:413) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:309) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:423) at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210) at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:131) at org.alfresco.repo.web.scripts.AlfrescoWebScriptServlet.service(AlfrescoWebScriptServlet.java:43) at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.extensions.webscripts.servlet.SecurityHeadersFilter.doFilter(SecurityHeadersFilter.java:177) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.alfresco.web.app.servlet.ServletMetricsFilter.doFilter(ServletMetricsFilter.java:161) at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.alfresco.web.app.servlet.ClearSecurityContextFilter.doFilter(ClearSecurityContextFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.alfresco.service.transaction.ReadOnlyServerException: 03260118 Access Denied. The system is currently in read-only mode. at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:920) at javax.servlet.http.HttpServlet.service(HttpServlet.java:684) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) at com.gradecak.alfresco.mvc.webscript.DispatcherWebscript.execute(DispatcherWebscript.java:121) ... 41 more Caused by: org.alfresco.service.transaction.ReadOnlyServerException: 03260118 Access Denied. The system is currently in read-only mode. at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.getCurrentTransaction(AbstractNodeDAOImpl.java:586) at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNodeImpl(AbstractNodeDAOImpl.java:1309) at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNode(AbstractNodeDAOImpl.java:1233) at org.alfresco.repo.node.db.DbNodeServiceImpl.createNode_aroundBody24(DbNodeServiceImpl.java:392) at org.alfresco.repo.node.db.DbNodeServiceImpl$AjcClosure25.run(DbNodeServiceImpl.java:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:179) at org.alfresco.traitextender.RouteExtensions.intercept(RouteExtensions.java:100) at org.alfresco.repo.node.db.DbNodeServiceImpl.createNode(DbNodeServiceImpl.java:342) at jdk.internal.reflect.GeneratedMethodAccessor197.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.alfresco.repo.lock.mem.LockableAspectInterceptor.invoke(LockableAspectInterceptor.java:244) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy39.createNode(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor197.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:111) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy39.createNode(Unknown Source) at org.alfresco.repo.version.Version2ServiceImpl.createVersionHistory(Version2ServiceImpl.java:395) at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:263) at org.alfresco.repo.version.Version2ServiceImpl.createVersion_aroundBody2(Version2ServiceImpl.java:158) at org.alfresco.repo.version.Version2ServiceImpl$AjcClosure3.run(Version2ServiceImpl.java:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:179) at org.alfresco.traitextender.RouteExtensions.intercept(RouteExtensions.java:100) at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:142) at org.alfresco.repo.version.VersionServiceImpl.ensureVersioningEnabled_aroundBody4(VersionServiceImpl.java:1011) at org.alfresco.repo.version.VersionServiceImpl$AjcClosure5.run(VersionServiceImpl.java:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:179) at org.alfresco.traitextender.RouteExtensions.intercept(RouteExtensions.java:100) at org.alfresco.repo.version.VersionServiceImpl.ensureVersioningEnabled(VersionServiceImpl.java:967)

get ticket in the authentication advice

Hello Daniel,

This is Samuel, I have been playing lately with the alfresco mvc. In particular, I was creating controllers with a required level of authentication as admin:
@AlfrescoAuthentication(AuthenticationType.ADMIN)

However I had an authentication exception. Indeed, I had no ticket in the cookies and this piece of code was failing (AuthenticationAdvice:107):
ticket = (String) parameterMap.get(parameter);
Due to a cast exception with a String[].

Actually, I was wondering why do you do all this logic with the cookies or the request parameters since you can get all this information with the authenticationService. In the meanwhile I rewrote the method get ticket, in a local branch:
ticket = serviceRegistry.getAuthenticationService().getCurrentTicket();

Cheers,
Sam

URL with regexpr chars like $

/alfresco/s/mvc/test/abc$def
fails in DispatcherWebscript since the regexp cannot parse this URL part. It is correctly encoded by the client, than alfresco decodes it and transfer to the dispatcherwebscript decoded.

Alfresco MVC rest not working with Alfresco 6

When trying Alfresco MVC REST with alfresco 6 I am getting status 500 with following error message.

org.springframework.http.MediaType.getCharSet()Ljava/nio/charset/Charset;

While looking at stack trace I am assuming old Lib is beign referenced in Alfresco MVC Rest lib
stack-trace.txt

mvc message converters seems obsolete now

Alfresco 6 introduced new libraries - recheck spring mvc setup

@SInCE 4.1.3 of Spring there is a new method org.springframework.web.servlet.config.annotation.WebMvcConfigurer.extendMessageConverters

this one should be used instead of dealing with provided converters, even though it is in a child context.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.