Magnolia REST tools - java

When I try to display REST tools from the main page
It ends up with error
Can't read from server. It may not have the appropriate access-control-origin settings
The page looks like below
Why does this appear instead of swagger docs? Is there any misconfiguration or maybe some privileges not set?

It looks like that exception comes from Swagger side. Have you check If you have provided
'apiBasepath' at '/modules/rest-tools/config/apiBasepath'
Default value for preconfigured Magnolia bundles should be 'http://localhost:8080/magnoliaAuthor/.rest' but you should adjust it to your configuration.
Cheers,
İlgün

Related

How to set context path in Spring Boot running in AppEngine Standard

Is there a way to set a context path in a Spring Boot application running in GCP AppEngine Standard?
I want to add an implicit prefix to all my resources. So if the #RestControllers are, say, /a and /b, I want that to access them, their URL is always /my/prefix/a and /my/prefix/b. In normal, embedded mode in Spring Boot, this works by setting server.servlet.context-path. However, this setting is not respected by AppEngine. In it, /my/prefix/a returns a 404 and I have to use /a instead
How do I add a common prefix to all my resources in AppEngine Standard? This seems basic for AppEngine's services/modules support to avoid duplicating the prefix in all controllers, but I can't find how to do it
so per my conversation with the Google Cloud Support team - I got confirmation that the App Engine Standard does not support / honor the port & context paths set in spring-boot.
This is the response I got from them:
"With regards to your concern about App Engine not honoring the manually set port number and context path, this is because it should be setup in yaml file.
For the port to be set as 7777, it should be done by port forwarding. However, port forwarding is only available in App Engine Flex. For more details about this, you may visit this page [1].
For the context-path, you may use the tag and include in appengine-web.xml file. This sets the path in your application that contains the static files. You may check this document [2] for more information.
You could also include the tag in your appengine-web.xml as it is also useful for serving static content such as images, CSS stylesheets or JavaScript files. You may use this reference [3].
With this solution or workaround, this also address that spring-boot application could be deployed in App Engine.
If you have further concerns, just let me know.
Thank you and have a nice day!
[1] https://cloud.google.com/appengine/docs/flexible/custom-runtimes/configuring-your-app-with-app-yaml#port_forwarding
[2] https://cloud.google.com/appengine/docs/standard/java/config/appref#public_root
[3] https://cloud.google.com/appengine/docs/standard/java/config/appref#static_files
"
However, setting the to some value did not still pick it up as the context path. So had to abandon GAE unfortunately. Wasted so much time on this - hope this is useful for others that are struggling with this.

NCSA request handler doesn't work in pax-web 1.1.4

I try to enable NCSA request logging in pax-web 1.1.4. The recommended way to do it doesn't work. The file was created but it stays empty. Looking in source code I found that pax web implementation of Jetty server passes requests to JettyServerHandlerCollection which assumes that every handler should correspond a context. So it looks impossible for me just to use org.ops4j.pax.web.log.ncsa.* options.
Am I missing something or this functionality doesn't work in pax web? Are there any workarounds?
Yep, it's a bug in Pax-Web and has been filed on PAXWEB-416

felix exthttpservice set session path for cookies

I have a webapplication that I am running in Felix osgi container. I am using jetty as the implementation for the extHttpService. Currently it is writing the cookies to the '/' root path. I would like to change this as it is causing conflicts with other web applications. Looking at jetty documentation it appears I need to set the following property.
org.mortbay.jetty.servlet.SessionPath
However, I am unable to find a way to set this using the ExtHttpService via osgi. I have tried creating a jetty.xml file, adding this to the config.properties, and setting it as a property in the call to register my servlet.
Does anyone know how to set this?
thanks,
I actually ended up patching the source for my current implementation, but on the mailing lists here, a patch has been submitted that should allow this to be configurable.

debugging in struts application

i'm new to struts... I have a struts form. i need to analyze the data posted to an action class. i just want to output the data to a page and stop further execution so as to test of it is working correctly... how is it done..?
There are many ways to debug a struts application:
Configuration Plugin: You can use configuration plugin provided by struts. To use this plugin include struts2-config-browser-plugin-x.x.x.x.jar jar in your classpath and then you can use
">Launch the configuration browser
anywhere in your application to view a lot of detail about the action class.
The second way is to use Debugging Interceptor by using property debug=true in struts.xml.
See the below link for more details:
http://struts.apache.org/release/2.2.x/docs/debugging-struts.html
The easiest way to quickly and thoroughly inspect http requests and responses and post data is to use either:
http-fox with firefox (download)
chromes' network inspector (pre-installed with chrome - ctrl-shift-i - Network - Click on the appropriate post request and the body of the post will be displayed)
If neither of these very easy tools appeal, you'll have to find the appropriate hook to attach your debugger. I've not used struts since 2002 so cann't advise.
The best method is to use System.out.print and get the result in the tomcat console... i had said i need on server side not client side.

Deploying Struts2 Application without ContextPath

I've got a struts2 application running under a contextpath "/path" on my local tomcat without problems. When I deploy it on a webserver (using a proxy to redirect from "http://www.domain.com" to "myserver:8080/path/") Struts does all kinds of strange things.
First, it includes the context in -tags. That can be turned off by an attribute. But sadly, it also includes the path in the action attributes of my forms, so a login form points to "http://www.domain.com/path/login.action" instead of "http://www.domain.com/login.action" ...
Is there a possibility so somehow change the default context that is added here or turn this off for forms? (I'd like to keep the -tags, only way round seems to be to use default HTML forms.) Thanks in advance!
I found that others also had the problem, but the framework makers don't seem to think that this is an issue. My solutions:
use includeContext="false" in all s:url-tags
instead of the s:form tag, use a usual form, set the action to "actionname.action" and include a simple table with tablerows () for each field. You still can use s:textfield and such.
sadly HTTP sessions won't work anymore as they get set for the path "/path" (the ApplicationPath). This is due to the cookie that saves the JSESSIONID being set to /path. This means that your visitors will only get session variables stored when they're at http://www.domain.com/path/login.action and that those will be lost when they get redirected back to http://www.domain.com/interestingstuff.action ... my solution is a hack that requires setting the JSESSIONID cookie clientside via JavaScript as described here: Struts2: Session Problem (after reverse proxy)
Hope this helps someone ... if you find nicer solutions, please let me know. :-)
Though am answering very late to this question, but I reached this page recently when I was facing the same problem.
The application that I was working upon was appending the context-root viz. 'myContextRoot' to my url on localhost and it was working perfectly there. For eg., as mentioned above the action 'myAction' was becoming
http://localhost:8050/myContextRoot/myAction.action
But the moment I deployed it on a server, it stopped working, then after searching like hell, I found a solution for me. I am deploying an EAR file on glassfish and there we have a file application.xml. In application.xml I had a tag 'context-root' whose value was 'myContextRoot' which I changed to '/' and after that I got my url as on localhost and
Hope it may help :)

Categories