WebSphere Portal decode url - url

How I can decode WebSphere Portal url?
For example this url: /wps/portal/!ut/p/c5/dY7LdoIwAAW_hS9ICEnEZSBaKBSKkUfZcAKtKRYMKo-2X197XHtnObO4oAQ3TnJulRxbfZIdKEBJK2wn24ylATUpWUNfhLt9anHTJgg8g1J1ur6VOX_T31wzxRk_4NHZobEvzs5Vu6o3942nbJRTEpNl-UHmoK5JGlfvpOHThtV04ksmNlac5oHuz-HWb4QMcTQHr11SE3xZTUPdz9GvKwkTRfsydMdJHrQTd-vPizIMkP8_p5X7xDy8CiGMUQYhiohIYCos6Ft3Dx-MQRB5uv8Aw1cNj5gZfxocKIs!/dl3/d3/L2dJQSEvUUt3QS9ZQnZ3LzZfNDhRRlZBVUs2UEZMRDBJU1RDTEZIRTEwTDM!/
Is it possible?

Try the following:
/wps/poc?uri=state:URL&mode=download
where URL is your original URL for example:
/wps/poc?uri=state:/wps/portal/!ut/p/c5/dY7LdoIwAAW_hS9ICEnEZSBaKBSKkUfZcAKtKRYMKo-2X197XHtnObO4oAQ3TnJulRxbfZIdKEBJK2wn24ylATUpWUNfhLt9anHTJgg8g1J1ur6VOX_T31wzxRk_4NHZobEvzs5Vu6o3942nbJRTEpNl-UHmoK5JGlfvpOHThtV04ksmNlac5oHuz-HWb4QMcTQHr11SE3xZTUPdz9GvKwkTRfsydMdJHrQTd-vPizIMkP8_p5X7xDy8CiGMUQYhiohIYCos6Ft3Dx-MQRB5uv8Aw1cNj5gZfxocKIs!/dl3/d3/L2dJQSEvUUt3QS9ZQnZ3LzZfNDhRRlZBVUs2UEZMRDBJU1RDTEZIRTEwTDM!/&mode=download
I do not have a running portal to check that but according to my notes it should work.

Michal's answer is correct, calling the POC servlet that way will decode the state information in the URL and produce an XML representation.
The format of this XML is not published, but is pretty easy to decipher, here's an example of how it can look:
<root session="1977644512">
<state type="navigational">
<portlet id="Z7_C2ORULUV0G8BD0IR4S6TP030G6">
<window-state>minimized</window-state>
</portlet>
<selection selection-node="Z6_C2ORULUV00A520IBF1FAOO10G6">
<mapping src="Z6_C2ORULUV0GP520IBIUSMBS0040" dst="Z6_C2ORULUV00A520IBF1FAOO10G6"/>
<mapping src="Z6_000000000000000000000000A0" dst="Z6_C2ORULUV001S30IR8FCN1Q3001"/>
<mapping src="Z6_C2ORULUV001S30IR8FCN1Q3001" dst="Z6_C2ORULUV0GP520IBIUSMBS0040"/>
</selection>
<expansions>
<node id="Z6_C2ORULUV0GP520IBIUSMBS00O5"/>
<node id="Z6_CGAH47L008LG50IAHUR9Q330A3"/>
<node id="Z6_000000000000000000000000A0"/>
</expansions>
<theme-template>Home</theme-template>
<portlet id="Z7_CGAH47L008LG50IAHUR9Q33803" portlet-type="legacy"/>
</state>
<target portlet-type="legacy" portlet-id="Z7_CGAH47L008LG50IAHUR9Q33803" id="LSzyY48160027">
<target-type>action</target-type>
<action-ref>sa.spf_ActionListener</action-ref>
</target>
</root>
Inspecting the XML allows you to do qualified guesses as to what the different information actually means. The <portlet> section(s) for example, clearly contains information about the window state and can probably also contain information about portlet mode. The <selection> section contains the selection path that the user has traveled, and so on.
Since I don't know what you are planning to use the decoded information for, I can't give you any specific guidelines, but consider the XML representation of the state information internal and do not base any application logic on it, since it can change at any point in time.
It can be useful to decode it for troubleshooting though, and to get a general insight in the URL handling of the Portal.

This worked for me...http:server:port/context root/contenthandler?uri=state:

Related

Disable freemarker logs from logs4j

Similar question but i'm using log4j2.
I need a way to disable All logs from freemarker, in their documentation they say we can do it by calling Logger.selectLoggerLibrary(Logger.LIBRARY_NONE) but they say
selectLoggerLibrary must be called early, before FreeMarker could log anything, or else it will not have (consistent) effect.
Where do I call this in a struts2 application? (I tried calling it in prepare() method in my action class but its not working.) or is there any other way to disable the logs?
Question is, why do you need to disable it like that?
You shouldn't need that, so I guess that's where the real problem lies. Is there some kind of malfunction? Because if there isn't, why not just set the freemarker logger category to be ignored in your logger configuration? That's the normal way of doing this, FreeMarker or not.
Anyway, in 2.3.22 (release expected in early 2015) you can use the -Dorg.freemarker.loggerLibrary=none where you start the JVM (that is, you set the org.freemarker.loggerLibrary system property). Otherwise, if you could call that method in a ServletContextListener that's certainly early enough.
Update:
Reacting to the comments... in most applications you will have 3rd party libraries that use various logging "frameworks", like SLF4J, commons-logging, JUL, Log4j, Log4j2. Thus you have to ensure that all these get redirected into the same logger library, which is certainly Log4j2 in your case. I suspect that wasn't properly done in your case, so now multiple logger libraries log to the console, each with its own configuration settings.
FreeMarker 2.3.x uses Log4j 1.x if it detects that org.apache.log4j.Logger is present. Other logger libraries that it also can detect and use (Log4j2 is not amongst them) have lower priority. (FreeMarker 2.4.x will always use SLF4J if it's present.) Thus, if you add org.apache.logging.log4j:log4j-1.2-api to your dependencies, then FM will use org.apache.log4j.Logger, and so log4j-1.2.-api will redirect the FM log messages to Log4j2. That worked for me, with this Log4j2 configuration:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" />
</Root>
<Logger name="freemarker" level="off">
<AppenderRef ref="Console" />
</Logger>
</Loggers>
</Configuration>
This came up as the first search result for "disable freemarker logging" which I searched for because I got double error logs for template errors, one from within the Freemarker library and one from my own code catching the same exception and logging it. The solution to this is simple and different from the answers already given: call setLogTemplateExceptions(false) on the Freemarker Configuration. In full:
Configuration configuration = new Configuration(Configuration.VERSION_2_3_31);
configuration.setLogTemplateExceptions(false);
The default behavior of logging the exception even though it propagates out of the Freemarker library is mentioned as a quirk on the Freemarker Logging documentation.
Use this statement:
freemarker.log.Logger.selectLoggerLibrary(freemarker.log.Logger.LIBRARY_NONE);

Ant tasks don't run IN IzPack installer

.
Hello, everyone
I'm studying IzPack as a tool to be used in a future project and I'm really enjoying it. It's as flexible as I need and makes the process much more easy. I have even submmited a silly pull request at github with a modification I needed to my purposes. Who knows?
Although I don't find it particularly complicated, I've been stuck trying to use a resource for some days. I need that certain Ant Tasks to be executed in certain points of the installation process (right before everything is unpacked is the really one that matters) and that is not working, besides all the efford. :(
My current state, that seems right looking at examples, is the following:
[ My current use of this is based on an example I found here (the docs don't clear too much when It cames to these kind of Actions.]
In my definitions xml file, I included some things:
First, the AntActionsSpect.xml and the .jars, followed by the listeners:
<resources>
...
<res id="AntActionsSpec.xml" src="specs/AntActionsSpec.xml" />
...
</resources>
<jar src="libs/ant/ant.jar" stage="both" />
<jar src="libs/ant/ant-launcher.jar" stage="both" />
<listeners>
<listener classname="AntActionInstallerListener" stage="install" />
<listener classname="AntActionUninstallerListener" stage="uninstall" />
</listeners>
<pack name="test_app" required="yes" installGroups="Application Core">
...
In the specs/AntActionsSpec.xml file, I have the following:
<pack name="test_app">
<antcall order="beforepacks" quiet="no" verbose="yes" buildfile="$INSTALL_PATH/ant-tasks.xml">
<property name="INSTALL_PATH" value="$INSTALL_PATH" />
<target name="touch_beforepacks" />
</antcall>
</pack>
And the ant-tasks.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<target name="touch_beforepacks">
<touch file="$INSTALL_PATH/beforepacks.txt"/>
</target>
</project>
Nothing special here, just creating a dumb file.
The ant-tasks.xml is unpacked right before anyone else. Everything builds with no error, even if I create one "mistake" at AntActionsSpec or ant-tasks.xml, what suggests me that they aren't even been loaded, though if I mess with the path where the definitions file has them, the build will fail.
I would like some help addressing that. I'm probably making some stupid little error and just can't see it by myself. If any of you could provide an example of a running build, that would be sweet.
If I can give any more information, please, let me known so I can update the question.
Thank you very much.
Just found it using a forum on a Google Groups discussion: [izpack-user] Quick question on variable substitution.
Unfortunattly the I will conclude that the docs are misleading. The docs in
"AntActionInstallerListener and AntActionUninstallerListener" until this date are stating that I should use this listener configuration:
<listeners>
<listener classname="AntActionInstallerListener" stage="install" />
<listener classname="AntActionUninstallerListener" stage="uninstall" />
</listeners>
That is what is up there, in the question. Comparing my XML code with the one in the Google Groups discussion, I found a different use of it:
<listeners>
<listener installer="AntActionInstallerListener"
uninstaller="AntActionUninstallerListener" />
</listeners>
In fact, that is the instruction given in the other wiki: Ant Actions (InstallerListener and UninstallerListener), what points out that I something can be wrong under the hood, but that is a story to another episode.
That just works. The Ant tasks are executed properly. :)
I just could not find where freaking Codehaus will allow me to grab a login and edit the docs wiki. >:( . If someone could endorse-me with some testing and then adjust the wiki for future happiness or just give a link to this tired programmer, I'd be happy.

"Orbeon form not found" Error while opening Orbeon 4.5 form

I am working on Orbeon 4.5 forms.
While I try to open the form with a random documentid such as:
http://localhost:8080/orbeon/fr/AppName/formName/edit/randomDocumentId
I am getting "Orbeon form not found" error. I think it's influenced by the document_id.
If my understanding is correct, both the above link and:
http://localhost:8080/orbeon/fr/AppName/formName/edit
should give me the same result.
And I noticed Its working fine in 4.4 with same property file.
Below is my properties-local.xml
<properties xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<property as="xs:anyURI" name="oxf.fr.persistence.mysql.uri" value="/fr/service/mysql"/>
<property as="xs:string" name="oxf.fr.persistence.mysql.datasource" value="orbeonDS"/>
<property as="xs:string" name="oxf.fr.persistence.provider.*.*.*" value="mysql"/>
<property as="xs:string" name="oxf.fr.detail.buttons.app1.*" value="close clear pdf email workflow-send"/>
</properties>
Being a newbie to Orbeon web forms so I am not sure whether I missed any configuration to get this corrected in 4.5
Any inputs to resolve this issue is greatly appreciated.
URLs that look like:
http://localhost:8080/orbeon/fr/AppName/formName/edit/documentId
are meant to load form data with id documentId from the database. If there is no data with that id in the database, it is the correct behavior to get a "page not found" error.
Similarly, you should never be able to access:
http://localhost:8080/orbeon/fr/AppName/formName/edit
without a document id. It is also correct to get a "page not found" error.
To open a form definition without existing data, use instead:
http://localhost:8080/orbeon/fr/AppName/formName/new

how to extract the value of a parameter within a parameter and then print in ant

I want to write a code in such a way that I will remove platform from first 3 lines and then take only the platform name and I will suffix that with installer-zip.${platform_name}.
platform.win-x86=true
platform.win-x64=true
platform.unix=false
installer-zip.win-x86=E:\abc.jar
installer-zip.win-x64=E:\def.jar
Now if the selected item is win-x86 then printing installer-zip.${platform_name} should give me E:\abc.jar. I tried ${installer-zip.${platform_name}} and many other things but they are not working
You cannot do this with regular ant, but you can do this with ant-contrib.
In particular, there is a contrib task property-regex.
So something like:
<propertyregex property="$newProperty"
input="$oldProperty"
regexp="^platform\.(,*)$"
select="\1"
casesensitive="false" />
EDIT: and then...
<property name=desiredProperty value="installer-zip.${newProperty}" />
That should give you enough to work out the exact solution you're looking for...

How do I get javadoc to link to the Java API using an Ant task?

Right now my ant task looks like.
<javadoc sourcepath="${source}" destdir="${doc}">
<link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
</javadoc>
And I'm getting this warning:
javadoc: warning - Error fetching URL: http://java.sun.com/j2se/1.5.0/docs/api/package-list
How do I get the javadoc to properly link to the API? I am behind a proxy.
You can also pass the arguments inside the ant task
<arg value="-J-Dhttp.proxyHost=your.proxy.here"/>
<arg value="-J-Dhttp.proxyPort=##"/>
If going the offline link route. Download the package list by going to the URL of the Java API (http://java.sun.com/j2se/1.5.0/docs/api/package-list) and saving it as a text file and then using this Ant task.
<javadoc sourcepath="${source}" destdir="${doc}">
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistloc="path-containing-package-list"/>
</javadoc>
You probably need the http.proxyHost and http.proxyPort system properties set. For example, ANT_OPTS="-Dhttp.proxyHost=proxy.y.com" ant doc
Alternatively, you could set the "offline" flag and provide a package list, but that could be a pain for the Java core.
You can also use the "offline" mode that allows you to build (faster!) without accessing the internet. Please see this answer: https://stackoverflow.com/a/24089805/366749

Resources