2022
我们一起努力

apache静态资源(apache配置静态资源目录)

本文目录:

  • 1、有了glassfish后还需要和apache整合吗?
  • 2、Java Web 编译的异常问题
  • 3、apache log的%D到底包含什么时间
  • 4、最新版jboss有必要和tomcat整合在一起吗,还是整合Apache 或者nginx,怎么搭配好
  • 5、springmvc的静态资源为什么被拦截

有了glassfish后还需要和apache整合吗?

1、tomcat6+apache(lighttpd);2、glassfish v2.13、glassfish v2.1+apache问题就在这里,glassfish具有web服务器的能力,据说其web静态资源的处理能力不亚于apache,我的疑问是在使用glassfish后还需要她与apache整合吗?请有经验的朋友给予解答,如果有数据证明的话最好,thanks。另有一个问题:jdbc直接操作数据库与jpa相比谁的性能更好,oracle 10g,jpa在今后的分表分库上的处理的灵活程度如何?问题补充魔力猫咪 写道Apache的性能其实已经算比较差的了。即使是使用单独的静态服务器,也推荐lighttpd。Glassfish本身的性能不错,完全可以负担静态处理。当然,是否符合你的需要必须通过性能测试才能确定。JDBC和JPA的性能问题。首先,要肯定的是如果没有缓存,那么JDBC绝对比JPA快。但是现在的JPA实现都是可以缓存的,所以是否能做到超过JDBC的速度就看你的设计功力了。比如缓存的选择、缓存设置、对象结构的设计。

Java Web 编译的异常问题

org.apache.catalina.core.standardhostdeployer安装

信息:加工语境配置文件的url文件中: f : \雅加达-雄猫- 5.0.19 \ conf设置\ catalina女士\ localhost \ webmodule1.xml

2007年11月9日15时15分37秒org.apache.catalina.core.standardcontext resourcesstart

严重:错误的出发静态资源

java.lang.illegalargumentexception :文件中的c : \文件和设置\管理员\桌面\ untitled2 \ webmodule1不存在,或者是不是一个可读目录

在org.apache.naming.resources.filedircontext.setdocbase ( filedircontext.java : 185 )

在org.apache.catalina.core.standardcontext.resourcesstart ( standardcontext.java : 3856 )

在org.apache.catalina.core.standardcontext.start ( standardcontext.java : 4084 )

在org.apache.catalina.core.containerbase.addchildinternal ( containerbase.java : 866 )

在org.apache.catalina.core.containerbase.addchild ( containerbase.java : 850 )

在org.apache.catalina.core.standardhost.addchild ( standardhost.java : 638 )

在org.apache.catalina.core.standardhostdeployer.addchild ( standardhostdeployer.java : 839 )

在sun.reflect.nativemethodaccessorimpl.invoke0 (原法)

在sun.reflect.nativemethodaccessorimpl.invoke ( nativemethodaccessorimpl.java : 39 )

在sun.reflect.delegatingmethodaccessorimpl.invoke ( delegatingmethodaccessorimpl.java : 25 )

在java.lang.reflect.method.invoke ( method.java : 585 )

在org.apache.commons.beanutils.methodutils.invokemethod ( methodutils.java : 252 )

在org.apache.commons.digester.setnextrule.end ( setnextrule.java : 256 )

在org.apache.commons.digester.rule.end ( rule.java : 276 )

在org.apache.commons.digester.digester.endelement ( digester.java : 1058 )

在org.apache.catalina.util.catalinadigester.endelement ( catalinadigester.java : 123 )

在org.apache.xerces.parsers.abstractsaxparser.endelement (未知源)

在org.apache.xerces.impl.xmldocumentfragmentscannerimpl.scanendelement (未知源)

在org.apache.xerces.impl.xmldocumentfragmentscannerimpl元fragmentcontentdispatcher.dispatch (未知源)

问题补充:严重:误差在resourcestart ( )

2007年11月9日15时15分37秒org.apache.catalina.core.standardcontext开始

严重:错误getconfigured

2007年11月9日15时15分37秒org.apache.catalina.core.standardcontext开始

严重:背景下启动,但未成功,因为先前的错误

2007年11月9日15时15分37秒org.apache.catalina.core.standardcontext开始

严重:除在清理过程后,开始失败

lifecycleexception :集装箱standardcontext [ / webmodule1 ]尚未开始

在org.apache.catalina.core.standardcontext.stop ( standardcontext.java : 4400 )

在org.apache.catalina.core.standardcontext.start ( standardcontext.java : 4298 )

在org.apache.catalina.core.containerbase.addchildinternal ( containerbase.java : 866 )

在org.apache.catalina.core.containerbase.addchild ( containerbase.java : 850 )

在org.apache.catalina.core.standardhost.addchild ( standardhost.java : 638 )

在org.apache.catalina.core.standardhostdeployer.addchild

( standardhostdeployer.java : 839 )

可以看出你的文件没有存在或文件的路径不能出现中文~!!!

apache log的%D到底包含什么时间

您好,很高兴为您解答。

一.现象:

apache + mod_jk + jboss环境, jboss的处理时间和apache

log中的处理时间总是相差很大,jboss的时间是用框架记录从request进入到请求结束的时间,对于一个特定的URL,时间基本在

100ms以内,可是apache log出来的%D大都在200ms以上,有的竟然离奇的是几百秒。

二.目的:

找出jboss的业务处理和apache

log的处理时间差,如果一个正常的业务逻辑处理只需100ms,因为前置了apache却花费了200ms,说明

架构存在问题,浪费了一倍以上的时间。

三.分析:

最初怀疑是mod_jk与jboss之间通讯造成的,但测试后发现apache不加载jk自己的静态资源有时也莫名其妙地很长时间。

又怀疑是加载的module消耗了时间,但把所有的module都掉,现象还是存在。

详细看文档,就一句话:The time taken to serve the request, in microseconds.说明

%D的时间是“服务端处理时间”。

然后网上搜索相关资料,能找到的一篇文章(不具体说名称)的结论是:不包括请求发送的时间。

那么服务端处理请求的时间应该是所有请求被接受后开即处理到把响应发出去之前的这个时间,可以一个静态资源的读取不可能花

多少秒的。即使不在内存中缓存,也就是从磁盘上读这个文件然后输出。这个时间和log出来的%D相差太远。

解决疑难的万能之钥只有源码。read……………………………..

找到mod_log_config.c中:

static const char *log_request_duration(request_rec *r, char *a)

{

    apr_time_t duration = apr_time_now() – r-request_time;

    return apr_psprintf(r-pool, “%” APR_TIME_T_FMT, apr_time_sec(duration));

}

static const char *log_request_duration_microseconds(request_rec *r, char *a)

{

    return apr_psprintf(r-pool, “%” APR_TIME_T_FMT,

                        (apr_time_now() – r-request_time));

}

apr_time_now()没有疑问,服务端逻辑处理结束不包括把响应内容发送到客户端的时间。

那么r-request_time是从什么时候算起的呢?

找到protocol.c ,发现:

static int read_request_line(request_rec *r, apr_bucket_brigade *bb)

{

    const char *ll;

    const char *uri;

    const char *pro;

#if 0

    conn_rec *conn = r-connection;

#endif

    int major = 1, minor = 0;  

    char http[5];

    apr_size_t len;

    int num_blank_lines = 0;

    int max_blank_lines = r-server-limit_req_fields;

    if (max_blank_lines = 0) {

        max_blank_lines = DEFAULT_LIMIT_REQUEST_FIELDS;

    }

   

    do {

        apr_status_t rv;

       

        r-the_request = NULL;

        rv = ap_rgetline((r-the_request), (apr_size_t)(r-server-limit_req_line + 2),

                         len, r, 0, bb);

        if (rv != APR_SUCCESS) {

如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】

希望我的回答对您有所帮助,望采纳!

                                                                                                                            ~ O(∩_∩)O~

最新版jboss有必要和tomcat整合在一起吗,还是整合Apache 或者nginx,怎么搭配好

jboss整合tomcat?jboss本身是一个应用服务器,和tomcat完成的功能大体是一致的!

apache和nginx一般作前端调度器和反向代理服务器。

你可以用nginx和tomcat或者nginx和jboss搭配。

静态资源、负载均衡之类的交由nginx处理,tomcat或者jboss处于动态资源。

springmvc的静态资源为什么被拦截

“mvc:annotation-driven” 的前缀 “mvc”未绑定

办法:这是我在spring-servlet.xml文件里使用mvc开头的标签时,忘记引入了命名空间。在xml的beans里面加入如下代码即可

xmlns:mvc=””

静态文件访问,主要是让DispatcherServlet不拦截以下静态资源

mvc:annotation-driven /

mvc:resources location=”/image/” mapping=”/image/**”/

mvc:resources location=”/css/” mapping=”/css/**”/

mvc:resources location=”/js/” mapping=”/js/**”/

!– 启动扫描所有的controller —

context:component-scan base-package=”com.peidw.web”/

mvc:annotation-driven/

!– 对特定路径拦截–

mvc:interceptors

mvc:interceptor

mvc:mapping path=”/user/MyHome”/

mvc:mapping path=”/um/*”/

bean class=”cha-308b-136d-fc25-93da com.peidw.web.interceptor.MyInterceptor”/bean

/mvc:interceptor

/mvc:interceptors

在java代码里实现拦截

package com.peidw.web.interceptors;

import org.springframework.stereotype.Component;

import org.springframework.web.servlet.HandlerInterceptor;

import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.*;

/**

* Created by peidw on 2015/3/6.

*/

@Component

public class HelloInterceptor implements HandlerInterceptor{

private static Logger logger=Logger.getLogger(HelloInterceptor.class);

@Override

public boolean preHandle(HttpServletRequest httpServletRequest,

HttpServletResponse httpServletResponse, Object o) throws Exception {

logger.info(“执行Action前先判断权限”);

return true;

}

@Override

public void postHandle(HttpServletRequest httpServletRequest,

HttpServletResponse httpServletResponse, Object o, ModelAndView

modelAndView) throws Exception {

logger.info(“生成视图前,可以改model和视图”);

}

@Override

public void afterCompletion(HttpServletRequest httpServletRequest,

HttpServletResponse httpServletResponse, Object o, Exception e) throws

Exception {

logger.info(“生成视图前,可以改model和视图”);

}

}

package com.peidw.web;

import com.peidw.web.interceptors.HelloInterceptor;

import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**

* Created by peidw on 2015/3/6.

*/

@Configuration

@EnableWebMvc

public class WebApplicationConfig extends WebMvcConfigurerAdapter {

@Override

public void addInterceptors(InterceptorRegistry registry) {

registry.addInterceptor(new HelloInterceptor()).addPathPatterns(“/hello”)

}

}

!– 全局拦截 —

mvc:interceptors

bean class=”cha-136d-fc25-93da-a35a com.peidw.web.interceptor.MyInterceptor”/bean

/mvc:interceptors

一些常用注解

@Autowired和@Qualifier 自动注入[根据类型注入]

@Autowired 可以对成员变量、方法以及构造函数进行注释,

@Qualifier 的标注对象是成员变量、方法入参、构造函数入参。

ps:两者结合使用相当于@Resourcede效果。

@Resource 自动注入[根据名称注入],可写参数name=””

@Controller 表示控制器

@Service 表示业务处理层[一般在serviceImpl]

@Repository 表示持久层[一般在daoImpl]

@Component 当你的类不清楚是哪一层的时候使用该注解

@ResponseBody 异步返回数据类型为json

@RequestMapping 路径,请求类型等设置

@InitBinder 数据绑定

@RequestBody、@ModeleAttributes、@SessionAttributes等

apache静态资源】的内容来源于互联网,如引用不当,请联系我们修改。

赞(0)
文章名称:《apache静态资源(apache配置静态资源目录)》
文章链接:https://www.fzvps.com/26564.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!