Skip to content

Support JSP with Embedded Jetty. #5290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

tsachev
Copy link
Contributor

@tsachev tsachev commented Feb 29, 2016

With this change it is now possible
to create executable wars with embedded jetty
that use Jsp.

I have also sample for jetty 9.3 to add, but it is blocked by #5287

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 29, 2016
@ghillert
Copy link

ghillert commented Mar 9, 2016

@tsachev Looks like executable jars work also (?).

@tsachev
Copy link
Contributor Author

tsachev commented Mar 11, 2016

Did not tried that, but would be cool if so.

@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 29, 2016
@philwebb philwebb added this to the 1.4.0.M2 milestone Mar 29, 2016
@janbartel
Copy link

@tsachev those changes look good to me from the jetty perspective. The only quibble I have is that the spring-dependencies contain both org.eclipse.jetty:apache-jsp and org.mortbay.jasper:apache-jsp, where the former already has the latter as a transitive dep. Is this because you want release 8.0.27 of org.mortbay.jasper:apache-jsp instead of 8.0.9? If so, I will see if I can get a jetty-9.2.16 release done so that you can remove the duplicate dependency and then spring-boot should be able to use this pull request.

@tsachev
Copy link
Contributor Author

tsachev commented Apr 1, 2016

@janbartel Yeah I could not make it work with 8.0.9.M3. That's why I decided to fix this in spring boot dependencies until a version of jetty 9.2.x is released with jetty/jetty.project#371.

@philwebb philwebb modified the milestones: 1.4.0.M3, 1.4.0.M2 Apr 6, 2016
@janbartel
Copy link

@tsachev I've released jetty-9.2.16 so you can update your pull request and jsp should work with jetty in spring-boot.

@tsachev
Copy link
Contributor Author

tsachev commented Apr 20, 2016

@janbartel Thanks, will do so.

@tsachev
Copy link
Contributor Author

tsachev commented Apr 20, 2016

@janbartel I have updated the PR.
now with #5287 merged I also added the jetty 9.3 jsp sample.
@wilkinsona do you think that jetty version bump should be done in another PR?

@wilkinsona
Copy link
Member

@tsachev I've done the Jetty upgrade

With this change it is now possible
to create executable wars with embedded jetty.

Fixes spring-projectsgh-367
@philwebb philwebb modified the milestones: 1.4.0.RC1, 1.4.0.M3 May 14, 2016
@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label May 25, 2016
@bclozel bclozel self-assigned this May 26, 2016
@bclozel bclozel removed the for: team-attention An issue we'd like other members of the team to review label Jun 14, 2016
@bclozel bclozel closed this in b303b3f Jun 15, 2016
bclozel added a commit that referenced this pull request Jun 15, 2016
* pr/5290:
  Support JSPs in Embedded Jetty
wilkinsona added a commit that referenced this pull request Jun 15, 2016
The JVM only allows URL.setURLStreamHandlerFactory to be called once.
This is problematic as the JSP support in embedded Tomcat and embedded
Jetty both call this method.

This commit uses reflection to null out URL’s factory field before and
after the embedded Jetty tests have run. This ensures that they can
run successfully if Tomcat has already installed its factory and that
Tomcat-related tests can also run afterwards.

See gh-5290
wilkinsona added a commit that referenced this pull request Jun 15, 2016
This is a follow-on from d341499 that takes a broader approach to
clearing URLs URLStreamHandlerFactory.

See gh-5290
wilkinsona added a commit that referenced this pull request Jun 16, 2016
Jetty 9.3 no longer has a jetty-jsap artifact and dependency
management for it was removed in ff602e6. It was inadvertently
reintroducved in b303b3f. This commit removes it again.

See gh-5290
See gh-5825
@nyilmaz
Copy link

nyilmaz commented Jun 27, 2016

@ghillert @tsachev It does not work with jar packaging. Resulting artifact does not contain any jar files. What would be the approach here? Maybe change spring-boot-maven-plugin's packaging process?

@wilkinsona
Copy link
Member

@nyilmaz We know it doesn't work with jar packaging. In the section on JSP limitations, the documentation says:

With Jetty it should work if you use war packaging, i.e. an executable war will work, and will also be deployable to any standard container.

The best approach is not to use JSPs. Failing that, war packaging will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants