You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by Apache Wiki <wi...@apache.org> on 2005/07/06 00:07:41 UTC
[Xmlgraphics-batik Wiki] Update of "Pack200" by StanDickerson
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Xmlgraphics-batik Wiki" for change notification.
The following page has been changed by StanDickerson:
http://wiki.apache.org/xmlgraphics-batik/Pack200
New page:
##language:en
== Pack200, Applets and Java Plug-in ==
The following URL covers using pack200 compression in Java 1.5:
["http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html"].
However, the sample servlet from that page had to be modified for use with the Java Plug-in.
=== Revised partial doGet() ===
{{{
/** Called when someone accesses the servlet. */
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
String encoding = request.getHeader(ACCEPT_ENCODING);
String pathInfo = request.getPathInfo();
String pathInfoEx = request.getPathTranslated();
String contentType = request.getContentType();
String contextPath = request.getContextPath();
String requestURL = request.getRequestURL().toString();
String requestName = pathInfo;
ServletContext sc = getServletContext();
String realPath = sc.getRealPath("");
sc.log("----------------------------");
sc.log("pathInfo="+pathInfo);
sc.log("pathInfoEx="+pathInfoEx);
sc.log("Accept-Encoding="+encoding);
sc.log("Content-Type="+contentType);
sc.log("contextPath="+contextPath);
sc.log("realPath="+realPath);
sc.log("requestURL="+requestURL);
try
{
URL url = new URL(requestURL);
sc.log("url file="+url.getFile());
if (pathInfoEx == null) {
int ndx = realPath.indexOf(contextPath);
if (ndx > 0)
{
String file = url.getFile();
String path = realPath.substring(0, ndx)+file;
sc.log("path="+path);
pathInfoEx = path;
ndx = file.indexOf(contextPath);
if (ndx == 0)
{
pathInfo = file.substring(contextPath.length());
sc.log("new pathInfo="+pathInfo);
}
}
}
}
catch (Exception ex) { sc.log("url "+ex); }
if (pathInfoEx == null) {
sc.log("----------NOT FOUND---------");
response.sendError(response.SC_NOT_FOUND);
return;
}
String outFile = pathInfo;
...
}}}