top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to access JNDI Directory Context in Tomcat 8

+1 vote
395 views

I want to access the JNDI Directory context in Tomcat8. I've used DirContextURLStreamHandler class which was in Tomcat 7. But now that has been removed.

Can someone tell me how can I access the JNDI Directory Context in Tomcat 8?

posted Mar 9, 2015 by Meenal Mishra

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

I am just trying upgrade tomcat 7 to latest GA 8 for my application, I am seeing quite lots of change in web dav functionality.

The org.apache.naming.resources.ProxyDirContext do not exists do anybody know where I can find the alternative? in the past we got use resource to lookup something but now is not this one, can anybody know any doc?

0 votes

I have a questions regarding the Non Blocking API introduced in Tomcat 8. I'm looking at the TestNonBlockingAPI test as an example, specifically the NBReadServlet class.

@WebServlet(asyncSupported = true)
public class NBReadServlet extends TesterServlet {
 private static final long serialVersionUID = 1L;
 public volatile TestReadListener listener;
 @Override
 protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 // step 1 - start async
 AsyncContext actx = req.startAsync();
 actx.setTimeout(Long.MAX_VALUE);
 actx.addListener(new AsyncListener() {
 // removed for brevity 
 });
 // step 2 - notify on read
 ServletInputStream in = req.getInputStream();
 listener = new TestReadListener(actx);
 in.setReadListener(listener);

 listener.onDataAvailable();
 }
}

My question is why does the test call "listener.onDataAvailable()" at the end?

In regards to the "onDataAvailable()" method, Section 3.7 of the spec says…

"The onDataAvailable method is invoked on the ReadListener when data is available to read from the incoming request stream. The container will invoke the method the first time when data is available to read. The container will subsequently invoke the onDataAvailable method if and only if isReady method on ServletInputStream, described below, returns false."

...which leads me to believe that the container should be calling onDataAvailable and not the servlet.

As a side note, my test works if I call "onDataAvailable()" from my test servlet. Otherwise it fails and times out.

+1 vote

I'm trying to figure out how to get access to the cookies and headers passed up in the Websocket handshake request on Tomcat 8.

In Tomcat 7 the whole HttpServletRequest was passed into the WebSocketServlet. createWebSocketInbound method so it was easy to grab from the request headers. In Tomcat 8 the querystring and URI are both exposed by the javax.websocket.Session passed to ServerEndPoint.onOpen, but I don't see a mechanism for getting the cookies or headers.

We are integrating Websocket connections into an existing web app and want to use the cookies set by our web app in the Websocket connection process.

0 votes

I'm using Tomcat6 on my web application which is running on Windows Server 2003 Standard Edition. I want to access static files (PDF) in the remote directory on the disk server (NetApp) through http address from web browser. I tried to use Windows shortcut, but It didn't work. Seems that Tomcat recognize a shortcut as a common file (.lnk) instead of a soft link. How can I access it properly through http in the IE browser?

I can only access the files if the static files are put in the local disk. I tried to use hard link and junction, but they work only on the local disk (on the same computer). I tried to modify context.xml, but it didn't succeed.
Most of the solution in the internet is a soft link from local disk to local disk.

...