Coder Social home page Coder Social logo

Comments (11)

gencube avatar gencube commented on September 18, 2024 1

Found out from, UndertowDeploymentProcessor.java:

 TldsMetaData tldsMetaData = deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY);
// and the rabbit holes goes deeper with other dependency.

and also from here, as shown by Stuart Douglas:
https://github.com/undertow-io/jastow/blob/master/src/test/java/io/undertow/test/jsp/taglib/TagLibJspTestCase.java

 Map<String, TagLibraryInfo>  tags = new HashMap<>();
        TagLibraryInfo bugTld = new TagLibraryInfo();
        bugTld.setUri("/bug.tld");
        bugTld.setPath("/bug.tld");
        bugTld.setVersion("2.0");
        bugTld.setTlibversion("1.1");
        FunctionInfo functionInfo = new FunctionInfo();
        functionInfo.setName("dummy");
        functionInfo.setFunctionSignature("java.lang.Runtime getRuntime()");
        functionInfo.setFunctionClass("java.lang.Runtime");
        bugTld.addFunctionInfo(functionInfo);
        tags.put("/bug.tld", bugTld);

        // THIS is where I was pointed to by Stuart 
        JspServletBuilder.setupDeployment(builder, new HashMap<String, JspPropertyGroup>(), tags, new HackInstanceManager());

There should be a constant value hashmap or a way to load JSTL since it is common standard.
Map<String, TagLibraryInfo> tags = new HashMap<>();

from jastow.

gencube avatar gencube commented on September 18, 2024 1

Manual Construction of TagMap is needed and not an effective approach to loading support JSTL.

from jastow.

gencube avatar gencube commented on September 18, 2024

The following dependency had been added to pom.xml

<repositories>       
        <repository>
            <id>redhat.com</id>
            <url>http://maven.repository.redhat.com/techpreview/all/</url>
        </repository>       
    </repositories>

        <!-- Jasper+Undertow for JSP -->
        <dependency>
            <groupId>io.undertow.jastow</groupId>
            <artifactId>jastow</artifactId>
            <version>2.0.0.Beta3</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet.jstl</groupId>
            <artifactId>jboss-jstl-api_1.2_spec</artifactId>
            <version>1.0.6.Final-redhat-1</version>
        </dependency>

from jastow.

ctomc avatar ctomc commented on September 18, 2024

you should be using jboss-jstl-api_1.2_spec version 1.1.x for usage with servlet 3.1 implementations such as undertow.

from jastow.

ctomc avatar ctomc commented on September 18, 2024

pretty much all reason for your problems lies here https://github.com/gencube/Jee7EgJastow/blob/master/src/main/java/mi/webmach/jee/WebXml.java#L95
where you don't configure tld mappings as pass empty map.

for reference you can look at how we configure it in WildFly during deployment
https://github.com/wildfly/wildfly/blob/master/undertow/src/main/java/org/wildfly/extension/undertow/deployment/UndertowDeploymentInfoService.java#L638-L644

from jastow.

gencube avatar gencube commented on September 18, 2024

Hi, Thanks for replying.

HashMap<String, TagLibraryInfo> tldInfo = createTldsInfo(tldsMetaData, sharedTlds);

The code fragment shown is implicating too many dependencies indirectly and I needed to do a wild goose chase.

What do I change this line to make it works?

 JspServletBuilder.setupDeployment(info, new HashMap<String, JspPropertyGroup>(), new HashMap<String, TagLibraryInfo>(), new HackInstanceManager());
// I understand that it is only this portion needed to be change.
HashMap<String, TagLibraryInfo>()

from jastow.

gencube avatar gencube commented on September 18, 2024

What are the values to be placed within these two variables?

TldsMetaData tldsMetaData = ??;
List<TldMetaData> sharedTlds = new ArrayList<>();
sharedTlds.add(??);

from jastow.

gencube avatar gencube commented on September 18, 2024

Hi Thomas,
What is the status of this issue?
Since JSTL 1.2 is a standard library, how do I patch that code into Jastow?

from jastow.

gencube avatar gencube commented on September 18, 2024

This code was newly added, BUT error still exist:

JspServletBuilder.setupDeployment(builder, new HashMap<String, JspPropertyGroup>(), toJSTL() , new HackInstanceManager());
...
public static Map<String, TagLibraryInfo> toJSTL() {
        Map<String, TagLibraryInfo> tags = new HashMap<>();

        String[][] jstlInfos = {
            {"http://java.sun.com/jstl/core_rt", "c-1_0-rt.tld", "1.0", "1.0"},
            {"http://java.sun.com/jstl/core", "c.tld", "1.0", "1.1"},
            {"http://java.sun.com/jsp/jstl/functions", "fn.tld", "1.0", "1.1"},
            {"http://java.sun.com/jstl/fmt_rt", "fmt-1_0-rt.tld", "1.0", "1.0"},
            {"http://java.sun.com/jstl/fmt", "fmt.tld", "1.0", "1.1"},            
            {"http://java.sun.com/jsp/jstl/sql", "sql.tld", "1.0", "1.1"},
            {"http://java.sun.com/jstl/sql_rt", "sql-1_0-rt.tld", "1.0", "1.1"},            
            {"http://java.sun.com/jsp/jstl/xml", "x.tld", "1.0", "1.1"},
            {"http://java.sun.com/jstl/xml_rt", "x-1_0-rt.tld", "1.0", "1.1"}
        };

        for (String[] jstlinfo : jstlInfos) {
            TagLibraryInfo info = new TagLibraryInfo();
            info.setUri(jstlinfo[0]);
            info.setPath("/META-INF/"+jstlinfo[1]);
            info.setVersion(jstlinfo[2]);
            info.setTlibversion(jstlinfo[3]);
            tags.put("/"+jstlinfo[1], info);
        }

        return tags;
    }

from jastow.

hofmanndavid avatar hofmanndavid commented on September 18, 2024

I have a working version of tag discovery for jastow. The current caveat is that it depends on jboss-metadata-web and jboss-metadata-common but I can get rid of them and provide a helper to be used while configuring jastow with undertow via JspServletBuilder.setupDeployment(...).

Something like Map<String, TagLibraryInfo> TldClasspathHelper.find()

@gencube @ctomc Is this something that will be useful to include in jastow for general use?

from jastow.

gencube avatar gencube commented on September 18, 2024

Sorry for the late reply. The answer is yes.

from jastow.

Related Issues (15)

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.