Fóruns

Início » Liferay Portal » English » 2. Using Liferay » General

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Rhina Karr
Pdf file download in webcontent issue
1 de Maio de 2012 07:57
Resposta

Rhina Karr

Ranking: Junior Member

Mensagens: 79

Data de entrada: 1 de Novembro de 2010

Mensagens recentes

Hi Guys,

I am using Liferay 6.1. Currently I am having an issue opening a pdf (inside a webcontent in a page). The pdf is stored in document library. In the web content, there is a hyperlink, which points the pdf, stored in document library. On clicking the pdf, blank page pops up. In the console it shows following error:


ERROR [WebServerServlet:965]
java.io.IOException: Range header does not match regular expression
at com.liferay.portal.kernel.servlet.ServletResponseUtil.getRanges(ServletResponseUtil.java:73)
at com.liferay.portal.webserver.WebServerServlet.sendFile(WebServerServlet.java:960)
at com.liferay.portal.webserver.WebServerServlet.service(WebServerServlet.java:243)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:158)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:247)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:55)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:158)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:55)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:158)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:55)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:158)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:223)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:55)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:197)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Rhina Karr
RE: Pdf file download in webcontent issue
2 de Maio de 2012 11:14
Resposta

Rhina Karr

Ranking: Junior Member

Mensagens: 79

Data de entrada: 1 de Novembro de 2010

Mensagens recentes

Does somebody know what is the meaning of the exception ? Anybody faced this issue?
"java.io.IOException: Range header does not match regular expression"

Do we need any settings for storing files in document library?
Hitoshi Ozawa
RE: Pdf file download in webcontent issue
2 de Maio de 2012 21:15
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7990

Data de entrada: 23 de Março de 2010

Mensagens recentes

Are you trying to hyperlink to a pdf file in Documents and Media library?
That should work because I just tried it.

If you're trying to insert pdf file as an image in Web Content, that would generate an error because pdf is not an image.

If you want to display pdf file in a Web Content, use the "source" mode and enter <object ...> tag to insert pdf in the page.
Christoph Rabel
RE: Pdf file download in webcontent issue
21 de Maio de 2012 06:23
Resposta

Christoph Rabel

Ranking: Regular Member

Mensagens: 130

Data de entrada: 24 de Setembro de 2009

Mensagens recentes

The problem is that some clients/browsers send a range header containing a whitespace
e.g. Range: bytes=2296309-2296502, 173740-2195989
(after the comma)

The regular expression tested in code doesn't allow whitespaces:
private static final String _RANGE_REGEX = "^bytes=\\d*-\\d*(,\\d*-\\d*)*$";

Since the regex doesn't match, the exception is thrown.

if (!rangeString.matches(_RANGE_REGEX)) {
throw new IOException(
"Range header does not match regular expression");
}
Daniel Reuther
RE: Pdf file download in webcontent issue
24 de Maio de 2012 01:26
Resposta

Daniel Reuther

LIFERAY STAFF

Ranking: New Member

Mensagens: 13

Data de entrada: 26 de Junho de 2009

Mensagens recentes

A fix for this has been committed to the repo; we're taking the whitespace into consideration now: ^bytes=\\d*-\\d*(,\\s?\\d*-\\d*)*$

Thanks again for reporting (and debugging) this!
Rhina Karr
RE: Pdf file download in webcontent issue
24 de Maio de 2012 13:43
Resposta

Rhina Karr

Ranking: Junior Member

Mensagens: 79

Data de entrada: 1 de Novembro de 2010

Mensagens recentes

Thanks all for your responses.