GWT: example of an "Admin" and "Normal-mode" application - gwt

I am using GWT (and GWT-Plateform) and GAE, and I would like to have an Admin and a Normal-mode of my application.
I read this post https://turbomanage.wordpress.com/2009/11/19/tips-on-organizing-gwt-modules/#comment-5064 and I would like to see a complete project structure of an application using an Admin and a Normal-mode application. Do you know any sample code of this case (with GWT and GAE if possible...and with GWTP would be perfect) ?
In the link, M. Chandler says that I could have 3 modules (admin, app, common) and just 2 entry point (admin and app). Admin and app inherits common. But I do not know more stuffs such as :
- I am using "Client Bundle" so will it be possible to have my resource folder just inside the "common module". Will it works ? Do I need just one CSS for the 2 modules (admin and normal-mode) ?
- Does my whole domain model needs to be in the common module ?
Any recommendation about how to structure a code with an Admin module using GWT is welcome.
My current problem is that I do not know how to do this with Eclipse (should I copy paste the "client", "server", "share" folders of the "app" package and to add them in a new package named "admin" and then to delete and modify some files ? It seems complicated...or is there just some minimal files and configurations to do ?)
Thanks you,

It's quite easy...
check this link: https://developers.google.com/appengine/docs/java/config/webxml#Security_and_Authentication
You need two entry points.
First for Normal-Mode
Second for Admin-Mode
Everything for admin mode is unter the path /admin/...
In the web.xml you configure now the security constraints in web.xml:
<security-constraint>
<web-resource-collection>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
For the user registration and login control you can use the USERS-Api from Google:
https://developers.google.com/appengine/docs/java/users/overview

Related

ATG CRS changing context root causes raw JSP to display

I am working on ATG 10.1.2 with Endeca 3.1.2 with the CRS app. Here is what I've done so far.
wanted to change my context root to /mystore
I changed the contexts in web.xml, application.xml and MANIFEST.MF entry for CommerceReferenceStore, subsequently changed my site configuration for one of the CRS stores to have my custom baseUrl and production URL.
In my case I am not using path based multi-site approach. my baseUrl and production Url are same. If I start my application, all pages are coming fine. However, when I try to browse the category pages (cartridges), the JSP's code is displayed on the browser, they do not compile.
I found some solution on oracle community that I should remove the FORWARD dispatcher from PageFilter from my web.xml, and that should solve the issue. I did that, now the page compiles, but intermittent raw JSPs are displayed along with JSP comments on the browser.
Below threads might give you some context on my issue.
https://community.oracle.com/thread/2508338
https://community.oracle.com/thread/3518254
Has someone tried it and have a solution, please share your inputs.
Would suggest you look at your configuration for these components as changing the context root might require configuration changes to:
ContentItemToRendererPath in the ATG documentation
The getRendererPathForContentItem() method returns the web-app relative path of the JSP file used to render the ContentItem.
/atg/endeca/servlet/request/NucleusHttpServletRequestProvider which provides access to the endeca components
/atg/endeca/assembler/AssemblerPipelineServlet with a full explanation here.
Try to add REQUEST and ERROR as well to the dispatcher element.
If you have ...
<filter>
<filter-name>PageFilter</filter-name>
<filter-class>atg.filter.dspjsp.PageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PageFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
then change it to...
<filter>
<filter-name>PageFilter</filter-name>
<filter-class>atg.filter.dspjsp.PageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PageFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Sorry for posting the answer to this after so long.
This was an issue with Oracle Commerce itself. You should try to get a patch for it from Oracle, if you see this on Oracle Commerce version 10.x

Jboss, setting environment variables for application

I've been setting up my rails application to run under jruby/warbler inside a java container (JBoss/wildfly). I'm used to running my rails apps on linux machines, more or less with init.d scripts and the like, and I've been using DATABASE_URL to set the connection without putting my credentials in the source.
Warbler itself is created a pre-packaged WAR, I can deploy that to wildfly(jboss) fine.. but there is no examples of how to set environment variables in the context of that application.
I've googled links, but they are cryptic as hell, there's even a stack overflow question here, but the accepted answer seems to be make your own service between to do this?.
Is there an easy way to pass config to wars in jboss?, or do all java enterprisey applications just store the credentials/urls in the war themselves O.O
You could setup a datasource on the application server
https://docs.jboss.org/author/display/WFLY8/DataSource+configuration
And in your application you will need to use ActiveRecord-JDBC-Adapter
https://github.com/jruby/activerecord-jdbc-adapter
Or you can also set environment variables in the application servers's startup script (bin/standalone.sh or bin/domain.sh)
if you're using Warbler (JRuby-Rack) the environment can be isolated using a context-parameter setting in the deployment descriptor e.g. :
<context-param>
<param-name>jruby.runtime.env</param-name>
<param-value>
DATABASE_URL=mysql://192.168.1.11/mydb
PATH=/usr/local/bin,HOME=/home/tomcat
</param-value>
</context-param>
it's pretty easy to set with Warbler's configuration file (generate one at config/warbler.rb using warble config)
https://github.com/jruby/jruby-rack/wiki/ENV-Isolation#warbler

DataSourceSecurityFilter Eclipse Scout

I am working on a server-client program using the Eclipse Scout framework. I have Java experience, but my expierence regarding Tomcat is not existing.
I want to write an application which asks for my login information. Using the DataSourceSecurityFilter i want to autherise a user in the program (reading his username and password from the database). My server config.ini looks like this:
### Service Runtime Configuration
org.eclipse.scout.rt.server.services.common.file.RemoteFileService#rootPath=/Users/wgvanveen/Documents/workspace/ledenbeheer.server/j2ee/ear/war/WEB-INF/remotefiles
### Servlet Filter Runtime Configuration
org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter#active=false
org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter#realm=ledenbeheer Development
org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter#users=admin\=manager,allen\=allen,blake\=blake
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#active=false
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#realm=TEST APPLICATION
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#jdbcDriverName=com.mysql.jdbc.Driver
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#jdbcMappingName=jdbc:mysql://localhost/Leden
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#jdbcUsername=root
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#jdbcPassword=root
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#selectUserPass=SELECT LOWER(Gebruikersnaam) FROM Gebruikers WHERE LOWER(gebruikersnaam)=? AND PASSWORD=?
org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter#active=true
I have added to the server plugin the following:
<filter
aliases="/process"
class="org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter"
ranking="40">
</filter>
I have no clue why this doesn't work. I have followed the instructions from : http://wiki.eclipse.org/Scout/Concepts/Security
I am running Eclipse Juno with Scout 3.8
It looks like the wrong filter is active.
org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter#active=false
org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter#active=true
Try to activate the data source filter and deactivate the anonymous filter. If it doesn't work, I suggest you post the question at the official scout forum at http://www.eclipse.org/forums/index.php?t=thread&frm_id=174.

references to SystemProperties in web.xml and jboss-web.xml works in JBoss5 but not in JBoss7

Under JBoss 5.1 we used to "stage" values in the web.xml and the jboss-web.xml by using SystemProperties. In the web.xml that looked like this:
<web-app [...]>
[...]
<auth-constraint>
<role-name>${myRole}</role-name>
</auth-constraint>
[...]
<login-config>
<auth-method>${myAuthMethod}</auth-method>
</login-config>
<security-role>
<role-name>${myRole}</role-name>
</security-role>
</web-app>
Additionally we did the same thing for the jboss-web.xml and the security-domain. Not adding the concrete values is crutial because the WAR-modules we did that are generated by our code generator.
JBoss 7 does not replace these values any more - which is correct according to the spec but in our case quite uncomfortable.
Any ideas how one could:
do some kind of replacement at runtime?
refreign having to replace those values at runtime?
... ?
See https://issues.jboss.org/browse/AS7-3816.
The fix for system property substitution for ejb-jar.xml is going to JBoss AS 7.1.2.
You can check the source or contact the assignee to ensure that is also going to be also fixed for web.xml. Even if it's not yet, it should be possible to convince Bartosz Baranowski to fix it too.
Update
https://issues.jboss.org/browse/AS7-4479 - we've been heard :)
Definitely not my forté, but you might want to look at the migration guide. There also might be some useful information in the authentication documentation.
polemoser - according to which specs? Im waiting for issue to be merged into master before fixing any other related.

Jetspeed null PortletDefinition

I am running a jetspeed portal which contains various portlet applications and have come across an issue after a recent reinstall where some of the portlets will return
Cannot pass a null PortletDefinition
to a PortletEntity
Any idea what is causing this issue? I investigated a bit and it seems that jetspeed runs a process when new portlets are added where it creates mappings in its DB (derby in my case). If this does not complete it seems to cause this problem. Is my assumption correct? If yes, how can I restart this process?
Many thanks
This exception can be caused by having a mismatched portlet name on on your page. This often happens when the portlet application is deployed with one name, but then the page fragment references another name, for example, on your page you have:
<fragment id="1234" type="portlet" name="myApp::myPortlet">
and when you deploy your war file, it is named for example myApp-1.0-SNAPSHOT.war
The fragment's name attribute should have the value "${portlet.war.name}::${portlet.name}. The first part (${portlet.war.name}) is the name of the portlet war file, minus the .war. The second part comes from the value of the tag in the portlet.xml file.
You can either rename your war file, or change your page definition to include the version. I don't recommend putting the version number in the fragment though, as it can change.
A third solution is to actually change the name of the portlet app in your web.xml by setting an init param named contextName on the Jetspeed Container servlet. In the example below its set to "myApp":
<servlet>
<description>MVC Servlet for Jetspeed Portlet Applications</description>
<display-name>Jetspeed Container</display-name>
<servlet-name>JetspeedContainer</servlet-name>
<servlet-class>
org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
<init-param>
<param-name>contextName</param-name>
<param-value>myApp</param-value>
</init-param>
<load-on-startup>100</load-on-startup>
</servlet>