Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty-maven-plugin 9.4.x session handling

Hi
Issue created here https://github.com/eclipse/jetty.project/issues/1576
I will propose a solution in the coming days.
Filipe maybe you have ideas?

On Sat, May 27, 2017 at 5:49 PM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
Filipe,

You could use a small context xml file to do the necessary configuration instead and apply it in the plugin.

The context xml file would look like:

<Configure id="testWebapp" class="org.eclipse.jetty.webapp.WebAppContext">
  <Get id="sh" name="sessionHandler">
    <Set name="sessionCache">
      <New class="org.eclipse.jetty.server.session.DefaultSessionCache">
        <Arg><Ref id="sh"/></Arg>
        <Set name="sessionDataStore">
          <New class="org.eclipse.jetty.server.session.FileSessionDataStore">
             <Set name="storeDir">
               <New class="java.io.File">
                 <Arg>/tmp/jetty-sessions</Arg>
               </New>
             </Set>
          </New>
        </Set>
      </New>
    </Set>
  </Get>
 </Configure>


And appy it to your plugin in the pom like:

<configuration>
   <contextXml>/where/I/put/my/contextxml
</configuration>


Maven configuration that requires empty constructors of complex objects are painful - there's a few places in jetty where good coding practice dictates a non-empty constructor and the session stuff is one of them.  Maybe Olivier or yourself can think of some code for the jetty maven plugin that would make it easier to integrate the session stuff?

Jan

On 27 May 2017 at 00:28, Filipe Sousa <natros@xxxxxxxxx> wrote:
This is what I have been doing with jetty-maven-plugin 9.3.x to keep sessions with hot reload

      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.3.17.v20170317</version>
        <configuration>
          <httpConnector>
            <host>localhost</host>
            <port>${jetty.port}</port>
          </httpConnector>
          <reload>manual</reload>
          <jettyXml>${project.basedir}/src/main/etc/jetty.xml</jettyXml>
          <webApp>
            <contextPath>/candidaturas</contextPath>
            <webInfIncludeJarPattern>.*/webjars/.*\.jar$</webInfIncludeJarPattern>
            <containerIncludeJarPattern>^$</containerIncludeJarPattern>
            <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
              <resourcesAsCSV>${project.basedir}/src/main/webapp,${project.basedir}/../target/gwt/launcherDir</resourcesAsCSV>
            </baseResource>
            <sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler">
              <sessionManager implementation="org.eclipse.jetty.server.session.HashSessionManager">
                <storeDirectory>${project.basedir}/target/jetty-sessions</storeDirectory>
              </sessionManager>
            </sessionHandler>
          </webApp>
        </configuration>
      </plugin>

What is the equivalent to handle the sessions in 9.4.x?

Thanks
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Olivier

Back to the top