Skip to content

Commit

Permalink
Merge pull request #1 from kukielp/generics
Browse files Browse the repository at this point in the history
Generics
  • Loading branch information
kukielp authored Apr 28, 2020
2 parents 0552082 + a5b4d1c commit 98a0ad3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 77 deletions.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
4 changes: 2 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Apr 23 13:35:14 AEST 2020
gradle.version=5.5
#Tue Apr 28 12:44:45 NZST 2020
gradle.version=6.1
5 changes: 4 additions & 1 deletion java/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
apply plugin: 'java'
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}

archivesBaseName = 'foundeo-fuseless'

Expand All @@ -11,7 +15,6 @@ dependencies {
'com.amazonaws.serverless:aws-serverless-java-container-core:1.5',
'javax.servlet.jsp:javax.servlet.jsp-api:2.3.1',
'javax.el:javax.el-api:3.0.0',
'com.amazonaws:aws-lambda-java-core:1.2.0',
'com.amazonaws:aws-lambda-java-log4j:1.0.0',
'com.amazonaws:aws-xray-recorder-sdk-core:2.2.1'
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,29 @@
package com.foundeo.fuseless;

import com.amazonaws.serverless.exceptions.ContainerInitializationException;
import com.amazonaws.serverless.proxy.AwsProxyExceptionHandler;
import com.amazonaws.serverless.proxy.AwsProxySecurityContextWriter;
import com.amazonaws.serverless.proxy.ExceptionHandler;
import com.amazonaws.serverless.proxy.RequestReader;
import com.amazonaws.serverless.proxy.ResponseWriter;
import com.amazonaws.serverless.proxy.SecurityContextWriter;
import com.amazonaws.serverless.proxy.internal.testutils.Timer;
import com.amazonaws.serverless.proxy.*;
import com.amazonaws.serverless.proxy.internal.servlet.AwsHttpServletResponse;
import com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler;
import com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequestReader;
import com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletResponseWriter;
import com.amazonaws.serverless.proxy.model.AwsProxyRequest;
import com.amazonaws.serverless.proxy.model.AwsProxyResponse;
import com.amazonaws.serverless.proxy.internal.servlet.*;

import com.amazonaws.services.lambda.runtime.Context;


import com.amazonaws.xray.AWSXRay;
import com.amazonaws.xray.entities.Subsegment;
import org.apache.log4j.Logger;


import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.EnumSet;
import java.util.Enumeration;
import java.util.concurrent.CountDownLatch;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;


import com.amazonaws.xray.AWSXRay;
import com.amazonaws.xray.entities.Segment;
import com.amazonaws.xray.entities.Subsegment;

import java.io.*;
import java.util.concurrent.CountDownLatch;


public class CFMLLambdaContainerHandler<RequestType, ResponseType>
extends AwsLambdaServletContainerHandler<RequestType, ResponseType, AwsProxyHttpServletRequest, AwsHttpServletResponse> {
extends AwsLambdaServletContainerHandler<RequestType, ResponseType, HttpServletRequest, AwsHttpServletResponse> {

private static final Logger LOG = Logger.getLogger(CFMLLambdaContainerHandler.class);

/**
* Returns a new instance of an CFMLLambdaContainerHandler initialized to work with <code>AwsProxyRequest</code>
* and <code>AwsProxyResponse</code> objects.
Expand All @@ -64,44 +42,37 @@ public static CFMLLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> getA
new AwsProxySecurityContextWriter(),
new AwsProxyExceptionHandler()
);

newHandler.setLogFormatter(new ApacheCombinedServletLogFormatter<>());



return newHandler;
}


public CFMLLambdaContainerHandler(Class<RequestType> requestTypeClass,
Class<ResponseType> responseTypeClass,
RequestReader<RequestType, AwsProxyHttpServletRequest> requestReader,
RequestReader<RequestType, HttpServletRequest> requestReader,
ResponseWriter<AwsHttpServletResponse, ResponseType> responseWriter,
SecurityContextWriter<RequestType> securityContextWriter,
ExceptionHandler<ResponseType> exceptionHandler)
throws ContainerInitializationException {
ExceptionHandler<ResponseType> exceptionHandler) {
super(requestTypeClass, responseTypeClass, requestReader, responseWriter, securityContextWriter, exceptionHandler);






}



@Override
protected AwsHttpServletResponse getContainerResponse(AwsProxyHttpServletRequest request, CountDownLatch latch) {
protected AwsHttpServletResponse getContainerResponse(HttpServletRequest request, CountDownLatch latch) {
return new AwsHttpServletResponse(request, latch);
}


@Override
protected void handleRequest(AwsProxyHttpServletRequest httpServletRequest, AwsHttpServletResponse httpServletResponse, Context lambdaContext)
protected void handleRequest(HttpServletRequest httpServletRequest, AwsHttpServletResponse httpServletResponse, Context lambdaContext)
throws Exception {

httpServletRequest.setServletContext(new ServletContextWrapper(getServletContext()));
//httpServletRequest.setServletContext(new ServletContextWrapper(getServletContext()));
RequestWrapper req = new RequestWrapper((javax.servlet.http.HttpServletRequest)httpServletRequest);
req.setAttribute("lambdaContext", lambdaContext);
Object seg = null;
Expand Down Expand Up @@ -151,7 +122,6 @@ protected void handleRequest(AwsProxyHttpServletRequest httpServletRequest, AwsH
}
}


@Override
public void initialize()
throws ContainerInitializationException {
Expand Down
28 changes: 3 additions & 25 deletions java/src/main/java/com/foundeo/fuseless/StreamLambdaHandler.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,16 @@
package com.foundeo.fuseless;

import com.amazonaws.serverless.exceptions.ContainerInitializationException;
import com.amazonaws.serverless.proxy.internal.testutils.Timer;
import com.amazonaws.serverless.proxy.model.AwsProxyRequest;
import com.amazonaws.serverless.proxy.model.AwsProxyResponse;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;


import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.util.EnumSet;

import lucee.loader.servlet.CFMLServlet;
import org.apache.log4j.Logger;

import java.io.File;
import lucee.loader.engine.CFMLEngineFactory;
import lucee.loader.engine.CFMLEngine;
import javax.servlet.*;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServlet;

import com.amazonaws.xray.AWSXRay;
import com.amazonaws.xray.entities.Subsegment;
import com.amazonaws.xray.entities.Segment;


import lucee.loader.servlet.CFMLServlet;
import java.io.*;

public class StreamLambdaHandler implements RequestStreamHandler {
private static final Logger LOG = Logger.getLogger(StreamLambdaHandler.class);
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [[ !$LUCEE_VERSION ]]; then
LUCEE_VERSION=5.3.1.87-RC
LUCEE_VERSION=5.3.5.92-RC
fi

if [ -f "java/jars/lucee-light-$LUCEE_VERSION.jar" ]; then
Expand Down

0 comments on commit 98a0ad3

Please sign in to comment.