Skip to content

Commit

Permalink
Reworked session attachment handler injection.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Nov 29, 2018
1 parent ee3a38a commit 4a0f6fa
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/io/sinistral/proteus/ProteusApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ public class ProteusApplication

@Inject
public Config config;

@Inject(optional=true)
public SessionAttachmentHandler sessionAttachmentHandler;


public List<Class<? extends Module>> registeredModules = new ArrayList<>();

Expand Down Expand Up @@ -280,6 +278,16 @@ public void buildServer()
handler = rootHandler;
}

SessionAttachmentHandler sessionAttachmentHandler = null;

try
{
sessionAttachmentHandler = injector.getInstance(SessionAttachmentHandler.class);
} catch (Exception e)
{
log.info("No session attachment handler found.");
}

if(sessionAttachmentHandler != null)
{
log.info("Using session attachment handler.");
Expand Down Expand Up @@ -586,6 +594,6 @@ public List<Integer> getPorts()
return ports;
}



}
40 changes: 40 additions & 0 deletions src/main/java/io/sinistral/proteus/server/ServerRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,46 @@ public SecurityContext getSecurityContext()
{
return exchange.getSecurityContext();
}

/**
* @return the exchange
*/
public HttpServerExchange getExchange()
{
return exchange;
}

/**
* @return the path
*/
public String getPath()
{
return path;
}

/**
* @return the contentType
*/
public String getContentType()
{
return contentType;
}

/**
* @return the method
*/
public String getMethod()
{
return method;
}

/**
* @return the accept
*/
public String getAccept()
{
return accept;
}
}


Expand Down

0 comments on commit 4a0f6fa

Please sign in to comment.