Giter VIP home page Giter VIP logo

Comments (11)

sapessi avatar sapessi commented on September 24, 2024

The url there seems to be urlencoded. The framework itself does not do any url encoding, it simply returns the response body as a string: https://github.com/awslabs/aws-serverless-java-container/blob/master/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletResponseWriter.java#L42

Can you share some code on how the html is generated and returned? would be good to log some info along the way:

  1. When the html is generated
  2. Before the AwsProxyResponseis returned to API Gateway
  3. What comes to the client

from aws-serverless-java-container.

gmaruti avatar gmaruti commented on September 24, 2024

PlaceListPage.txt

Attached the HTML page (changed extension to .txt)

I have Spring Controller bean that returns the html

`
@RequestMapping("/places")

public String places() {
      ....

      String url = "PlacesListPage"; // PlacesListPage.html is present under templates directory

      return url;

 }

`

Above controller is called through API gateway. Right now the HTML page is being displayed to client but URLs with in the page are encoded.

In another scenario I have redirection to external URL

`
@RequestMapping("/link")

public String link() {

      ....
      String url = "redirect:<external URL>"; 

      return url;

 }

`
In this case on browser i see an encrypted URL and 404 message

Hope this helps to explain the issue more clear.

from aws-serverless-java-container.

sapessi avatar sapessi commented on September 24, 2024

Thanks @gmaruti. Just to confirm, if you start the spring app on your local machine the url is returned correctly?

Take a look at the answer here: http://stackoverflow.com/questions/14938344/thymeleaf-construct-url-with-variable

from aws-serverless-java-container.

gmaruti avatar gmaruti commented on September 24, 2024

Yes, it does work in local...

from aws-serverless-java-container.

sapessi avatar sapessi commented on September 24, 2024

Is there any chance I can get access to the demo app to replicate? I cannot find a place where the framework would be urlencoding something. The only place where we url encode is in the response here: https://github.com/awslabs/aws-serverless-java-container/blob/master/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java#L99

from aws-serverless-java-container.

sapessi avatar sapessi commented on September 24, 2024

never mind. I managed to replicate the issue. I will look into it and let you know.

from aws-serverless-java-container.

sapessi avatar sapessi commented on September 24, 2024

I located the issue in the LinkExpression class. When processing the link, it returns a URL encoded expression if the response is not null:

return response != null?response.encodeURL(url):url;

I'll investigate this comparing how the embedded container in spring boot behaves.

from aws-serverless-java-container.

sapessi avatar sapessi commented on September 24, 2024

@gmaruti I have committed a fix to the servlet-improvements branch. This fixes the issue for me. If you can, clone the branch, mvn install in local, change your pom to use 0.5-SNAPSHOT and test if this fixes the issue for you.

from aws-serverless-java-container.

gmaruti avatar gmaruti commented on September 24, 2024

Thanks, I will check and let you know...

from aws-serverless-java-container.

gmaruti avatar gmaruti commented on September 24, 2024

@sapessi I tested the code and it worked for me too!!.. Thanks for quick fix.

from aws-serverless-java-container.

sapessi avatar sapessi commented on September 24, 2024

Nice. I will close this and merge

from aws-serverless-java-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.