Giter VIP home page Giter VIP logo

mason's People

Contributors

ancode4 avatar biswas05 avatar d3ep4k avatar dependabot[bot] avatar kaisteel avatar metamug2 avatar richard937 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mason's Issues

Internal Resource call

some of my resources need to call other resources and use their output. I can use xrequest to achieve this but is there a better way to do this ?

Calling Java Code in jsp

How can we execute some logic. Using scriptlets would be a bad idea. What is the preferred mechanism for it ?

JSON passed in form body is flattened

When I try to pass the JSON in form body, the JSON is flattened. Can't use the flattened JSON in SQL nor Code Execution.

eg- form-body

{"foo":{"bar":123}}

is then converted to

{"foo.bar":123}

Add mason resources in a separate folder in WEB-INF

Currently, the resources are kept directly in under /WEB-INF/resources. This may conflict with other top level folders in WEB-INF. Also other folders will be created for mason.

Ideally it should be

/WEB-INF/mason/resources
/WEB-INF/mason/sql.properties

Filter Chaining to handle root request and authentication

index-filter--->authentication-filter--->resource-filter

All these filters will contain special logic if they don't meet chain.doFilter
Right now all the code seems to be stuffed into rest router. F ilter chaining will cut short
so if its a root filter it will check for index, docs, and method calls on the root.
if not, it chains to the next filter that is authentication filter.
if that fails it will return an error. or if that passes it will take to resource-filter. To resolve which resource is requested and resolve that.

Move table based configuration to web.xml param

Initialize

<servlet>
     <servlet-name>Router</servlet-name>
     <init-param>
         <param-name>MTG_AUTH_BASIC</param-name>
         <param-value>
         <![CDATA[
             select r.user_id,r.role_name 
             from usr_role r inner join usr u on r.user_id=u.user_id 
             WHERE u.user_name=$user AND u.pass_word=$pass
         ]]>
         </param-value>
     </init-param>
     <init-param>
         <param-name>MTG_AUTH_BEARER</param-name>
         <param-value>
         <![CDATA[
             SELECT r.user_id as sub,r.role_name as aud 
             FROM usr_role r inner join usr u on  r.user_id=u.user_id 
             WHERE u.user_name=$user AND u.pass_word=$pass
         ]]>
         </param-value>
     </init-param>
</servlet>

https://stackoverflow.com/a/28393315/1097600

Cors is disabled

cors won’t allow them to access web apps on other domain. Cors config should be part of response. Based on context param. It will be set in ResourceTag

Invalidate JWT tokens

Jwt tokens live as long as they are valid. Need a mechanism to forcibly invalidate them.

File Exists Check in each request

Resource file exists check in each resource request. It works well when it's a 404. But for a normal request which is mostly the case, this check seems extra. It should let the container handle the 404.

Incorrect iat and exp

{
"sub": "1",
"aud": "baz",
"iss": "mason.metamug.net",
"exp": 1561449866,
"iat": 1553654066094,
"jti": "81cd5a36-fefb-4407-996e-b74939cd9faf"
}

"iat": 1553654066**094** this is extra

Get 512 while triggering UploadEvent during file Upload

Describe the bug
I tried using the UploadEvent feature to process file that I've uploaded. But every time I hit API to upload the file it returns 512. Described below steps to reproduce the error.

To Reproduce
Steps to reproduce the behavior:

  1. Create a backend.
  2. Upload a maven project containing a class that implements UploadListener interface
  3. Create a Resource file containing a POST request.
  4. Try uploading a file on the resource created at Step 3.

Here is the error message I get:
error_message

System Info:

  • OS: Win-8.1x64
  • Metamug Version: 0.6.1

Custom template format for JSON output

I have requirement where the json structure should look like

{   
    "data":[],
    "message":"There is no data available",
    "timestamp":1534861617520,
    "status":false
}

Is there any provision to set my own template, so I can get all data in an attribute? I would like this structure to be retained even in case of an error.

Delay in response

There is a delay in response occasionally and following logs are obtained

[http-nio-8080-exec-2] WARN com.zaxxer.hikari.pool.PoolBase - masonSamplePool - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@3ad981f9 (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.

Access Query Result inside Code

<m:request method="GET">
       <sql:query var="result" dataSource="${datasource}"> SELECT * from customer </sql:query>  
       <c:set target="${masonOutput}" property="getReq1" value="${result}"/>
</m:request>

How can I pass the result to code execute tag?

Reusing sql written in another resource

Currently mason doesn’t allow a mechanism to reuse queries. I have to rewrite same queries multiple times in different resources and may be in same resource for different methods.

Load Queries in Router Init

Loading Queries don't need a context listener. They can be loaded when the router gets initialized(servlet init method). This will save an extra configuration in web.xml

Unterminated XRequest tag 422

<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
      <XRequest id="testReq" url="https://jsonplaceholder.typicode.com/todos/1"
                         method="GET" persist="false" >
             <Header name="Accept" value="application/json" />                
      </XRequest>
  	  <Query>select $header.Server </Query>  
</Request>
</Resource>

The above resource returns

{"message":"/WEB-INF/resources/v1.0/z.jsp (line: [6], column: [136]) Unterminated [&lt;mtg:xrequest] tag","status":422}

Fix response format for single result

Single result output is wrapped inside an extra array which is unnecessary:
‘’’
[
[
{
"customer_name": "Adam Smith",
"customer_id": 1
},
{
"customer_name": "John Doe",
"customer_id": 2
}
]
]
‘’’

Put mason on maven central

I cannot include mason as dependency in my maven project. Can someone please put this on maven central repo.

Configurable REST resource endpoint

User should be able to configure the endpoint for REST API created using Mason.
Currently, the generated endpoint looks like
(eg: /appname/v1.0/customer)

The user should be able to add a custom path after his app name
(eg: /appname/api/v1.0/customer)

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.