vraptor-dash

Sonatype helps open source projects to set up maven repositories on http://oss.sonatype.org.

GroupId

GroupId

br.com.caelum.vraptor
ArtifactId

ArtifactId

vraptor-dash
Last Version

Last Version

4.1.0-RC3
Release Date

Release Date

Type

Type

jar
Description

Description

vraptor-dash
Sonatype helps open source projects to set up maven repositories on http://oss.sonatype.org.
Project URL

Project URL

http://maven.apache.org
Source Code Management

Source Code Management

http://github.com/caelum/vraptor-dash

Download vraptor-dash

How to add to project

<!-- https://jarcasting.com/artifacts/br.com.caelum.vraptor/vraptor-dash/ -->
<dependency>
    <groupId>br.com.caelum.vraptor</groupId>
    <artifactId>vraptor-dash</artifactId>
    <version>4.1.0-RC3</version>
</dependency>
// https://jarcasting.com/artifacts/br.com.caelum.vraptor/vraptor-dash/
implementation 'br.com.caelum.vraptor:vraptor-dash:4.1.0-RC3'
// https://jarcasting.com/artifacts/br.com.caelum.vraptor/vraptor-dash/
implementation ("br.com.caelum.vraptor:vraptor-dash:4.1.0-RC3")
'br.com.caelum.vraptor:vraptor-dash:jar:4.1.0-RC3'
<dependency org="br.com.caelum.vraptor" name="vraptor-dash" rev="4.1.0-RC3">
  <artifact name="vraptor-dash" type="jar" />
</dependency>
@Grapes(
@Grab(group='br.com.caelum.vraptor', module='vraptor-dash', version='4.1.0-RC3')
)
libraryDependencies += "br.com.caelum.vraptor" % "vraptor-dash" % "4.1.0-RC3"
[br.com.caelum.vraptor/vraptor-dash "4.1.0-RC3"]

Dependencies

compile (6)

Group / Artifact Type Version
org.hibernate : hibernate-core jar 3.6.0.Final
net.sf.ehcache : ehcache jar 1.6.2
c3p0 : c3p0 jar 0.9.1.2
br.com.caelum : vraptor jar 4.1.0-RC2
br.com.caelum.vraptor : vraptor-freemarker jar 4.0.0-RC2
javax.enterprise : cdi-api jar 1.1

provided (1)

Group / Artifact Type Version
org.mortbay.jetty : servlet-api jar 3.0.20100224

test (6)

Group / Artifact Type Version
org.hsqldb : hsqldb jar 1.8.0.10
org.jboss.weld.servlet : weld-servlet jar 2.1.2.Final
junit : junit jar 4.8.2
org.mockito : mockito-core jar 1.8.5
org.hamcrest : hamcrest-library jar 1.2.1
org.hibernate : hibernate-validator jar 4.2.0.Final

Project Modules

There are no modules declared in this project.

vraptor-dash

Build status

A dashboard with several tools for your vraptor project.

installing

It's possible to download its jar from maven's repository (see mvnrepository.com) or any other compatible tool such as maven (gradle, ivy and so on):

	<dependency>
		<groupId>br.com.caelum.vraptor</groupId>
		<artifactId>vraptor-dash</artifactId>
		<version>1.0.0</version>
		<scope>compile</scope>
	</dependency>

Configuring

Add the entity to your hibernate.cfg.xml:

br.com.caelum.vraptor.dash.statement.Statement
br.com.caelum.vraptor.dash.uristats.Stat

Create a component that implements StatementAwareUser:

@Component
public class StatementCheck implements StatementAwareUser, IdeableUser {

	private final User user;
	public StatementCheck(User user) {
		this.user = user;
	}

	public Serializable getId() {
		return user.getId();
	}

	public boolean canCreateStatements() {
		return true; // this is the admin user who is capable of seeing all statements and creating new ones. this is "GOD"
	}
}

Accessing

Go to /dash/statements Do queries as:

select count(id), uri from DashUriStat group by uri
select count(id), userId from DashUriStat group by userId

Auditing access to specific methods

If you want to log who access some methods, register:

AuditLogInterceptor

And annotate your method with the parameters to be logged:

@Audit("client")
public void edit(Client client) {
	...
}

Remember that you need the logged in user to implement the interface IdeableUser

Optimizing cache strategies

Add the following filter to your web.xml and remember to configure DashUriStat:

<filter>
	<filter-name>vraptor-dash-cache</filter-name>
	<filter-class>br.com.caelum.vraptor.dash.cache.CacheCheckFilter</filter-class>
</filter>

<filter-mapping>
	<filter-name>vraptor-dash-cache</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

Now the Stat object has the fields size, etag. If hasEtag = false, the etag is automatically generated (but not returned to the client). So now its possible to check how much kbytes and seconds one could save from using cache in not-yet-cached pages:

select uri, verb, etag, size*(count(uri)-1)/1024, time*(count(uri)-1)/1000 from DashUriStat where hasEtag=false and (cache is null or cache=="") group by uri, verb, etag

Per method, which shows how important it is to improve one method:

select resource, method, (sum(size)-   (select sum(avg(d.size)) from DashUriStat as d where d.resource=resource and d.method=method group by etag, sum(avg(d.size)))      )/1024 as ssss,(sum(time)-avg(time))/1000 as tttt from DashUriStat where cache = '' and hadEtag = 'false' and verb='GET' group by resource, method order by resource, method

Analyze where you can gain the most and optimize it.

Help

Get help at VRaptor's mailing list

br.com.caelum.vraptor

Caelum

Versions

Version
4.1.0-RC3
4.1.0-RC2
1.0.2