GithubHelp home page GithubHelp logo

sitemesh / sitemesh2 Goto Github PK

View Code? Open in Web Editor NEW
134.0 134.0 89.0 23.17 MB

SiteMesh 2: Official repository

Home Page: http://sitemesh.github.io/sitemesh2/

License: Other

Perl 0.18% Java 87.23% HTML 11.88% FreeMarker 0.04% CSS 0.27% Lex 0.40%

sitemesh2's People

Contributors

balcony-trees avatar bbakerman avatar bspeakmon avatar carlfish avatar codeconsole avatar ebourg avatar farkas avatar jcreenaune avatar joewalnes avatar johnou avatar jroper avatar jtodt avatar mouyang avatar samaxes avatar shartrec avatar spudbean 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  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  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  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  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  avatar  avatar

sitemesh2's Issues

The site mesh decorator not working with special characters

The site mesh decorator is applied for for generic URL pattern like,

<decorator name="wfc_template" page="wfc.jsp">
<pattern>/wf*</pattern>
</decorator>
But the decorator is not applied for specific URL like,

<decorator name="newUI_template" page="newwfc.jsp">
<pattern>/wf/xxx-flow*</pattern>
</decorator>

it seems patterns are not understood by the sitemesh when they contains special characters. In this case it is "-" hyphen between the "xxx" and "flow"

Error Page not Decorated

Hello, I'm using sitemesh for decoration of web page but error page is not decorated by stiemesh. I'm using sitemesh 2.4.2.jar.

Please help.

Thanks.

Hard forked at https://github.com/hazendaz/sitemesh2 - do we want to sync up?

Hi, I see this is coming back to life. I had hard-forked this over at https://github.com/hazendaz/sitemesh2. I used Maven for it and applied nearly everything that was at issue and subsequently released jakarta. I didn't do the same with sitemesh3 as I couldn't ever get it working for my needs. I auto licensed, auto formatted, and did a heavy cleanup clearing any coding issues in general. Its clearly not in a state to merge back but wanted to note this in case that is a consideration. I see this went gradle but its still early...

At the moment, I have it released both as javaEE and jakartaEE

JavaEE -> https://search.maven.org/artifact/com.github.hazendaz/sitemesh/2.5.1/jar
JakartaEE -> https://search.maven.org/artifact/com.github.hazendaz/sitemesh/2.6.0-M1/jar

The javaEE fork is used live in production already. The jarkartaEE while available and others might be using it, I have not released psi-probe on that yet as I ran into some considerations separately with more tomcat work to be done. Hence its marking as M1. It does however work.

Release tagging

The Github project is missing the tags for the previous releases. Could you please add them?

Thank you.

Question: Sitemesh 2 vs 3?

Noticed Sitemesh 2/3 has become active again.
What is the suggested path for new users of sitemesh: 2 or 3?

What caused the project to become active again?

Just Curious.

Sitemesh filter is not finding sitemesh.xml when loaded through Spring-boot

I have a spring boot application with a sitemesh filter being added. When I start the application however, It says that the decorators.xml file could not be found.
Here is the error:

com.opensymphony.module.sitemesh.factory.FactoryException: Cannot construct Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory: java.lang.IllegalStateException: Cannot load excludes configuration file "/WEB-INF/decorators.xml" as specified in "sitemesh.xml" or "sitemesh-default.xml"
    at com.opensymphony.module.sitemesh.Factory.getInstance(Factory.java:51)
    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.initContentProcessor(SiteMeshFilter.java:108)
    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:54)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:722)

I further noticed that if I change the path to the decorators in my sitemesh.xml, the error would remain unchanged, hence showing that the sitemesh.xml isn't being found as well.

I tried adding

filter.addInitParameter("contextConfigLocation", "classpath:/WEB-INF/sitemesh.xml");

however nothing changed

sitemesh.xml and decorators.xml are both located in my WEB-INF directory, which is in the root of my executable jar file

Here is my bean declaration:

    @Bean
public FilterRegistrationBean sitemeshFilter(){
    FilterRegistrationBean filter = new FilterRegistrationBean();
    filter.setName("sitemesh");
    filter.setFilter(new SiteMeshFilter());
    filter.addUrlPatterns("*.html");
    filter.addInitParameter("decorators-file", "/WEB-INF/deco222rators.xml");
    filter.addInitParameter("contextConfigLocation", "classpath:/WEB-INF/sitemesh.xml");
    return filter;
}

Here is the maven build plugin used to create the executable jar

<plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
            <mainClass>my.configuration.javaClass</mainClass>
      </configuration>
      <version>1.1.9.RELEASE</version>
      <executions>
            <execution>
                  <goals>
                        <goal>repackage</goal>
                  </goals>
            </execution>
      </executions>
</plugin>

Note: the error comes up when I try to access a web page, not during startup.

Sitemesh version: opensymphony:sitemesh:jar:2.5

Question on stack overflow available here


Edit

I debugged into the code and, while running from the jar located here :

 C:\my\project\target\__fake.jar

while giving

 servletContext.setInitParameter("sitemesh.configfile", "classpath:/WEB-INF/sitemesh.xml");

In DefaultFactory(line 72) it is resolving configFilePath to

C:\my\project\src\main\webapp\classpath:\WEB-INF\sitemesh.xml

I find this contains the following problems:

  1. it left target__fake.jar and entered \src\main\webapp (there isn't the directoy as i'm compiling to jar)
  2. "classpath:" is part of the file path

This is done using ApplicationContextFacade's getRealPath method

Due to this

Factory (line49) sets instance to null which causes the exception to be thrown in the line after.

Use of deprecated toUrl method makes sitemesh unable to load sitemesh.xml (and possibly other files)

Sitemesh uses the deprecated ".toURL" method to get streams to read files, which warns that special and illegal URL characters are not escaped. I'd like to use the special character '#' in the war name, so that tomcat deploys it to a subfolder, but after converting the path to the sitemesh.xml file to an URL, it's interpreted as an anchor, and it can't load the config files.

The solution is just to replace the call to .toUrl in the file objects to the suggested in the deprecated comment: "toURI().toURL()".

not compatible on java 1.6

If im running on jdk 1.6 class TextEncoder.encode(...) always call method get13Buffer()

....
if (JDK14) {
return get14Buffer(data, encoding);
}
return get13Buffer(data, encoding);
....

Clean out all open issues

Read through all issues in http://jira.opensymphony.com/browse/SIM

Seeing as SM2 is being put into essential-bugfixes-only maintenance mode, many of these can be purged.

  • If it's critical, move it here.
  • If it's releated to SM3, move to SM3 github project.
  • If it's older than a year, bin it.
  • Delete Jira project and update links.

Jakarta version for SiteMesh 2

Hi @codeconsole, do you have any plans to support Jakarta EE 9๏ผŸ
I can help, and release a Jakarta version for SiteMesh 2.
Grace framework 2023 will support SiteMesh 2.x and 3.x.

Page keeps processing if use perticular <button> attribute

Hello,
I had integrated sitemesh 2.4.2 in my web app.
I am decorating pages using meta tag (PageDecoratorMapper) on JSPs. In one of page I came across strange problem. In HTML I have button tag as follow:

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">ร—</button>

Due to this line my page keeps loading. Taking more than 1.5 minute to complete processing. Now if I change this line to:

<input type="button" class="close" data-dismiss="modal" aria-hidden="true" value="x"></input>

same page loads in fraction of second. Strange thing is that I am not decorating this page with meta tag. It should not be considered by sitemesh filter. Following is my theme.jsp for reference:

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<decorator:usePage id="origPage" />
<!--<![endif]-->
<head>
    <%@ include file="ccmrHeadInclude.jsp" %>
    <decorator:head />
</head>
<body>
<% String showHeaders = origPage.getProperty("meta.showHeaders")==null?"true":origPage.getProperty("meta.showHeaders");
System.out.println("Inside decorator");
    if(showHeaders.equalsIgnoreCase("true")){ %>
        <%@ include file="ccmrTopNavigation.jsp" %>
        <jsp:include page="ccmrSubNavigation.jsp"></jsp:include>    
<%}%>

<decorator:body />
<%@ include file="ccmrFooter.jsp" %>

</body>
<%@ include file="ccmrJSInclude.jsp" %>
<decorator:getProperty property="page.pageScript" />
</html>

Move SiteMesh2 website to www.sitemesh.org/sitemesh2

Currently it's running on the creaky old hard to access opensymphony.com server. Merge it with the www.sitemesh.org website that runs on AppEngine.

Old: http://www.opensymphony.com/sitemesh
New: http://www.sitemesh.org/sitemesh2

  • It's probably easier to just copy the content and build into a new site structure, then to pull across the existing infrastructure.
  • Setup permanent redirects on the old site to the new location.
  • Ensure relevant links are updated.

Source for www.sitemesh.org: http://github.com/sitemesh/sitemesh

Stack Trace in console when client closes connection

We are getting large stack traces in our logs whenever a client connection is closed while the server is processing. This can easily be reproduced by simply hitting reload in the browser several times.

The stack trace starts with this:

org.eclipse.jetty.io.RuntimeIOException: org.eclipse.jetty.io.EofException
	at org.eclipse.jetty.server.ResponseWriter.isOpen(ResponseWriter.java:133)
	at org.eclipse.jetty.server.ResponseWriter.write(ResponseWriter.java:202)
	at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:112)
	at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:329)
	at java.base/java.io.Writer.write(Writer.java:249)
	at com.opensymphony.module.sitemesh.parser.FastPage.writeBody(FastPage.java:48)
	at com.opensymphony.sitemesh.compatability.HTMLPage2Content.writeBody(HTMLPage2Content.java:31)
	at com.opensymphony.sitemesh.compatability.Content2HTMLPage.writeBody(Content2HTMLPage.java:44)
	at com.opensymphony.module.sitemesh.taglib.decorator.BodyTag.doEndTag(BodyTag.java:26)
...

We tracked this down to the com.opensymphony.module.sitemesh.taglib.AbstractTag class's trace method.
The com.opensymphony.module.sitemesh.taglib.decorator.BodyTag is catching the exception and then calling trace which prints the stack trace in a way which can not be disabled.

In this particular case, connections being closed is completely normal and we would really like a way to disable these messages.
We would of course want to see actual problems.

It should be possible to run the filter twice when desired

There are valid use-cases that may result in the sitemesh filter running twice (or more) in the context of a single request. One simple example of this involves using JSP pages to render HTML e-mail content. A request that dispatches such an e-mail can retrieve the rendered JSP contents as a string by including it (and wrapping the HttpServletResponse appropriately). Thus it can be desirable to have multiple runs of the sitemesh filter, one for the response that is ultimately sent to the client/browser, and one for each e-mail composed in this manner (because using sitemesh to decorate the e-mails would be extremely convenient).

I think there are a couple of simple ways to support this:

  1. Make 'filterAlreadyAppliedForRequest' protected instead of private. Doing so will allow users to subclass SiteMeshFilter and provide their own implementation that can be made to run more than once per request as desired.
  2. Instead of using the literal key of "com.opensymphony.sitemesh.APPLIED_ONCE" to flag whether or not the filter has been applied, suffix this key with something like the filter's hashCode or the current timestamp (or random number) at instantiation/init-time. That would allow a user who wants to have the filter applied twice in some scenarios to simply set up two instances of it with different filter-mappings (which can/will overlap in some cases). Neither filter would allow itself to be applied more than once per request, but both would be able to coexist side-by-side without one cancelling out the other.

Migrate java.net mailing list and Jive forums to Google Groups

Old: https://sitemesh.dev.java.net/servlets/SummarizeList?listName=users
New: http://groups.google.com/group/sitemesh2-users

Old: https://sitemesh.dev.java.net/servlets/SummarizeList?listName=dev
New: http://groups.google.com/group/sitemesh-team

  • Resubscribe all users on old list.
  • Bonus: Determine if there's a way to import history. If so, kill Jive forums, otherwise leave it in place but set to read only and point to Group.
  • Delete old list and update references.

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.