Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sampathsl committed Mar 9, 2016
0 parents commit 1e1f52a
Show file tree
Hide file tree
Showing 21 changed files with 261 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="docroot/WEB-INF/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_80">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.liferay.ide.eclipse.server.tomcat.runtimeClasspathProvider/Liferay v6.2 CE (Tomcat 7)">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="com.liferay.ide.eclipse.server.plugin.container/hook">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=hotel-url-filter-hook&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=%24%7Bliferay_sdk_dir%3Ahotel-url-filter-hook%7D%2Fivy-settings.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=%24%7Bliferay_sdk_dir%3Ahotel-url-filter-hook%7D%2F.ivy&amp;propertyFiles=">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="docroot/WEB-INF/classes"/>
</classpath>
37 changes: 37 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hotel-url-filter-hook</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.apache.ivyde.eclipse.ivynature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/*.min.js|**/node_modules/*|**/bower_components/*" kind="src" path="docroot"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
7 changes: 7 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
8 changes: 8 additions & 0 deletions .settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="hotel-url-filter-hook">
<wb-resource deploy-path="/" source-path="/docroot" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/docroot/WEB-INF/src"/>
<property name="context-root" value="hotel-url-filter-hook"/>
<property name="java-output-path" value="/hotel-url-filter-hook/docroot/WEB-INF/classes"/>
</wb-module>
</project-modules>
7 changes: 7 additions & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.prefs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<root>
<facet id="liferay.hook">
<node name="libprov">
<attribute name="provider-id" value="com.liferay.ide.eclipse.plugin.hook.libraryProvider"/>
</node>
</facet>
</root>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Liferay v6.2 CE (Tomcat 7)"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="liferay.hook" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
1 change: 1 addition & 0 deletions .settings/org.eclipse.wst.jsdt.ui.superType.container
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
1 change: 1 addition & 0 deletions .settings/org.eclipse.wst.jsdt.ui.superType.name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Window
Empty file added build.gradle
Empty file.
6 changes: 6 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE project>

<project name="hotel-url-filter-hook" basedir="." default="deploy">
<import file="../build-common-hook.xml" />
</project>
3 changes: 3 additions & 0 deletions docroot/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

Binary file not shown.
18 changes: 18 additions & 0 deletions docroot/WEB-INF/liferay-hook.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<servlet-filter>
<servlet-filter-name>CustomURLPatternFilter</servlet-filter-name>
<servlet-filter-impl>com.intervest.portlet.travel.staysure.customefilter.CustomURLPatternFilter</servlet-filter-impl>
<init-param>
<param-name>hello</param-name>
<param-value>world</param-value>
</init-param>
</servlet-filter>
<servlet-filter-mapping>
<servlet-filter-name>CustomURLPatternFilter</servlet-filter-name>
<url-pattern>/travel/hotel/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</servlet-filter-mapping>
</hook>
11 changes: 11 additions & 0 deletions docroot/WEB-INF/liferay-plugin-package.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name=hotel-url-filter
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2.0+
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.intervest.portlet.travel.staysure.customefilter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;

public class CustomURLPatternFilter implements Filter {

@Override
public void destroy() {
LOG.info("#####CustomURLPatternFilter.destroy()");
}

@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws ServletException, IOException {

HttpServletRequest request = (HttpServletRequest) req;
String requestURI = request.getRequestURI();
try {
String[] urlPaths = StringUtil.split(requestURI, StringPool.FORWARD_SLASH);

System.out.println(urlPaths[0]);
System.out.println(urlPaths[1]);
System.out.println(urlPaths[2]);
System.out.println(urlPaths[3]);
System.out.println(urlPaths[4]);
System.out.println(urlPaths[5]);

if (urlPaths.length == 6) {

String forwardPath = "/web/guest/travel/hotel?p_p_id=flightsearch_WAR_hotelportlet&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view"
+ "&_flightsearch_WAR_hotelportlet_param1=" + urlPaths[1]
+ "&_flightsearch_WAR_hotelportlet_param2=" + urlPaths[2]
+ "&_flightsearch_WAR_hotelportlet_param3=" + urlPaths[3]
+ "&_flightsearch_WAR_hotelportlet_param4=" + urlPaths[4]
+ "&_flightsearch_WAR_hotelportlet_param5=" + urlPaths[5];

//http://localhost:8080/web/guest/travel/hotel?p_p_id=flightsearch_WAR_hotelportlet&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&
//_flightsearch_WAR_hotelportlet_param1=Lanzarote&
//_flightsearch_WAR_hotelportlet_param2=Costa%20Teguise&_flightsearch_WAR_hotelportlet_param3=Hotel%20Beatriz%20Costa%20&%20Spa

System.out.println("forwardPath: " + forwardPath);

req.getRequestDispatcher(forwardPath).forward(req, res);
} else {
chain.doFilter(req, res);
}
} catch (Exception e) {
chain.doFilter(req, res);
e.printStackTrace();
}

}

@Override
public void init(FilterConfig filterConfig) {
System.out.println("Called SampleFilter.init(" + filterConfig + ")");
}

private static final Log LOG =
LogFactoryUtil.getLog(CustomURLPatternFilter.class);

}
3 changes: 3 additions & 0 deletions docroot/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
</web-app>
Empty file added docroot/portal-ext.properties
Empty file.
18 changes: 18 additions & 0 deletions ivy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>

<ivy-module
version="2.0"
xmlns:m2="http://ant.apache.org/ivy/maven"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
>
<info module="hotel-url-filter-hook" organisation="com.liferay">
<extends extendType="configurations,description,info" location="../../ivy.xml" module="com.liferay.sdk" organisation="com.liferay" revision="latest.integration" />
</info>

<dependencies defaultconf="default">
<dependency conf="test->default" name="arquillian-junit-container" org="org.jboss.arquillian.junit" rev="1.1.6.Final" />
<dependency conf="test->default" name="arquillian-tomcat-remote-7" org="org.jboss.arquillian.container" rev="1.0.0.CR6" />
<dependency conf="test->default" name="com.liferay.ant.arquillian" org="com.liferay" rev="1.0.0-SNAPSHOT" />
</dependencies>
</ivy-module>
1 change: 1 addition & 0 deletions ivy.xml.MD5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a99ff4f51c7d6d61c3e95d8bed521fdc
15 changes: 15 additions & 0 deletions test/integration/arquillian.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>

<arquillian
xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"
>
<container default="true" qualifier="tomcat">
<configuration>
<property name="jmxPort">8099</property>
<property name="pass">tomcat</property>
<property name="user">tomcat</property>
</configuration>
</container>
</arquillian>

0 comments on commit 1e1f52a

Please sign in to comment.