top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Accessing HREF Target from Servlet, using tomcat

0 votes
452 views

I have a question. I'm doing some oAuth stuff, and the remote site is redirecting me to:

my_url.html#something=blah&other_thing=blah-blah

I can see this is the url in the redirect of my browser bar.

What I can't figure out is how to access the part of the URL after the pound sign. I've tried getRequestURI(), getPathInfo(), getServletPath(), getPathTranslated(), and nothing is working. Also, the elements are (correctly) not showing up in the parameters collection.

How can I get that part of the URL from inside a servlet? I am using tomcat.

posted Jun 28, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
If I'm understanding things,  the browser is making the request for the page, and then looking for the
HREF target in the generated page. So, the reality is that tomcat never sees the part after the # sign. Rats.

1 Answer

0 votes

Correct. I suppose there's nothing stopping a browser from sending you the "anchor" part of the URL, but it's not really supposed to be part of the resource identifier (the resource is the "page", not the particular place on the page where the user is scrolled-to) so it's pretty much never sent to the server.

Javascript, on the other hand, will likely have access to this information, so you could always make an AJAX request to the server to provide/get more information.

answer Jun 28, 2013 by anonymous
Similar Questions
+3 votes

I want to confirm if my understanding with Hadoop FileSystem object is correct or not. From the source code of org.apache.hadoop.fs. FileSystem (either from version 1.0.4 or 2.2.0), the method

public static FileSystem get(URI uri, Configuration conf) throws IOException 

is using some sort of cache:

CACHE.get(uri, conf); 

My understanding is that Tomcat usually create multiple threads to handle Http requests, and those threads will use the same FileSystem object (because of the cache).

This will resulting in an error, right?

The next question is, if I want to disable the cache, should I just introduce a new key "fs.hdfs.impl.disable.cache" and set the value to "true"?

And another key "fs.har.impl.disable.cache" for HAR FileSystem?

+2 votes

Is there a standard way to access ServletContext from a WebSocket ServerEndpoint ?

0 votes

If one servlet fails to initialize, meaning that ServletContextListener.contextInitialized() throws exception, then Tomcat still starts (but without the servlet).
I found out that if servlet calls System.exit(1), then Tomcat dies. Is this the only way to make this happen?

This does not work:
- Dorg.apache.catalina.startup.EXIT_ON_INIT_FAILURE=true

+3 votes

I have been experiencing missing packets during my application testing using Tomcat Server. If someone can help me to identify what is happening, it will be of great value.

Issue: Few packets do not reach the application servlet but tomcat receives them. The missing packets reach the HTTP layer and thereafter they disappear.

This issue is not frequent but occasionally consistent. For the POSTs of missing packet I am not able to find the entry in localhost_access_log.

Version: apache-tomcat-7.0.42
Application entry point: Servlet
OS: Windows 7(32 bit)

0 votes

Is it true that current servlet-based websocket implementation will be deprecated due to the implementation of the JSR-356. We are currently implementing a Tomcat 7-based websocket server implementation that we hoped could scale up to at least 50K concurrent connections [or more], but are concerned if there are any known issues and/or limitations with the websocket implementation in Tomcat 7.

We are currently trying to test how high Tomcat 7 will scale with regards to the maximum number of concurrent websocket connections, but have already hit some problems with only 200 concurrent connections. Perhaps it's our multi-threaded client, or Tomcat configuration - not sure at this point. We have the Tomcat Connector configured with maxConnections=50000 and maxThreads=1000, so 200 concurrent connections shouldn't be a problem.

If anyone could elaborate on the Tomcat 7 servlet websocket implementation stability from a highly concurrent aspect that would be great. Additionally, if anyone has achieved 10(s) of 1000(s) of concurrent websocket connections with Tomcat 7, can you share how Tomcat was configured, what OS it was running on, and what client library you used in testing this?

...